예제 #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);
     }
 }
예제 #2
0
파일: Program.cs 프로젝트: Z1ni/ShareX
 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);
     }
 }
예제 #3
0
파일: Program.cs 프로젝트: Z1ni/ShareX
 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;
     }
 }
예제 #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);
     }
 }
예제 #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;
     }
 }
예제 #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);
     }
 }