@@ -49,56 +49,55 @@ internal static bool ContainsArg(string arg) {
49
49
[ STAThread ]
50
50
static void Main ( string [ ] args )
51
51
{
52
- Console . Beep ( ) ;
53
- Logger . Log ( "Initializing logging." ) ;
54
-
55
52
try {
53
+ Console . Beep ( ) ;
54
+ Logger . Log ( "Initializing logging." ) ;
55
+
56
56
Console . Beep ( ) ;
57
57
Directory . SetCurrentDirectory ( ProgramDirectory ) ;
58
58
Logger . Log ( "Program Directory: " + ProgramDirectory ) ;
59
59
Console . Beep ( ) ;
60
- } catch ( Exception e ) {
61
- Logger . Error ( "Failed to set Program Directory to: " + ProgramDirectory ) ;
62
- Logger . Error ( e . ToString ( ) ) ;
63
- }
64
60
65
- Arguments = args ;
66
- CultureInfo . DefaultThreadCurrentCulture = CultureInfo . InvariantCulture ;
67
- CultureInfo . DefaultThreadCurrentUICulture = CultureInfo . InvariantCulture ;
68
- Thread . CurrentThread . CurrentCulture = CultureInfo . InvariantCulture ;
69
- Thread . CurrentThread . CurrentUICulture = CultureInfo . InvariantCulture ;
70
- Console . Beep ( ) ;
71
-
72
- if ( CheckMutex ( ) ) {
73
- // Don't run program if it's already running, instead we focus the already existing window
74
- NativeMethods . PostMessage ( ( IntPtr ) NativeMethods . HWND_BROADCAST , NativeMethods . WM_FOCUSINST , IntPtr . Zero , IntPtr . Zero ) ;
75
- return ;
76
- }
61
+ Arguments = args ;
62
+ CultureInfo . DefaultThreadCurrentCulture = CultureInfo . InvariantCulture ;
63
+ CultureInfo . DefaultThreadCurrentUICulture = CultureInfo . InvariantCulture ;
64
+ Thread . CurrentThread . CurrentCulture = CultureInfo . InvariantCulture ;
65
+ Thread . CurrentThread . CurrentUICulture = CultureInfo . InvariantCulture ;
66
+ Console . Beep ( ) ;
77
67
78
- if ( ! Directory . Exists ( DataLocation ) ) Directory . CreateDirectory ( DataLocation ) ;
68
+ if ( CheckMutex ( ) ) {
69
+ // Don't run program if it's already running, instead we focus the already existing window
70
+ NativeMethods . PostMessage ( ( IntPtr ) NativeMethods . HWND_BROADCAST , NativeMethods . WM_FOCUSINST , IntPtr . Zero , IntPtr . Zero ) ;
71
+ return ;
72
+ }
79
73
80
- LANG . Initialize ( ) ;
81
- Updater . CheckPostUpdate ( args ) ;
74
+ if ( ! Directory . Exists ( DataLocation ) ) Directory . CreateDirectory ( DataLocation ) ;
82
75
83
- Logger . Log ( "Initializing application rendering." ) ;
84
- ApplicationConfiguration . Initialize ( ) ;
85
- Application . SetCompatibleTextRenderingDefault ( true ) ;
76
+ LANG . Initialize ( ) ;
77
+ Updater . CheckPostUpdate ( args ) ;
86
78
87
- Logger . Log ( "Initializing font." ) ;
88
- InitializeFont ( ) ;
79
+ Logger . Log ( "Initializing application rendering." ) ;
80
+ ApplicationConfiguration . Initialize ( ) ;
81
+ Application . SetCompatibleTextRenderingDefault ( true ) ;
89
82
90
- MainWindow . Started = false ;
83
+ Logger . Log ( "Initializing font." ) ;
84
+ InitializeFont ( ) ;
91
85
92
- if ( ! StartCheckForUpdate ( ) ) {
93
- Application . ApplicationExit += OnApplicationExit ;
86
+ MainWindow . Started = false ;
94
87
95
- Logger . Log ( "Running 'MainWindow'" ) ;
96
- Application . Run ( new MainWindow ( ) ) ;
97
- }
88
+ if ( ! StartCheckForUpdate ( ) ) {
89
+ Application . ApplicationExit += OnApplicationExit ;
90
+
91
+ Logger . Log ( "Running 'MainWindow'" ) ;
92
+ Application . Run ( new MainWindow ( ) ) ;
93
+ }
98
94
99
- // Check when all forms close
100
- Logger . Log ( "All windows are closed..." ) ;
101
- GitHubUpdate . Start ( ) ;
95
+ // Check when all forms close
96
+ Logger . Log ( "All windows are closed..." ) ;
97
+ GitHubUpdate . Start ( ) ;
98
+ } catch ( Exception e ) {
99
+ File . WriteAllText ( Path . Combine ( DataLocation , "output.error" ) , e . ToString ( ) ) ;
100
+ }
102
101
}
103
102
104
103
private static void OnApplicationExit ( object ? sender , EventArgs e ) {
0 commit comments