void OnCreated(object sender, FileSystemEventArgs e) { if (System.IO.Directory.Exists(e.FullPath)) { directoryNameSet.Add(Path.GetFileName(e.FullPath)); } var path = GetVirtualPath(e.FullPath); RaiseChanged(FileSystemChange.FromCreated(path)); }
void OnChanged(object sender, FileSystemChange e) { switch (e.ChangeType) { case WatcherChangeTypes.Created: if (e.NewPath.ParentPath == path) { RaiseChanged(e); } break; case WatcherChangeTypes.Changed: if (e.NewPath.ParentPath == path) { RaiseChanged(e); } break; case WatcherChangeTypes.Deleted: if (e.OldPath.ParentPath == path) { RaiseChanged(e); } break; case WatcherChangeTypes.Renamed: if (e.OldPath.ParentPath == path) { if (e.NewPath.ParentPath == path) { RaiseChanged(e); } else { RaiseChanged(FileSystemChange.FromDeleted(e.OldPath)); } } else { if (e.NewPath.ParentPath == path) { RaiseChanged(FileSystemChange.FromCreated(e.NewPath)); } } break; } }