Esempio n. 1
0
 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);
             }
         }
     }
 }
Esempio n. 2
0
        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);
            }
        }