private void OnChanged(object source, FileSystemEventArgs e) { // do not handle folder change if (e.ChangeType == WatcherChangeTypes.Changed && Directory.Exists(e.FullPath)) { return; } lock (events) { FileSystemEventWrapper @event = new FileSystemEventWrapper(); @event.Type = e.ChangeType; @event.Time = DateTime.Now; @event.Path = e.Name; @event.FullPath = e.FullPath; events.Add(@event); } logger.DebugFormat("FileSystemWatcher [{0}] {1}.", e.ChangeType, GetRelativePath(e.Name)); }
private void OnRenamed(object source, RenamedEventArgs e) { lock (events) { FileSystemEventWrapper @event = new FileSystemEventWrapper(); @event.Type = e.ChangeType; @event.Time = DateTime.Now; @event.Path = e.OldName; @event.FullPath = e.OldFullPath; @event.NewPath = e.Name; @event.NewFullPath = e.FullPath; events.Add(@event); } logger.DebugFormat("FileSystemWatcher [Rename] {1}=>{2}.", e.ChangeType, GetRelativePath(e.OldName), GetRelativePath(e.Name)); }