Converted NetSparkle project to .NET 4 Client Profile
[pithos-ms-client] / trunk / NetSparkle / NetSparkleMainWindows.cs
index d8c2a57..92a3a09 100644 (file)
@@ -4,23 +4,23 @@ using System.ComponentModel;
 using System.Data;
 using System.Drawing;
 using System.Linq;
+using System.Reflection;
 using System.Text;
 using System.Windows.Forms;
 using System.IO;
+using log4net;
 
 namespace AppLimit.NetSparkle
 {
     public partial class NetSparkleMainWindows : Form, IDisposable
     {
-        private StreamWriter sw = null;
+        private static readonly ILog Log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
 
         public NetSparkleMainWindows()
         {
             // init ui
             InitializeComponent();
 
-            // init logfile
-            sw = File.CreateText(Path.Combine(Environment.ExpandEnvironmentVariables("%temp%"), "NetSparkle.log"));
         }
 
         public void Report(String message)
@@ -45,11 +45,7 @@ namespace AppLimit.NetSparkle
         {
             try
             {
-                // write 
-                sw.WriteLine(msg);
-
-                // flush
-                sw.Flush();
+                Log.Info(msg);
             } catch(Exception)
             {
 
@@ -60,11 +56,6 @@ namespace AppLimit.NetSparkle
 
         void IDisposable.Dispose()
         {
-            // flush again
-            sw.Flush();
-
-            // close the stream
-            sw.Dispose();
 
             // close the base
             base.Dispose();