Exemple #1
0
 private void Sender_OutputReceived(object sender, OutputReceivedEventArgs e)
 {
     if (e.IsError)
     {
         AppendError(e.Text);
     }
     else
     {
         AppendOut(e.Text);
     }
 }
Exemple #2
0
        /// <summary>
        /// 触发OutputReceived事件
        /// </summary>
        /// <param name="e"></param>
        private void OnOutputReceived(OutputReceivedEventArgs e)
        {
            if (e.Text == null || e.Text == "")
            {
                return;
            }
            var m = Regex.Match(e.Text, @"^___ec(?<code>-?\d+)$");

            if (Regex.IsMatch(e.Text, @"^.+;\u0020echo\u0020___ec\$\?$"))
            {
                return;
            }
            if (m.Success)
            {
                builder.ExitCode = Convert.ToInt32(m.Result("${code}"));
                return;
            }
            if (_isEnableRead)
            {
                builder.AppendOut(e.Text);
            }
            OutputReceived?.Invoke(this, e);
        }