Exemple #1
0
 private void OnChanged(object sender, FileSystemEventArgs e)
 {
     try
     {
         if (!string.IsNullOrEmpty(WatchFilter) && (WatchFilter.Contains(",") || WatchFilter.Contains("|")))
         {
             bool cont  = false;
             var  array = WatchFilter.Split(new Char[] { ',', '|' });
             foreach (var ext in array)
             {
                 if (PatternMatcher.FitsMask(e.FullPath, ext))
                 {
                     cont = true;
                 }
             }
             if (!cont)
             {
                 return;
             }
         }
         TimeSpan timepassed = DateTime.Now - lastTriggered;
         if (timepassed.Milliseconds < 100)
         {
             return;
         }
         lastTriggered = DateTime.Now;
         var _e = new DetectorEvent(e.FullPath);
         OnDetector?.Invoke(this, _e, EventArgs.Empty);
     }
     catch (Exception ex)
     {
         Log.Error(ex.ToString());
     }
 }
 private void OnChanged(object sender, FileSystemEventArgs e)
 {
     try
     {
         TimeSpan timepassed = DateTime.Now - lastTriggered;
         if (timepassed.Milliseconds < 100)
         {
             return;
         }
         lastTriggered = DateTime.Now;
         var _e = new DetectorEvent(e.FullPath);
         OnDetector?.Invoke(this, _e, EventArgs.Empty);
     }
     catch (Exception ex)
     {
         Log.Error(ex.ToString());
     }
 }