Exemple #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);
     }
 }
Exemple #2
0
 private static void uploaderConfigWatcher_Changed(object sender, FileSystemEventArgs e)
 {
     if (!uploaderConfigWatcherTimer.IsDuplicateEvent(e.FullPath))
     {
         SynchronizationContext context = SynchronizationContext.Current ?? new SynchronizationContext();
         Action onCompleted             = () => context.Post(state => ReloadUploadersConfig(e.FullPath), null);
         Helpers.WaitWhileAsync(() => Helpers.IsFileLocked(e.FullPath), 250, 5000, onCompleted, 1000);
         uploaderConfigWatcherTimer = new WatchFolderDuplicateEventTimer(e.FullPath);
     }
 }
Exemple #3
0
 public static void ConfigureUploadersConfigWatcher()
 {
     if (Program.Settings.DetectUploaderConfigFileChanges && uploaderConfigWatcher == null)
     {
         uploaderConfigWatcher                     = new FileSystemWatcher(Path.GetDirectoryName(Program.UploadersConfigFilePath), Path.GetFileName(Program.UploadersConfigFilePath));
         uploaderConfigWatcher.Changed            += uploaderConfigWatcher_Changed;
         uploaderConfigWatcherTimer                = new WatchFolderDuplicateEventTimer(Program.UploadersConfigFilePath);
         uploaderConfigWatcher.EnableRaisingEvents = true;
     }
     else if (uploaderConfigWatcher != null)
     {
         uploaderConfigWatcher.Dispose();
         uploaderConfigWatcher = null;
     }
 }
Exemple #4
0
 private static void uploaderConfigWatcher_Changed(object sender, FileSystemEventArgs e)
 {
     if (!uploaderConfigWatcherTimer.IsDuplicateEvent(e.FullPath))
     {
         SynchronizationContext context = SynchronizationContext.Current ?? new SynchronizationContext();
         Action onCompleted = () => context.Post(state => ReloadUploadersConfig(e.FullPath), null);
         Helpers.WaitWhileAsync(() => Helpers.IsFileLocked(e.FullPath), 250, 5000, onCompleted, 1000);
         uploaderConfigWatcherTimer = new WatchFolderDuplicateEventTimer(e.FullPath);
     }
 }
Exemple #5
0
 public static void ConfigureUploadersConfigWatcher()
 {
     if (Program.Settings.DetectUploaderConfigFileChanges && uploaderConfigWatcher == null)
     {
         uploaderConfigWatcher = new FileSystemWatcher(Path.GetDirectoryName(Program.UploadersConfigFilePath), Path.GetFileName(Program.UploadersConfigFilePath));
         uploaderConfigWatcher.Changed += uploaderConfigWatcher_Changed;
         uploaderConfigWatcherTimer = new WatchFolderDuplicateEventTimer(Program.UploadersConfigFilePath);
         uploaderConfigWatcher.EnableRaisingEvents = true;
     }
     else if (uploaderConfigWatcher != null)
     {
         uploaderConfigWatcher.Dispose();
         uploaderConfigWatcher = null;
     }
 }
Exemple #6
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);
     }
 }