Exemple #1
0
        public ConsoleExecutor(params object[] commandObjects)
        {
            List <object> commandList = new List <object>(commandObjects);

            BuildCommandTree(commandList);

            _consolePrompt = new DebuggerPrompt(_commandRoot);
        }
Exemple #2
0
        /// <summary>
        /// The CLI thread
        /// </summary>
        private void RunCliThread()
        {
            ControlCommands controlCommands = new ControlCommands(_system, _controller);
            CommandExecutor executor        = new CommandExecutor(this, controlCommands);
            DebuggerPrompt  prompt          = new DebuggerPrompt(executor.CommandTreeRoot);

            CommandResult state = CommandResult.Normal;

            while (state != CommandResult.Quit &&
                   state != CommandResult.QuitNoSave)
            {
                state = CommandResult.Normal;
                try
                {
                    // Get the command string from the prompt.
                    string command = prompt.Prompt().Trim();

                    if (command != String.Empty)
                    {
                        state = executor.ExecuteCommand(command);
                    }
                }
                catch (Exception e)
                {
                    Console.WriteLine(e.Message);
                }
            }

            //
            // Ensure the emulator is stopped.
            //
            _controller.StopExecution();

            //
            // Commit disks if asked to do so.
            //
            _commitDisksAtShutdown = (state == CommandResult.Quit);

            //
            // Ensure the main window is closed.
            //
            _mainWindow.Close();
        }