Esempio n. 1
0
 private void btnSearch_Click(object sender, EventArgs e)
 {
     lbResults.Items.Clear();
     var filesFinder = new FilesFinder();
     string[] directories = tbPath.Text.Split(new[] {' '});
     var foundFilesAndCount = filesFinder.SearchWithSameNames(directories);
     lbResults.BeginUpdate();
     foreach (var fc in foundFilesAndCount)
     {
         lbResults.Items.Add(string.Format("{0}: {1}", fc.FileName, fc.Count));
     }
     lbResults.EndUpdate();
 }
Esempio n. 2
0
 private static void DoSearch(string[] args)
 {
     var filesFinder = new FilesFinder();
     var filesWithSameName = filesFinder.SearchWithSameNames(args);
     foreach (var fileAndCount in filesWithSameName)
     {
         Console.WriteLine("{0}: {1}", fileAndCount.FileName, fileAndCount.Count);
     }
     var errorsList = filesFinder.GetLastErrors();
     if (errorsList.Count > 0)
     {
         Console.Error.WriteLine("* Errors:");
         foreach (var err in errorsList)
         {
             Console.WriteLine("* {0}", err);
         }
     }
 }