Ejemplo n.º 1
0
 private static void uploaderConfigWatcher_Changed(object sender, FileSystemEventArgs e)
 {
     if (!uploaderConfigWatcherTimer.IsDuplicateEvent(e.FullPath))
     {
         Action onCompleted = () => ReloadUploadersConfig(e.FullPath);
         Helpers.WaitWhileAsync(() => Helpers.IsFileLocked(e.FullPath), 250, 5000, onCompleted, 1000);
         uploaderConfigWatcherTimer = new WatchFolderDuplicateEventTimer(e.FullPath);
     }
 }
Ejemplo n.º 2
0
 public static void ConfigureUploadersConfigWatcher()
 {
     if (Settings.DetectUploaderConfigFileChanges && uploaderConfigWatcher == null)
     {
         uploaderConfigWatcher                     = new FileSystemWatcher(Path.GetDirectoryName(UploadersConfigFilePath), Path.GetFileName(UploadersConfigFilePath));
         uploaderConfigWatcher.Changed            += uploaderConfigWatcher_Changed;
         uploaderConfigWatcherTimer                = new WatchFolderDuplicateEventTimer(UploadersConfigFilePath);
         uploaderConfigWatcher.EnableRaisingEvents = true;
     }
     else if (uploaderConfigWatcher != null)
     {
         uploaderConfigWatcher.Dispose();
         uploaderConfigWatcher = null;
     }
 }