/[RomCheater]/trunk/RomCheater.Logging/LogWriter.cs
ViewVC logotype

Diff of /trunk/RomCheater.Logging/LogWriter.cs

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

--- trunk/RomCheater.Logging/LogWriter.cs	2012/05/09 08:16:18	18
+++ trunk/RomCheater.Logging/LogWriter.cs	2012/05/09 08:43:52	22
@@ -13,7 +13,7 @@
 {
     public partial class LogWriter : UserControl
     {
-        private const string LOG_FILE = "RomCheater.log";
+        public const string LOG_FILE = "RomCheater.log";
         private static string LOG_PATH = string.Format(@"{0}\{1}", Application.StartupPath, LOG_FILE);
 
         private delegate string OnGetLogText();
@@ -42,11 +42,6 @@
             sw = new StreamWriter(ms);
             sw.AutoFlush = true;
             sr = new StreamReader(ms);
-
-            FileInfo fi = new FileInfo(LOG_PATH);
-            if (fi.Exists)
-                fi.Delete();
-
         }
         private LogStream _Log;
         public LogStream Log { get { return _Log; } private set { _Log = value; } }
@@ -144,7 +139,8 @@
             FileStream fs = new FileStream(LOG_PATH, FileMode.Append, FileAccess.Write, FileShare.ReadWrite);
             StreamWriter writer = new StreamWriter(fs);
             writer.AutoFlush = true;
-            writer.Write(value);
+            if (value == Log.NewLine) { writer.Write(System.Environment.NewLine); }
+            else { writer.Write(value); }
             writer.Close();
             sw.Write(value);
         }
@@ -159,7 +155,12 @@
                 throw new InvalidOperationException("Please use SetLogText(string value)");
             }
         }
-
+        public void CreateNewLog()
+        {
+            FileInfo fi = new FileInfo(LOG_PATH);
+            if (fi.Exists)
+                fi.Delete();
+        }
         public void Clear()
         {
             Clear(false);

 

  ViewVC Help
Powered by ViewVC 1.1.22