Example #1
0
 private static void ExecuteMain(string[] args)
 {
     Environment.ExitCode = EXIT_SUCCESS;
     try
     {
         CommandLineOption cmd = new CommandLineOption(args);
         if (cmd.HasHelpSwitch())
         {
             Console.WriteLine(CommandLineOption.GetHelpMessage());
             System.Environment.Exit(EXIT_HELP);
         }
         CsvDivConfig     config = cmd.CreateConfig();
         ValidationResult valid  = config.Valid();
         if (valid == ValidationResult.Success)
         {
             ConsoleExecutor.Execute(config);
         }
         else
         {
             Console.WriteLine(CommandLineOption.GetHelpMessage());
             Console.WriteLine(valid.ErrorMessage);
             System.Environment.Exit(EXIT_ERROR);
         }
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.Message);
         Environment.ExitCode = EXIT_ERROR;
     }
 }
Example #2
0
        public Program()
        {
            _logger  = new ConsoleLogger();
            _conExec = new ConsoleExecutor(_logger);

            _conExec.AddCommand("watch", InitFileWatch, strings => strings.Count() != 2,
                                "Watches the input directory for file changes.");

            _conExec.AddCommand("build", ExecAssetsBuild, strings => strings.Count() >= 2,
                                "Builds the assets in the input directory and copies the artifacts to the output directory.");

            _conExec.AddCommand("build-file", ExecAssetBuild, strings => strings.Count() >= 2,
                                "Builds the asset in the input file and copies the output to the output file");

            new[] { "h", "help" }.ToList()
            .ForEach(commandString => _conExec.AddCommand(commandString,
                                                          (logger, args) => logger.Success(_conExec.CommandDescriptions.Aggregate((acc, item) => acc + string.Format("{0}\n", item)))));
        }
Example #3
0
        private static void DebuggerThread()
        {
            //
            // Wait for the display to be ready.
            //
            _console.WaitForSync();

            ConsoleExecutor debuggerPrompt = new ConsoleExecutor(_imlacSystem);

            if (_startupArgs.Length > 0)
            {
                //
                // Assume arg 0 is a script file to be executed.
                //
                Console.WriteLine("Executing startup script '{0}'", _startupArgs[0]);

                try
                {
                    _state = debuggerPrompt.ExecuteScript(_imlacSystem, _startupArgs[0]);
                }
                catch (Exception e)
                {
                    Console.WriteLine("Error parsing script: {0}", e.Message);
                }
            }

            while (_state != SystemExecutionState.Quit)
            {
                try
                {
                    switch (_state)
                    {
                    case SystemExecutionState.Halted:
                    case SystemExecutionState.Debugging:
                        _state = debuggerPrompt.Prompt(_imlacSystem);
                        break;

                    case SystemExecutionState.SingleStep:
                        _imlacSystem.SingleStep();
                        _imlacSystem.Display.RenderCurrent(false);
                        _state = SystemExecutionState.Debugging;
                        break;

                    case SystemExecutionState.SingleFrame:
                        _imlacSystem.SingleStep();

                        if (_imlacSystem.DisplayProcessor.FrameLatch)
                        {
                            Console.WriteLine("Frame completed.");
                            _state = SystemExecutionState.Debugging;
                        }
                        break;

                    case SystemExecutionState.UntilDisplayStart:
                        _imlacSystem.SingleStep();

                        if (_imlacSystem.DisplayProcessor.State == ProcessorState.Running)
                        {
                            Console.WriteLine("Display started.");
                            _state = SystemExecutionState.Debugging;
                        }
                        break;

                    case SystemExecutionState.Running:
                        _imlacSystem.SingleStep();

                        if (_imlacSystem.Processor.State == ProcessorState.Halted)
                        {
                            Console.WriteLine("Main processor halted at {0}", Helpers.ToOctal(_imlacSystem.Processor.PC));
                            _state = SystemExecutionState.Debugging;
                        }
                        else if (_imlacSystem.Processor.State == ProcessorState.BreakpointHalt)
                        {
                            Console.WriteLine(
                                "Breakpoint hit: {0} at address {1}",
                                BreakpointManager.GetBreakpoint(_imlacSystem.Processor.BreakpointAddress),
                                Helpers.ToOctal(_imlacSystem.Processor.BreakpointAddress));
                            _state = SystemExecutionState.Debugging;
                        }
                        break;
                    }
                }
                catch (Exception e)
                {
                    if (!(e is System.Threading.ThreadAbortException))
                    {
                        Console.WriteLine("Internal error during execution: {0}", e.Message);
                        _state = SystemExecutionState.Debugging;
                    }
                }
            }

            // We are exiting, shut things down.
            //
            _imlacSystem.Shutdown();
        }
    public void OnEndEdit(string str)
    {
        ConsoleExecutor consoleExecutor = (ConsoleExecutor)gameObject.GetComponent("ConsoleExecutor");

        consoleExecutor.execute(str);
    }
Example #5
0
 private void RunButtonClick(object sender, System.EventArgs e)
 {
     LogTextBox.Text = string.Empty;
     var planResult = new ConsoleExecutor().ExecuteDataPlan(CreateOptionsFromForm(),new TextAreaLogger(LogTextBox),_dataPlan);
     MessageBox.Show(planResult == 0 ? "Completed Action Successfully." : "Action failed, read log for details.");
 }