-
Notifications
You must be signed in to change notification settings - Fork 1
/
Program.cs
46 lines (40 loc) · 1.39 KB
/
Program.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading;
using System.Xml;
using log4net;
using log4net.Config;
namespace AnimateSpriteSheetSlicer
{
class Program
{
private static readonly ILog Log = LogManager.GetLogger("ConsoleSlicer");
public static void Main(params string[] args) {
Thread.CurrentThread.CurrentUICulture = CultureInfo.InvariantCulture;
Console.OutputEncoding = Encoding.Unicode;
#if !DEBUG
AppDomain.CurrentDomain.UnhandledException += UnhandledExceptionTrapper;
#endif
SetupLog4Net();
ConsoleSlicer.Run(args);
}
private static void UnhandledExceptionTrapper(object sender, UnhandledExceptionEventArgs e) {
Log.Fatal(
"Fatal error:" + Environment.NewLine +
((Exception) e.ExceptionObject) + Environment.NewLine +
((Exception) e.ExceptionObject).InnerException
);
Thread.Sleep(3000);
Environment.Exit(1);
}
private static void SetupLog4Net() {
XmlDocument objDocument = new XmlDocument();
objDocument.LoadXml(Resources.log4netConfiguration);
XmlElement objElement = objDocument.DocumentElement;
XmlConfigurator.Configure(objElement);
}
}
}