/[MorrowindCustomClothingSlotCreator]/trunk/libTES3FileFormat/ConsoleLogger.cs
ViewVC logotype

Annotation of /trunk/libTES3FileFormat/ConsoleLogger.cs

Parent Directory Parent Directory | Revision Log Revision Log


Revision 8 - (hide annotations) (download)
Fri Jul 29 11:56:58 2011 UTC (8 years, 11 months ago) by william
File size: 1675 byte(s)
*** add support for displaying log data in a usercontrol (and not just in VS Debug console)

1 william 4 using System;
2     using System.Collections.Generic;
3     using System.Linq;
4     using System.Text;
5 william 8 using System.Windows.Forms;
6 william 4
7     namespace libTES3FileFormat
8     {
9 william 8 public interface IConsoleLoger
10 william 4 {
11 william 8 ConsoleLog Log { get; }
12     }
13     public interface IConsoleLog
14     {
15     void Write(string message);
16     void WriteLine(string message);
17     void WriteLine();
18     }
19     public class ConsoleLog : IConsoleLog
20     {
21     //public static void Newline() { LogMessage("", true); }
22     //public static void LogMessage(string message) { LogMessage(message, false); }
23     //public static void LogMessage(string message, bool OnNewLine) { if (OnNewLine) { Console.Write(System.Environment.NewLine); } Console.Write(message); }
24     private Control LogControl = null;
25     public ConsoleLog()
26 william 4 {
27 william 8 this.LogControl = null;
28 william 4 }
29 william 8 public ConsoleLog(Control LogControl)
30 william 4 {
31 william 8 this.LogControl = LogControl;
32     }
33    
34     #region IConsoleLog Members
35    
36     public void Write(string message)
37     {
38 william 4 Console.Write(message);
39 william 8 if (this.LogControl != null)
40     {
41     this.LogControl.Text = this.LogControl.Text + message;
42     }
43    
44 william 4 }
45 william 8 public void WriteLine() { this.WriteLine(""); }
46     public void WriteLine(string message)
47     {
48     Console.WriteLine(message);
49     if (this.LogControl != null)
50     {
51     this.LogControl.Text = this.LogControl.Text + System.Environment.NewLine + message;
52     }
53     }
54    
55     #endregion
56 william 4 }
57     }

  ViewVC Help
Powered by ViewVC 1.1.22