示例#1
0
        public IProcessAsyncOperation Execute(ExecutionCommand command, IConsole console)
        {
            var    cmd          = (MonoBrickExecutionCommand)command;
            string EV3IPAddress = UserSettings.Instance.IPAddress;
            bool   EV3Verbose   = UserSettings.Instance.Verbose;

            var proc = MonoBrickUtility.ExecuteCommand(EV3IPAddress, cmd, null, console, EV3Verbose);

            proc.Execute();
            return(proc);
        }
        void StartProcess(MonoBrickSoftDebuggerStartInfo dsi)
        {
            SoftDebuggerListenArgs args = (SoftDebuggerListenArgs)dsi.StartArgs;

            string EV3IPAddress = UserSettings.Instance.IPAddress;
            string debugOptions = string.Format("transport=dt_socket,address=0.0.0.0:{0},server=y", args.DebugPort);
            bool   EV3Verbose   = UserSettings.Instance.Verbose;

            process = MonoBrickUtility.ExecuteCommand(EV3IPAddress, dsi.ExecutionCommand, debugOptions, dsi.ExecutionCommand.Console, EV3Verbose);
            process.Execute();
            process.WaitForExecuted();
        }
        public IProcessAsyncOperation Execute(ExecutionCommand command, IConsole console)
        {
            var cmd = command as MonoBrickExecutionCommand;

            cmd.AOT = AOT;

            string EV3IPAddress = UserSettings.Instance.IPAddress;
            bool   EV3Verbose   = UserSettings.Instance.Verbose;

            console.Log.WriteLine(cmd.AOT ? "Running on brick in AOT mode ..." : "Running on brick ...");

            var proc = MonoBrickUtility.ExecuteCommand(EV3IPAddress, cmd, null, EV3Verbose);

            proc.Execute();
            return(proc);
        }
示例#4
0
        protected override void OnExecute(IProgressMonitor monitor, ExecutionContext context, ConfigurationSelector configSel)
        {
            var conf = (MonoBrickProjectConfiguration)GetConfiguration(configSel);
            var cmd  = (MonoBrickExecutionCommand)CreateExecutionCommand(configSel, conf);

            bool debugExecution = !(context.ExecutionHandler is MonoBrickExecutionHandler);

            var runtime = conf.TargetRuntime;

            if (runtime.RuntimeId != "Mono" && debugExecution)
            {
                monitor.ReportError("You must use the Mono runtime for debugging!", null);
                return;
            }

            using (var opMon = new AggregatedOperationMonitor(monitor))
            {
                IConsole console = null;

                try
                {
                    console = conf.ExternalConsole
                                                ? context.ExternalConsoleFactory.CreateConsole(!conf.PauseConsoleOutput)
                                                : context.ConsoleFactory.CreateConsole(!conf.PauseConsoleOutput);

                    cmd.Console = console;

                    if (!MonoBrickUtility.GetEV3Configuration(console))
                    {
                        string configError = "Invalid EV3 configuration. Check Preferences->MonoBrick for correct settings!";

                        console.Log.WriteLine(configError);
                        monitor.ReportError(configError, null);
                        return;
                    }

                    console.Log.WriteLine("Upload to brick...");

                    string EV3IPAddress = UserSettings.Instance.IPAddress;

                    var uploadOp = MonoBrickUtility.Upload(EV3IPAddress, cmd);
                    opMon.AddOperation(uploadOp);

                    uploadOp.WaitForCompleted();

                    if (!uploadOp.Success)
                    {
                        console.Log.WriteLine(uploadOp.ErrorMessage);
                        monitor.ReportError(uploadOp.ErrorMessage, null);
                        return;
                    }

                    console.Log.WriteLine("Running on brick...");

                    var ex = context.ExecutionHandler.Execute(cmd, console);
                    opMon.AddOperation(ex);
                    ex.WaitForCompleted();

                    console.Log.WriteLine("");
                    console.Log.WriteLine("Finished!");
                }
                finally
                {
                    if (console != null)
                    {
                        console.Dispose();
                    }
                }
            }
        }