Exemplo n.º 1
0
 void AddFile()
 {
     while (true)
     {
         try
         {
             Console.WriteLine("Adding files... e to exit...\nformat: column:firstfilename,secondfilename,etc");
             string input = Console.ReadLine(); Console.WriteLine();
             if (input == "exit")
             {
                 Console.WriteLine("Exiting AddFile..."); break;
             }
             int             column = int.Parse(input.Substring(0, input.IndexOf(":"))) - 1;
             List <string[]> list   = new List <string[]>();
             input = input.Substring(input.IndexOf(":") + 1);
             while (input.Length > 0)
             {
                 string[] file = new string[2]; // 0=filename, 1=rotation option
                 file[0] = input.Substring(0, 4);
                 if (!targetFiles.Contains(file[0]))
                 {
                     Console.WriteLine("Bad file name detected, try again");
                 }
                 string temp = "";
                 if (input.Length > 4)
                 {
                     temp = input.Substring(4, 1);
                 }
                 if (temp == "l" || temp == "r" || temp == "t")
                 {
                     file[1] = temp;
                 }
                 else
                 {
                     file[1] = "";
                 }
                 list.Add(file);
                 if (input.IndexOf(",") > -1)
                 {
                     input = input.Substring(input.IndexOf(",") + 1);
                 }
                 else
                 {
                     input = "";
                 }
             }
             array.AddToArray(list, column);
             Console.WriteLine("Successfully added files to array.");
             Info();
         }
         catch (Exception e) { Console.WriteLine("Bad input, try again..(error " + e + ")"); }
     }
 }