/// <summary> /// Handles the events of StdErrReceived and StdOutReceived. /// </summary> /// <remarks> /// If stderr were handled in a separate function, it could possibly /// be displayed in red in the richText box, but that is beyond /// the scope of this demo. /// </remarks> private void writeStreamInfo(object sender, DataReceivedEventArgs e) { Font fbold = new Font("Lucida Console", 8); richTextBox1.Font = fbold; if (e.Text.Contains("REJECTED")) { this.richTextBox1.SelectionColor = Color.Red; this.richTextBox1.SelectedText = e.Text + Environment.NewLine; } else if (e.Text.Contains("ACCEPTED")) { this.richTextBox1.SelectionColor = Color.Green; this.richTextBox1.SelectedText = e.Text + Environment.NewLine; } else if (e.Text.Contains("/api/?method=resolve")) { this.richTextBox1.SelectionColor = Color.Blue; this.richTextBox1.SelectedText = e.Text + Environment.NewLine; notifyIcon1.ShowBalloonTip(1000, "Playdar search", "Search initiated!", ToolTipIcon.Info); } else if (e.Text.Contains("HTTP GET")) { this.richTextBox1.SelectionColor = Color.Gray; this.richTextBox1.SelectedText = e.Text + Environment.NewLine; } else if (e.Text.StartsWith("INFO ")) { this.richTextBox1.SelectionColor = Color.IndianRed; this.richTextBox1.SelectedText = e.Text.ToString().Substring(5) + Environment.NewLine; notifyIcon1.ShowBalloonTip(1000, "Playdar Info", e.Text.ToString().Substring(5), ToolTipIcon.Info); } else if (e.Text.StartsWith("RESOLVER: dispatch")) { this.richTextBox1.SelectionColor = Color.RoyalBlue; this.richTextBox1.SelectedText = e.Text + Environment.NewLine; NumSearches++; lblSearches.Text = NumSearches.ToString(); } else { this.richTextBox1.AppendText(e.Text + Environment.NewLine); } }
private void writeStreamInfo(object sender, DataReceivedEventArgs e) { this.richTextBox1.AppendText(e.Text + Environment.NewLine); }