Пример #1
0
        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;
        }
Пример #2
0
 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);
 }
Пример #3
0
        protected void OnFindedRaise(FindDataResultEventArgs arg)
        {
            if (arg == null)
            {
                throw new ArgumentNullException(nameof(arg));
            }

            Finded?.Invoke(this, arg);
        }
Пример #4
0
 protected void OnFindedRaise(string findText, object result)
 {
     Finded?.Invoke(this, new FindDataResultEventArgs(findText, result));
 }