#pragma warning restore CA2000 // Dispose objects before losing scope private void Created(object sender, FilesMonitorEventArgs e) { try { if (!_files.TryGetValue(e.File, out var file)) { file = new File(e.File, this, ++_lastFileIndex); _files.TryAdd(e.File, file); if (!Configs.IsShowFileDefined && _files.Count > 1) { Configs.ShowFile = true; } if (file.FileType == FileTypes.Archive) { AddFile(e.File); return; } } if (e.Sender is FileSystemWatcher) { _pushFilesToBeProcess.Enqueue(file); _processEvent.Set(); } else { _pollFilesToBeProcess.Enqueue(file); } } #pragma warning disable CA1031 // Do not catch general exception types catch (Exception ex) #pragma warning restore CA1031 // Do not catch general exception types { NewLineCallback(GetErrorLine(ex.Message), 0); } }
private void Deleted(object sender, FilesMonitorEventArgs e) => _files.TryRemove(e.File, out _);
private void Changed(object sender, FilesMonitorEventArgs e) => Created(this, e);