public static void EnqueueFile(MonitorFile file) { lock (FileQueue) { if (FileQueue.Count > 0) { MonitorFile top = FileQueue.Peek(); if (top != null && top.full_path == file.full_path) { return; } } FileQueue.Enqueue(file); } }
private void changed(Object sender, FileSystemEventArgs e) { MonitorFile add_me = new MonitorFile(this); add_me.root = (sender as FileSystemWatcher).Path; add_me.path = e.Name; add_me.change_type = e.ChangeType; add_me.origin = Origin.Game; if (e.ChangeType == WatcherChangeTypes.Renamed) { try { add_me.old_path = ((RenamedEventArgs)e).OldName; } catch { add_me.old_path = null; } } else { add_me.old_path = null; } Monitor.EnqueueFile(add_me); }
public static void EnqueueFile(MonitorFile file) { lock (FileQueue) { if (FileQueue.Count > 0) { MonitorFile top = FileQueue.Peek(); if (top != null && top.full_path == file.full_path) return; } FileQueue.Enqueue(file); } }