Esempio n. 1
0
        public void Run()
        {
            while (true)
            {
                try
                {
                    string   input       = Console.ReadLine();
                    string[] data        = input.Split();
                    string   commandName = data[0];

                    if (string.IsNullOrWhiteSpace(commandName))
                    {
                        continue;
                    }

                    var    interpreter = new CommandInterpreter(repository, unitFactory);
                    var    command     = interpreter.InterpretCommand(data, commandName);
                    string result      = command.Execute();

                    Console.WriteLine(result);
                }
                catch (Exception e)
                {
                    Console.WriteLine(e.Message);
                }
            }
        }
Esempio n. 2
0
 public void Run()
 {
     while (true)
     {
         try
         {
             string   input       = Console.ReadLine();
             string[] data        = input.Split();
             string   commandName = data[0];
             string   result      = commandInterpreter.InterpretCommand(data, commandName);
             Console.WriteLine(result);
         }
         catch (Exception e)
         {
             Console.WriteLine(e.Message);
         }
     }
 }