private void OnEventRaised(object sender, FileSystemEventArgs e) { if ((sender == null) || (e == null)) { Logger.NullError(nameof(sender) + " || " + nameof(e)); return; } double secondsSinceLastRead = DateTime.Now.Subtract(LastEventTime).TotalSeconds; LastEventTime = DateTime.Now; if (secondsSinceLastRead <= DELAY_SECS) { return; } string absoluteFileName = Path.GetFileName(e.Name); if (string.IsNullOrEmpty(absoluteFileName)) { return; } if (IgnoredFiles.Where(x => x.Equals(absoluteFileName, StringComparison.OrdinalIgnoreCase)).Count() > 0) { return; } if (EventActionPairs.Count <= 0) { return; } if (IsModuleWatcher && EventActionPairs.Count >= 1) { EventActionPairs.FirstOrDefault().Value.Invoke(absoluteFileName); return; } EventActionPairs.ForEachElement((fileName, action) => { if (!string.IsNullOrEmpty(fileName) && action != null && absoluteFileName.Equals(fileName, StringComparison.OrdinalIgnoreCase)) { action.Invoke(absoluteFileName); Logger.Trace($"Watcher event raised '{fileName}'"); } }); }