/[RomCheater]/trunk/RomCheater.ScratchPad/ScratchPadDocument.cs
ViewVC logotype

Diff of /trunk/RomCheater.ScratchPad/ScratchPadDocument.cs

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

--- trunk/RomCheater.ScratchPad/ScratchPadDocument.cs	2013/06/21 04:26:36	783
+++ trunk/RomCheater.ScratchPad/ScratchPadDocument.cs	2014/04/15 14:52:10	812
@@ -10,6 +10,7 @@
 using RomCheater.Core;
 using System.IO;
 using RomCheater.Logging;
+using Enterprise.Logging;
 
 namespace RomCheater.ScratchPad
 {
@@ -87,21 +88,21 @@
             }
         }
 
-        public override Font Font
-        {
-            get
-            {
-                return base.Font;
-            }
-            set
-            {
-                base.Font = value;
-                txtEditor.Font = base.Font;
-                mnuItemClose.Font = base.Font;
-                mnuItemOpen.Font = base.Font;
-                mnuItemSave.Font = base.Font;
-            }
-        }
+        //public override Font Font
+        //{
+        //    get
+        //    {
+        //        return base.Font;
+        //    }
+        //    set
+        //    {
+        //        base.Font = new Font(value.FontFamily, value.SizeInPoints);
+        //        txtEditor.Font = base.Font;
+        //        mnuItemClose.Font = base.Font;
+        //        mnuItemOpen.Font = base.Font;
+        //        mnuItemSave.Font = base.Font;
+        //    }
+        //}
 
         private void mnuItemOpen_Click(object sender, EventArgs e)
         {
@@ -160,8 +161,8 @@
             {
                 this.DocumentSaved = false;
                 MessageBox.Show(string.Format("Failed to open: '{0}'", fi.Name), "", MessageBoxButtons.OK, MessageBoxIcon.Error);
-                logger.Error.WriteLine("Failed to open: '{0}'", fi.FullName);
-                logger.Error.WriteLine(ex.ToString());
+                gLog.Error.WriteLine("Failed to open: '{0}'", fi.FullName);
+                gLog.Verbose.Error.WriteLine(ex.ToString());
             }
         }
         private void SaveDocument()
@@ -187,10 +188,19 @@
                         {
                             try
                             {
-                                foreach (var t in txtEditor.Lines)
+                                //foreach (var t in txtEditor.Lines)
+                                //{
+                                //    sw.WriteLine(t);
+                                //}
+                                string line =string.Empty;
+                                using (StringReader sr = new StringReader(txtEditor.Text))
                                 {
-                                    sw.WriteLine(t);
+                                    while ((line = sr.ReadLine()) != null)
+                                    {
+                                        sw.WriteLine(line);
+                                    }
                                 }
+
                                 sw.Flush();
                                 sw.Close();
                                 this.DocumentSaved = true;
@@ -211,8 +221,8 @@
             {
                 this.DocumentSaved = false;
                 MessageBox.Show(string.Format("Failed to save: '{0}'", fi.Name), "", MessageBoxButtons.OK, MessageBoxIcon.Error);
-                logger.Error.WriteLine("Failed to save: '{0}'", fi.FullName);
-                logger.Error.WriteLine(ex.ToString());
+                gLog.Error.WriteLine("Failed to save: '{0}'", fi.FullName);
+                gLog.Verbose.Error.WriteLine(ex.ToString());
             }
         }
 
@@ -242,5 +252,10 @@
                 this.LinkClicked.Invoke(sender, e);
             }
         }
+
+        private void ScratchPadDocument_Load(object sender, EventArgs e)
+        {
+            this.Font = new System.Drawing.Font(this.Font.FontFamily, this.Font.SizeInPoints);
+        }
     }
 }

 

  ViewVC Help
Powered by ViewVC 1.1.22