-
Notifications
You must be signed in to change notification settings - Fork 0
/
Program.cs
48 lines (41 loc) · 1.24 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
47
48
using System;
using System.Diagnostics;
using System.Reflection;
using System.Threading;
namespace HomeQuest
{
public class Program
{
public static bool Debug { get; set; }
static void Main(string[] args)
{
Console.WriteLine(@"Home Builder v{0} for Quest", Assembly.GetExecutingAssembly().GetName().Version.ToString(2));
Console.WriteLine();
if (args.Length == 1 && DebugRequired(args[0]))
Debug = true;
var app = new Application();
try
{
app.Run();
Console.WriteLine(@"Success.");
}
catch (Exception e)
{
Console.Error.WriteLine(@"Failed with error: {0}", e.Message);
if (Debug)
Console.WriteLine(e.StackTrace);
}
finally
{
app.Reset();
}
Console.WriteLine();
Console.WriteLine(@"The application will now close.");
Thread.Sleep(2500);
}
private static bool DebugRequired(string param)
{
return param == "-d" || param == "--debug" || param == "/D" || param == "/d";
}
}
}