/[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/10 14:11:08	113
+++ trunk/RomCheater.Logging/LogWriter.cs	2012/05/28 04:10:38	155
@@ -137,10 +137,10 @@
             writer.Close();
             //string text = value.Replace(System.Environment.NewLine,"");
             string text = value.Replace(System.Environment.NewLine, Log.NewLine);
-            if (text.StartsWith(Log.NewLine))
-            {
-                text = text.Remove(0, Log.NewLine.Length);
-            }
+            //if (text.StartsWith(Log.NewLine))
+            //{
+            //    text = text.Remove(0, Log.NewLine.Length);
+            //}
             sw.Write(text);
             Application.DoEvents();
         }
@@ -193,23 +193,7 @@
             public LogStream() : this(null) { }
             public LogStream(LogWriter text) : base() { _text_writer = text; this.NewLine = "\n"; }
             private LogWriter _text_writer;
-            private void _write(string message)
-            {
-                if (_text_writer == null) return;
-
-                if (message.EndsWith(this.NewLine))
-                {
-                    strMessage.Append(System.Environment.NewLine);
-                    //_text_writer.SetLogText(string.Format("{0}", strMessage.ToString()));
-                    while (_text_writer.logupdater.IsBusy)
-                    {
-                        Application.DoEvents();
-                    }
-                    _text_writer.logupdater.RunWorkerAsync((string.Format("{0}", strMessage.ToString())));
-                    strMessage = new StringBuilder();
-                }
-                strMessage.Append(message);
-            }
+            private void _write(string message) { if (_text_writer == null) return; _text_writer.SetLogText(string.Format("{0}", message)); }
             #region Overriden Methods
             public override Encoding Encoding { get { return Encoding.UTF8; } }
             public override void Write(char value) { base.Write(value); _write(value.ToString()); if (!_text_writer.BeginUpdate) _text_writer.EndLogUpdate(); }
@@ -218,12 +202,12 @@
         #endregion
 
         private void autoscroll_timer_Tick(object sender, EventArgs e)
-        {
+        {           
             try
             {
                 if (this.DesignMode) { return; }
-                //txtLog.ScrollToEnd();
-                //txtLog.SelectionStart = txtLog.Text.Length-100;
+                ////txtLog.ScrollToEnd();
+                //txtLog.SelectionStart = txtLog.Text.Length - 100;
                 //txtLog.ScrollToCaret();
                 //txtLog.Refresh();
 
@@ -238,7 +222,7 @@
                 string line = "";
                 while ((line = sr.ReadLine()) != null)
                 {
-                    position += (line.Length);
+                    position += (line.Length * 2);
                     last_line_position = (line.Length * 2);
                     //if (line.EndsWith("/n"))
                     //{
@@ -246,22 +230,12 @@
                     //}
                     //logger.VerboseDebug.WriteLine("current line: {0}", line);
                 }
-                txtLog.SelectionStart = position;
+                txtLog.SelectionStart = txtLog.Text.Length * 2;
                 txtLog.ScrollToCaret();
                 txtLog.Refresh();
                 //autoscroll_timer.Enabled = false;
             }
             catch { }
-        }
-
-        private void logupdater_DoWork(object sender, DoWorkEventArgs e)
-        {
-            string message = e.Argument.ToString();
-            SetLogText(string.Format("{0}", message)); 
-        }
-
-        private void logupdater_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
-        {
 
         }
     }

 

  ViewVC Help
Powered by ViewVC 1.1.22