Revision 049333d2 trunk/NetSparkle/NetSparkleMainWindows.cs
b/trunk/NetSparkle/NetSparkleMainWindows.cs | ||
---|---|---|
4 | 4 |
using System.Data; |
5 | 5 |
using System.Drawing; |
6 | 6 |
using System.Linq; |
7 |
using System.Reflection; |
|
7 | 8 |
using System.Text; |
8 | 9 |
using System.Windows.Forms; |
9 | 10 |
using System.IO; |
11 |
using log4net; |
|
10 | 12 |
|
11 | 13 |
namespace AppLimit.NetSparkle |
12 | 14 |
{ |
13 | 15 |
public partial class NetSparkleMainWindows : Form, IDisposable |
14 | 16 |
{ |
15 |
private StreamWriter sw = null;
|
|
17 |
private static readonly ILog Log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
|
16 | 18 |
|
17 | 19 |
public NetSparkleMainWindows() |
18 | 20 |
{ |
19 | 21 |
// init ui |
20 | 22 |
InitializeComponent(); |
21 | 23 |
|
22 |
// init logfile |
|
23 |
sw = File.CreateText(Path.Combine(Environment.ExpandEnvironmentVariables("%temp%"), "NetSparkle.log")); |
|
24 | 24 |
} |
25 | 25 |
|
26 | 26 |
public void Report(String message) |
... | ... | |
45 | 45 |
{ |
46 | 46 |
try |
47 | 47 |
{ |
48 |
// write |
|
49 |
sw.WriteLine(msg); |
|
50 |
|
|
51 |
// flush |
|
52 |
sw.Flush(); |
|
48 |
Log.Info(msg); |
|
53 | 49 |
} catch(Exception) |
54 | 50 |
{ |
55 | 51 |
|
... | ... | |
60 | 56 |
|
61 | 57 |
void IDisposable.Dispose() |
62 | 58 |
{ |
63 |
// flush again |
|
64 |
sw.Flush(); |
|
65 |
|
|
66 |
// close the stream |
|
67 |
sw.Dispose(); |
|
68 | 59 |
|
69 | 60 |
// close the base |
70 | 61 |
base.Dispose(); |
Also available in: Unified diff