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

Contents of /trunk/libTES3FileFormat/ConsoleLogger.cs

Parent Directory Parent Directory | Revision Log Revision Log


Revision 8 - (show annotations) (download)
Fri Jul 29 11:56:58 2011 UTC (8 years, 6 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 using System;
2 using System.Collections.Generic;
3 using System.Linq;
4 using System.Text;
5 using System.Windows.Forms;
6
7 namespace libTES3FileFormat
8 {
9 public interface IConsoleLoger
10 {
11 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 {
27 this.LogControl = null;
28 }
29 public ConsoleLog(Control LogControl)
30 {
31 this.LogControl = LogControl;
32 }
33
34 #region IConsoleLog Members
35
36 public void Write(string message)
37 {
38 Console.Write(message);
39 if (this.LogControl != null)
40 {
41 this.LogControl.Text = this.LogControl.Text + message;
42 }
43
44 }
45 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 }
57 }

  ViewVC Help
Powered by ViewVC 1.1.22