Exemplo n.º 1
0
        public void Run()
        {
            CommandManager commandManager = CommandManager.getManager();

            while (true)
            {
                string newLine = System.Console.ReadLine();
                if (string.IsNullOrEmpty(newLine.Trim()))
                {
                    continue;
                }

                string[] commandArgs  = CommandUtil.tokenizerArgs(newLine);
                string   commandName  = commandArgs[0];
                string[] commandArgs2 = null;
                if (commandArgs.Length > 1)
                {
                    List <string> paramsL = new List <string>();
                    for (int i = 1; i < commandArgs.Length; i++)
                    {
                        paramsL.Add(commandArgs[i]);
                    }
                    commandArgs2 = paramsL.ToArray();
                }

                ICommand command = commandManager.GetCommand(commandName);
                command.execute(commandArgs2);
            }
        }