private void DirectoryChanged(object ASender, FileSystemEventArgs AArgs) { if ((AArgs.ChangeType & WatcherChangeTypes.Created) != 0) { Document LDocument = Document.FromFileName(FFrontendDevice, GetActualFileName(AArgs.FullPath)); lock (FDocuments) { if ((LDocument != null) && !FDocuments.Contains(LDocument)) { FDocuments.Add(LDocument); DoDocumentCreated(LDocument); } } } else if ((AArgs.ChangeType & WatcherChangeTypes.Deleted) != 0) { lock (FDocuments) { Document LDocument = FDocuments.GetDocumentFromFileName(Path.GetFileNameWithoutExtension(AArgs.FullPath)); if (LDocument != null) { FDocuments.Remove(LDocument); DoDocumentDeleted(LDocument); } } } }
private void DirectoryRenamed(object ASender, RenamedEventArgs AArgs) { Document LDocument = Document.FromFileName(FFrontendDevice, GetActualFileName(AArgs.FullPath)); lock (FDocuments) { Document LOldDocument = FDocuments.GetDocumentFromFileName(Path.GetFileNameWithoutExtension(AArgs.OldFullPath)); if (LOldDocument != null) { FDocuments.Remove(LOldDocument); DoDocumentDeleted(LOldDocument); } FDocuments.Add(LDocument); DoDocumentCreated(LDocument); } }