void fileSystemWatcher_Renamed(object sender, RenamedEventArgs e) { if (ChangeMethod != null) { if (Removed_Paths.Contains(e.FullPath)) { Removed_Paths.Remove(e.FullPath); } if (New_Paths.Contains(e.FullPath)) { New_Paths.Remove(e.FullPath); } if (New_Paths.Contains(e.OldFullPath)) { New_Paths.Remove(e.OldFullPath); } if (Changed_Paths.Contains(e.FullPath)) { Changed_Paths.Remove(e.FullPath); } if (Changed_Paths.Contains(e.OldFullPath)) { Changed_Paths.Remove(e.OldFullPath); } if (Regex.IsMatch(e.FullPath.ToLower(), RegExFilter)) { this.Ischanged = true; Rename_Paths.Add(new Rename_Path(e.OldFullPath, e.FullPath)); } ChangeMethod.DynamicInvoke(sender, e); } }
void fileSystemWatcher_Changed(object sender, FileSystemEventArgs e) { if (ChangeMethod != null) { if (e.ChangeType == WatcherChangeTypes.Created) { if (New_Paths.Contains(e.FullPath)) { return; } if (Removed_Paths.Contains(e.FullPath)) { Removed_Paths.Remove(e.FullPath); } if (Regex.IsMatch(e.FullPath.ToLower(), RegExFilter)) { this.Ischanged = true; New_Paths.Add(e.FullPath); } } else if (e.ChangeType == WatcherChangeTypes.Deleted) { if (Removed_Paths.Contains(e.FullPath)) { return; } if (New_Paths.Contains(e.FullPath)) { New_Paths.Remove(e.FullPath); } if (Rename_Paths.Find(f => f.New_path == e.FullPath) != null) { Rename_Paths.Remove(Rename_Paths.Find(f => f.New_path == e.FullPath)); } if (Regex.IsMatch(e.FullPath.ToLower(), RegExFilter)) { this.Ischanged = true; Removed_Paths.Add(e.FullPath); } } else if (e.ChangeType == WatcherChangeTypes.Changed) { if (Changed_Paths.Contains(e.FullPath)) { return; } if (New_Paths.Contains(e.FullPath)) { New_Paths.Remove(e.FullPath); } if (Removed_Paths.Contains(e.FullPath)) { Removed_Paths.Remove(e.FullPath); } if (Rename_Paths.Find(f => f.New_path == e.FullPath) != null) { Rename_Paths.Remove(Rename_Paths.Find(f => f.New_path == e.FullPath)); } if (Regex.IsMatch(e.FullPath.ToLower(), RegExFilter)) { this.Ischanged = true; Changed_Paths.Add(e.FullPath); } } ChangeMethod.DynamicInvoke(sender, e); } }
public void Clear_Newpaths() { New_Paths.Clear(); }