示例#1
0
        public void Start()
        {
            //TODO: LOG: Starting service
            foreach (string folderDir in Folders)
            {
                var fw = new FileSystemWatcher();
                fw.Path         = folderDir;
                fw.NotifyFilter = NotifyFilters.Attributes | NotifyFilters.CreationTime
                                  | NotifyFilters.DirectoryName | NotifyFilters.FileName
                                  | NotifyFilters.LastAccess | NotifyFilters.LastWrite
                                  | NotifyFilters.Security | NotifyFilters.Size;

                fw.Filter = "*.*";
                var notifyChanges = new FileSystemEventHandler(NotifyChanges);
                fw.Changed            += notifyChanges;
                fw.Deleted            += notifyChanges;
                fw.Renamed            += Renamed;;
                fw.Changed            += notifyChanges;
                fw.EnableRaisingEvents = true;

                FileSystemWatcher.Add(fw);
            }
            //TODO: LOG: Service started successfully
        }