コード例 #1
0
        protected string stExec(IPM pm)
        {
            if (!pm.It(LevelType.Property, "exec") || !pm.IsRight(LevelType.RightOperandColon))
            {
                throw new IncorrectNodeException(pm);
            }

            string cmd = pm.FirstLevel.Data.Trim();

            if (String.IsNullOrWhiteSpace(cmd))
            {
                throw new InvalidArgumentException("The command cannot be empty.");
            }
            Log.Debug("Execute command `{0}`", cmd);

            dteo.exec(new string[] { cmd }, false);
            return(Value.Empty);
        }
コード例 #2
0
        private void btnExecute_Click(object sender, EventArgs e)
        {
            richTextBoxExecuted.Text = String.Empty;

            var hlog = new EventHandler <Logger.MessageArgs>(delegate(object _sender, Logger.MessageArgs _e) {
                richTextBoxExecuted.Text += _e.Message;
            });

            lock (_lock)
            {
                Log._.Received -= hlog;
                Log._.Received += hlog;

                try {
                    _dteo.exec(richTextBoxCommand.Text.Split('\n'), false);
                }
                catch (Exception ex) {
                    richTextBoxExecuted.Text += ex.Message;
                }
                Log._.Received -= hlog;
            }
        }