public IEnumerable <string> OutputFolder(int choice) { string[] folders = null; Start?.Invoke("Start"); try { folders = Directory.GetFiles(_path, _filter, SearchOption.AllDirectories); } catch (UnauthorizedAccessException) { Console.WriteLine("Access denieds"); } if (folders != null) { if (choice == 1) { filterFinded?.Invoke("With filtration"); for (int i = 0; i < folders.Length; i++) { yield return(folders[i]); } } else { Finded?.Invoke("No filtration"); for (int i = 0; i < folders.Length; i++) { yield return(folders[i]); } } } Finish("Finish"); yield break; }
public Parser(Uri uri, int depth, int maxCount, HttpClient client, IAnalyzer analyzer) { #region Проверки if (uri is null) { throw new ArgumentNullException("uri is null"); } if (depth <= 1) { throw new ArgumentOutOfRangeException("depth must be greater than 1"); } if (maxCount <= 1) { throw new ArgumentOutOfRangeException("maxCount must be greater than 1"); } if (client is null) { throw new ArgumentNullException("client is null"); } if (analyzer is null) { throw new ArgumentNullException("analyzer is null"); } #endregion URI = uri; Depth = depth; MaxCount = maxCount; Client = client; Analyzer = analyzer; Analyzer.Finded += s => Finded.Invoke(s); }
protected void OnFindedRaise(FindDataResultEventArgs arg) { if (arg == null) { throw new ArgumentNullException(nameof(arg)); } Finded?.Invoke(this, arg); }
protected void OnFindedRaise(string findText, object result) { Finded?.Invoke(this, new FindDataResultEventArgs(findText, result)); }