Ejemplo n.º 1
0
 /// <summary>
 /// Executes a script passed to the application,
 /// parsing the commands listed in a valid text file
 /// that has the extension '.mds'
 /// </summary>
 /// <param name="param"></param>
 public override void Execute(string param)
 {
     try
     {
         if (param != "" && param != null && param.Length < 5 && param.EndsWith(".mds"))
         {
             if (File.Exists(Paths.CurrentDirectory + Paths.Separator + param))
             {
                 string[] lines = File.ReadAllLines(param);
                 foreach (string line in lines)
                 {
                     CommandConsole.Parse(line);
                     //Console.WriteLine("");
                 }
             }
             else
             {
             }
             {
                 CommandConsole.InvalidCommand(param, 2);
             }
         }
         else
         {
             Console.WriteLine("Not a valid Medliscript file.");
         }
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.Message);
     }
 }
Ejemplo n.º 2
0
 public static void ViewFile(string file)
 {
     DrawScreen();
     try
     {
         if (File.Exists(Paths.CurrentDirectory + @"\" + file))
         {
             string[] lines = File.ReadAllLines(Paths.CurrentDirectory + @"\" + file);
             foreach (string line in lines)
             {
                 Console.WriteLine(line);
             }
         }
         else if (!File.Exists(Paths.CurrentDirectory + @"\" + file))
         {
             CommandConsole.InvalidCommand(file, 2);
         }
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.Message);
     }
     Extensions.PressAnyKey();
 }