Ejemplo n.º 1
0
 private void OnRenamed(object source, RenamedEventArgs e)
 {
     // Specify what is done when a file is renamed.
     mainForm.addFileChange("File: " + e.OldFullPath + " renamed to " + e.FullPath);
     FileEvent fe = new FileEvent(++eventnum, e.ChangeType, e.FullPath, e.OldFullPath);
     proc.addevent(ref fe);
 }
Ejemplo n.º 2
0
 public void addevent(ref FileEvent fe)
 {
     lock (eventTable)
     {
         eventTable.Add(fe.eventnum, fe);
     }
 }
Ejemplo n.º 3
0
 public void enqueueEvent(ref FileEvent fe)
 {
     lock (eventQueue)
     {
         eventQueue.Enqueue(fe);
     }
     cond.Set();
 }
Ejemplo n.º 4
0
 private void OnCreated(object source, FileSystemEventArgs e)
 {
     mainForm.addFileChange("File: " + e.FullPath + " " + e.ChangeType);
     FileAttributes fa = File.GetAttributes(e.FullPath);
     if (fa == FileAttributes.Directory)
     {
         /*文件夹新建时,所有子文件也要生成*/
         recurAddevent(e.FullPath, e.ChangeType);
     }
     FileEvent fe = new FileEvent(++eventnum, e.ChangeType, e.FullPath);
     proc.addevent(ref fe);
 }
Ejemplo n.º 5
0
 private void recurAddevent(string dir, WatcherChangeTypes changetype)
 {
     string[] filelist = Directory.GetFileSystemEntries(dir);
     foreach (string file in filelist)
     {
         if (Directory.Exists(file))
         {
             recurAddevent(file, changetype);
         }
         else
         {
             FileEvent fe = new FileEvent(++eventnum, changetype, file);
             proc.addevent(ref fe);
         }
     }
 }