Advertisement
Kosty_Fomin

Untitled

Sep 27th, 2016
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.55 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using System.IO;
  7. using ClassLibrary1;
  8.  
  9. namespace Fomin
  10. {
  11.     class Program
  12.     {
  13.         static void Main(string[] args)
  14.         {
  15.             string folderName = @"...\...\...\";
  16.             do {
  17.                 Console.WriteLine("Input Folder name");
  18.                 folderName += Console.ReadLine();
  19.                
  20.                 try
  21.                 {
  22.                     DirectoryInfo di = new DirectoryInfo(folderName);
  23.                     var b = di.GetFiles("*.txt");
  24.                     OverAllResults ov = new OverAllResults(folderName);
  25.                     foreach (var f in b)
  26.                     {
  27.                         ov.add(f.ToString());
  28.  
  29.                     }
  30.                    
  31.                     foreach (var result in ov.perRes)
  32.                     {
  33.                         Console.WriteLine(result.ToString());
  34.                     }
  35.  
  36.  
  37.                 }
  38.                 catch (DirectoryNotFoundException)
  39.                 {
  40.                     Console.WriteLine("Enter correct Directory");
  41.                 }
  42.                 catch (FileNotFoundException)
  43.                 {
  44.                     Console.WriteLine("Can not find file!");
  45.                 }
  46.  
  47.                 catch (Exception) {
  48.                 }
  49.  
  50.  
  51.                 Console.WriteLine("Press ecs to exit");
  52.             }
  53.             while (Console.ReadKey().Key!=ConsoleKey.Escape);//exit from programm by ecs
  54.         }
  55.     }
  56. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement