示例#1
0
        /// <summary>
        /// Method runs program
        /// </summary>
        public static void Run()
        {
            int i = 0;

            while (i == 0)
            {
                try
                {
                    Console.Write("Input path: ");
                    string path = Console.ReadLine();
                    info = new DirectoriesInfo(path);
                    Select();
                    i = 1;
                }
                catch (DirectoryNotFoundException e)
                {
                    Console.WriteLine("Error: " + e.Message);
                    Console.WriteLine("Try again...");
                }
                catch (FormatException e)
                {
                    Console.WriteLine("Error: " + e.Message);
                    Console.WriteLine("Try again...");
                }
            }
        }
示例#2
0
 /// <summary>
 /// Form an array of directories
 /// </summary>
 /// <param name="path">Path to directory</param>
 /// <returns>Array of directories</returns>
 private DirectoriesInfo[] GetDirectoriesInfos(string path)
 {
     string[]          pathes = Directory.GetDirectories(path);
     DirectoriesInfo[] array  = new DirectoriesInfo[pathes.Length];
     for (int i = 0; i < pathes.Length; i++)
     {
         array[i] = new DirectoriesInfo(pathes[i]);
     }
     return(array);
 }