Example #1
0
    public void Run()
    {
        while (true)
        {
            var data = reader.ReadLine();
            if (data == "System Split")
            {
                commandInterpreter.ProcessCommand(data.Split());
                continue;
            }
            if (data == "Analyze()")
            {
                var           token = data.Substring(0, 7);
                List <string> cc    = new List <string>();
                cc.Add(token);
                string result = commandInterpreter.ProcessCommand(cc);
                writer.WriteLine(result);
                continue;
            }
            string         typeCommand = SplitCommandData(data);
            IList <string> args        = SplitArgsData(data);
            args.Insert(0, typeCommand);

            try
            {
                this.commandInterpreter.ProcessCommand(args);
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }
        }
    }
    public void Run()
    {
        while (true)
        {
            try
            {
                var input = this.reader.ReadLine();
                var data  = input.Split().ToList();

                var commandName = data[0];

                string command = commandInterpreter.ProcessCommand(data);

                this.writer.WriteLine(command);

                if (commandName == Constants.End)
                {
                    break;
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }

            //switch (command)
            //{
            //    case RegisterHarvester:
            //        var args = new List<string>(data.Skip(1).ToList());
            //        manager.RegisterHarvester(args);
            //        break;
            //    case RegisterProvider:
            //        args = new List<string>(data.Skip(1).ToList());
            //        manager.RegisterProvider(args);
            //        break;
            //    case Day:
            //        manager.Day();
            //        break;
            //    case Mode:
            //        args = new List<string>(data.Skip(1).ToList());
            //        manager.Mode(args);
            //        break;
            //    case Check:
            //        args = new List<string>(data.Skip(1).ToList());
            //        //Console.WriteLine(manager.Check(args));
            //        break;
            //    default:
            //        manager.ShutDown();
            //        Environment.Exit(0);
            //        break;
            //}
        }
    }
Example #3
0
 public void Run()
 {
     while (true)
     {
         var input = reader.ReadLine().Trim();
         var data  = input.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).ToList();
         writer.WriteLine(commandInterpreter.ProcessCommand(data));
         if (input == "Shutdown")
         {
             Environment.Exit(0);
         }
     }
 }
Example #4
0
 public void Run()
 {
     while (true)
     {
         List <string> inputArgs = reader.ReadLine().Split().ToList();
         string        result    = commandInterpreter.ProcessCommand(inputArgs);
         writer.WriteLine(result);
         if (inputArgs[0] == "Shutdown")
         {
             break;
         }
     }
 }
Example #5
0
    public void Run()
    {
        while (true)
        {
            var inputArgs = reader.ReadLine().Split().ToList();

            string result = commandInterpreter.ProcessCommand(inputArgs);

            writer.WriteLine(result);

            if (inputArgs[0] == Constants.EndProgram)
            {
                break;
            }
        }
    }
Example #6
0
    public void Run()
    {
        while (true)
        {
            var input = reader.ReadLine();
            var data  = input.Split().ToList();

            string result = commandInterpreter.ProcessCommand(data);
            writer.WriteLine(result);

            if (data[0].Equals("ShutDown", StringComparison.InvariantCultureIgnoreCase))
            {
                break;
            }
        }
    }
    public void Run()
    {
        while (true)
        {
            var input = reader.ReadLine().TrimEnd();

            var data = input.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).ToList();

            var result = commandInterpreter.ProcessCommand(data);
            this.writer.WriteLine(result);

            if (input.Equals(ShutdownCommand, StringComparison.OrdinalIgnoreCase))
            {
                break;
            }
        }
    }
Example #8
0
    public void Run()
    {
        bool isRunning = true;

        while (isRunning)
        {
            var input = consoleReader.ReadLine();

            var data = input.Split(new string[] { " " }, StringSplitOptions.RemoveEmptyEntries).ToList();

            this.consoleWriter.WriteLine(commandInterpreter.ProcessCommand(data));

            if (data[0] == "Shutdown")
            {
                isRunning = false;
            }
        }
    }
Example #9
0
    public void Run()
    {
        this.isRunning = true;

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

            var data   = input.Split().ToList();
            var result = commandInterpreter.ProcessCommand(data);
            this.writer.WriteLine(result);

            if (result.StartsWith(Constants.SystemShutdown))
            {
                isRunning = false;
            }
        }
    }
Example #10
0
    public void Run()
    {
        while (true)
        {
            string input = this.reader.ReadLine().Trim();

            List <string> args = input.Split().ToList();

            string result = commandInterpreter.ProcessCommand(args);

            this.writer.WriteLine(result);

            if (input == ShutdownCommand)
            {
                Environment.Exit(0);
            }
        }
    }
Example #11
0
    public void Run()
    {
        while (true)
        {
            var input = reader.ReadLine();

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

            string result = commandInterpreter.ProcessCommand(data);

            writer.WriteLine(result);

            if (input.Equals(ShutdownCommand, StringComparison.OrdinalIgnoreCase))
            {
                break;
            }
        }
    }
Example #12
0
 public void Run()
 {
     while (true)
     {
         var    inputArgs = reader.ReadLine().Split();
         string result    = commandInterpreter.ProcessCommand(inputArgs);
         writer.WriteLine(result);
         try
         {
             var command = inputArgs[0];
             if (command == "Shutdown")
             {
                 break;
             }
         }
         catch (System.Exception) { }
     }
 }