Beispiel #1
0
        private void RegisterDirectoryWatcher(string path)
        {
            DirectoryWatcher directoryWatcher = new DirectoryWatcher(path, OnFileEvent, OnError);

            directoryWatcher.Start();

            DirectoryWatchers.Add(path, directoryWatcher);
        }
Beispiel #2
0
        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);
        }