//Quote Test
Quote:
This is a random quote.Quote: Original post by KGodwin
I've decided to move my blog/journal here since I'm feeling like I should get back in the habit. =) So time to test the CSS
//Quote TestQuote:
This is a random quote.
//Code Test
*** Source Snippet Removed ***
//Code Test
using System;using System.Collections.Generic;using System.ComponentModel;using System.Threading;using System.Data;using System.Drawing;using System.Text;using System.Windows.Forms;using System.Diagnostics;using System.IO;namespace EnhancedConsole{ public partial class frmMain : Form { delegate void SetTextCallback(object sender, DataReceivedEventArgs e);// Random Comment Test public frmMain() { InitializeComponent(); this.lstConsoleDisplay.Height = this.Height; this.lstConsoleDisplay.Width = this.Width; this.Resize += new EventHandler(frmMain_Resize); this.lstConsoleDisplay.Columns.Add("Console Output", this.Width); } void frmMain_Resize(object sender, EventArgs e) { this.lstConsoleDisplay.Height = this.Height; this.lstConsoleDisplay.Width = this.Width; } private void Form1_Load(object sender, EventArgs e) { ProcessStartInfo proc = new ProcessStartInfo(); proc.FileName = @"ping.exe"; proc.RedirectStandardInput = false; proc.RedirectStandardOutput = true; proc.Arguments = ""; proc.CreateNoWindow = true; proc.UseShellExecute = false; p = Process.Start(proc); p.OutputDataReceived += new DataReceivedEventHandler(p_OutputDataReceived); p.BeginOutputReadLine(); } void p_OutputDataReceived(object sender, DataReceivedEventArgs e) { try { if (this.lstConsoleDisplay.InvokeRequired) { SetTextCallback STC = new SetTextCallback(p_OutputDataReceived); this.Invoke(STC, new object[] { sender, e }); } else { if (e.Data.ToString() != "") { lstConsoleDisplay.Items.Add(e.Data.ToString()); // create a writer and open the file TextWriter tw = new StreamWriter("console.log", true); // write a line of text to the file tw.Write("["+DateTime.Now+"]"); if(e.Data.ToString().Contains("Exception")) { lstConsoleDisplay.Items[ lstConsoleDisplay.Items.Count - 1].ForeColor = Color.Red; } else if (e.Data.ToString().Contains("Failed")) { lstConsoleDisplay.Items[ lstConsoleDisplay.Items.Count - 1].ForeColor = Color.Red; } else if (e.Data.ToString().Contains("failed")) { lstConsoleDisplay.Items[ lstConsoleDisplay.Items.Count - 1].ForeColor = Color.Red; } if (lstConsoleDisplay.Items[ lstConsoleDisplay.Items.Count - 1 ].ForeColor.ToKnownColor().ToString() != "0") { tw.Write("(" + lstConsoleDisplay.Items[ lstConsoleDisplay.Items.Count - 1 ].ForeColor.ToKnownColor().ToString() + ")"); int i = lstConsoleDisplay.Items[ lstConsoleDisplay.Items.Count - 1 ].ForeColor.ToKnownColor().ToString().Length; while (i < 6) { tw.Write(" "); i++; } } else { tw.Write(" "); } tw.WriteLine(e.Data.ToString()); // close the stream tw.Close(); } } } catch (NullReferenceException E) { lstConsoleDisplay.Items.Add("[Console Application has been Terminated.]"); lstConsoleDisplay.Items[ lstConsoleDisplay.Items.Count - 1].ForeColor = Color.Red; } } }}