public LoggedTextBox(TextBox textBox)
{
string outputDir = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + @"\BenchmarkApplication\";
var df = new DirectoryInfo(outputDir);
if (! df.Exists)
{
df = Directory.CreateDirectory(df.FullName);
}
string fileName = string.Format(df.FullName + "BenchmarkApplication{0}.log", DateTime.Now.ToFileTime());
var logFile = new FileStream(fileName, FileMode.Append, FileAccess.Write, FileShare.None);
this.streamWriter = new StreamWriter(logFile);
this.textBox = textBox;
this.appendText = delegate(string text)
{
textBox.AppendText(text);
textBox.ScrollToEnd();
textBox.Focus();
};
}