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

Diff of /trunk/libTES3FileFormat/ConsoleLogger.cs

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

--- trunk/libTES3FileFormat/ConsoleLogger.cs	2011/07/29 09:23:17	4
+++ trunk/libTES3FileFormat/ConsoleLogger.cs	2011/07/29 11:56:58	8
@@ -2,20 +2,56 @@
 using System.Collections.Generic;
 using System.Linq;
 using System.Text;
+using System.Windows.Forms;
 
 namespace libTES3FileFormat
 {
-    internal class ConsoleLogger
+    public interface IConsoleLoger
     {
-        public static void LogMessage(string message)
+        ConsoleLog Log { get; }
+    }
+    public interface IConsoleLog
+    {
+        void Write(string message);
+        void WriteLine(string message);
+        void WriteLine();
+    }
+    public class ConsoleLog : IConsoleLog
+    {
+        //public static void Newline() { LogMessage("", true); }
+        //public static void LogMessage(string message) { LogMessage(message, false); }
+        //public static void LogMessage(string message, bool OnNewLine) { if (OnNewLine) { Console.Write(System.Environment.NewLine); } Console.Write(message); }
+        private Control LogControl = null;
+        public ConsoleLog()
         {
-            LogMessage(message, false);
+            this.LogControl = null;
         }
-        public static void LogMessage(string message, bool OnNewLine)
+        public ConsoleLog(Control LogControl)
+        {
+            this.LogControl = LogControl;
+        }
+
+        #region IConsoleLog Members
+
+        public void Write(string message)
         {
-            if (OnNewLine) { Console.Write(System.Environment.NewLine); }
             Console.Write(message);
-            
+            if (this.LogControl != null)
+            {
+                this.LogControl.Text = this.LogControl.Text + message;
+            }
+          
         }
+        public void WriteLine() { this.WriteLine(""); }
+        public void WriteLine(string message)
+        {
+            Console.WriteLine(message);
+            if (this.LogControl != null)
+            {
+                this.LogControl.Text = this.LogControl.Text + System.Environment.NewLine + message;
+            }
+        }
+
+        #endregion
     }
 }

 

  ViewVC Help
Powered by ViewVC 1.1.22