mac watcher: check files twice a minute
This commit is contained in:
parent
fc51ec31ce
commit
d992c62d6f
|
@ -30,6 +30,7 @@ namespace SparkleShare {
|
||||||
|
|
||||||
private FileSystemInfo last_changed;
|
private FileSystemInfo last_changed;
|
||||||
private Thread thread;
|
private Thread thread;
|
||||||
|
private int poll_count = 0;
|
||||||
|
|
||||||
|
|
||||||
public SparkleMacWatcher (string path)
|
public SparkleMacWatcher (string path)
|
||||||
|
@ -50,7 +51,8 @@ namespace SparkleShare {
|
||||||
Changed (relative_path);
|
Changed (relative_path);
|
||||||
}
|
}
|
||||||
|
|
||||||
Thread.Sleep (10 * 1000);
|
Thread.Sleep (7500);
|
||||||
|
this.poll_count++;
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
@ -73,11 +75,15 @@ namespace SparkleShare {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (FileInfo info in parent.GetFiles ()) {
|
if (this.poll_count >= 8) {
|
||||||
if (!info.FullName.Contains ("/.")) {
|
foreach (FileInfo info in parent.GetFiles ()) {
|
||||||
if (DateTime.Compare (info.LastWriteTime, this.last_changed.LastWriteTime) > 0)
|
if (!info.FullName.Contains ("/.")) {
|
||||||
this.last_changed = (FileSystemInfo) info;
|
if (DateTime.Compare (info.LastWriteTime, this.last_changed.LastWriteTime) > 0)
|
||||||
|
this.last_changed = info;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.poll_count = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (Exception) {
|
} catch (Exception) {
|
||||||
|
|
Loading…
Reference in a new issue