private void RegisterDirectoryWatcher(string path) { DirectoryWatcher directoryWatcher = new DirectoryWatcher(path, OnFileEvent, OnError); directoryWatcher.Start(); DirectoryWatchers.Add(path, directoryWatcher); }
public static void RegisterDirectoryWatcher(string path) { DirectoryWatcher directoryWatcher = new DirectoryWatcher(path, OnFileEvent, OnError); directoryWatcher.Start(); if (DirectoryWatchers.ContainsKey(path)) { DirectoryWatchers[path].Stop(); DirectoryWatchers.Remove(path); } DirectoryWatchers.Add(path, directoryWatcher); }