Exemple #1
0
        public void Run()
        {
            IList <string> input = reader.ReadLine().Split();

            while (!isRunning)
            {
                try
                {
                    if (input[0] == "Terminate")
                    {
                        writer.WriteLine(commandInterpreter.ProcessInput(input));
                        break;
                    }

                    writer.WriteLine(commandInterpreter.ProcessInput(input));
                }
                catch (TargetInvocationException ex)
                {
                    writer.WriteLine(ex.InnerException.Message);
                }
                catch (InvalidOperationException ex)
                {
                    writer.WriteLine(ex.Message);
                }

                input = reader.ReadLine().Split();
            }
        }
        public void Run()
        {
            this.isRunning = true;
            string input = string.Empty;

            while (isRunning)
            {
                input = reader.ReadLine();

                if (input == "Terminate")
                {
                    this.isRunning = false;
                }

                try
                {
                    string[] commandArgs = input.Split();
                    var      result      = commandInterpreter.ProcessInput(commandArgs);
                    writer.WriteLine(result);
                }
                catch (InvalidOperationException ex)
                {
                    writer.WriteLine(ex.Message);
                }
            }
        }
Exemple #3
0
        public void Run()
        {
            while (true)
            {
                var input = reader.ReadLine();

                var tokens = input.Split().ToList();

                if (tokens[0] == "Terminate")
                {
                    writer.WriteLine(commandInterpreter.ProcessInput(tokens));
                    break;
                }

                writer.WriteLine(commandInterpreter.ProcessInput(tokens));
            }
        }
Exemple #4
0
        public void Run()
        {
            while (isRunning)
            {
                List <string> input = Console.ReadLine().Split().ToList <string>();

                if (input[0] == "Terminate")
                {
                    isRunning = false;
                    Console.WriteLine(commandInterpreter.ProcessInput(input));
                    break;
                }
                else
                {
                    Console.WriteLine(commandInterpreter.ProcessInput(input));
                }
            }
        }
Exemple #5
0
 public void Run()
 {
     while (isRunning)
     {
         var inputParameters = reader.ReadLine().Split().ToList();
         if (inputParameters[0] == "Terminate")
         {
             isRunning = false;
         }
         writer.WriteLine(commandInterpreter.ProcessInput(inputParameters));
     }
 }
Exemple #6
0
 public void Run()
 {
     while (true)
     {
         List <string> args   = reader.ReadLine().Split(' ', StringSplitOptions.RemoveEmptyEntries).ToList();
         string        result = commandInterpreter.ProcessInput(args);
         writer.WriteLine(result);
         if (args.Count == 0)
         {
             break;
         }
     }
     //Console.WriteLine(((ConsoleWriter)writer).result.ToString().TrimEnd());
 }
        public void Run()
        {
            this.isRunning = true;

            while (isRunning)
            {
                List <string> arguments = reader.ReadLine().Split().ToList();

                if (arguments[0] == "Terminate")
                {
                    isRunning = false;
                }

                string result = commandInterpreter.ProcessInput(arguments);
                sb.AppendLine(result);
            }

            writer.WriteLine(sb.ToString().TrimEnd());
        }
Exemple #8
0
        public void Run()
        {
            this.isRunning = true;

            List <string> commandOutput = new List <string>();

            while (isRunning)
            {
                List <string> input = reader.ReadLine().Split(' ').ToList();

                if (input[0].Trim() == "Terminate")
                {
                    isRunning = false;
                }

                commandOutput.Add(commandInterpreter.ProcessInput(input));
            }

            commandOutput.ForEach(s => writer.WriteLine(s));
        }
Exemple #9
0
        public void Run()
        {
            while (IsRunning == true)
            {
                string[] input = reader.ReadLine().Split();

                try
                {
                    writer.WriteLine(commandInterpreter.ProcessInput(input));
                }
                catch (ArgumentException ae)
                {
                    writer.WriteLine(ae.Message);
                }

                if (input[0] == "Terminate")
                {
                    IsRunning = false;
                }
            }
        }