Skip to content
This repository was archived by the owner on Sep 11, 2023. It is now read-only.

Commit 9ac5c3d

Browse files
committed
Enable standardwise -safe argument try-catch
This enabled the global try-catch and the global error reporter.
1 parent b0fc8ce commit 9ac5c3d

File tree

1 file changed

+15
-32
lines changed

1 file changed

+15
-32
lines changed

Program.cs

Lines changed: 15 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ public static class Program
2929
[STAThread]
3030
public static void Main(string[] args)
3131
{
32-
bool InSafe = false;
3332
bool mutexReserved;
3433
using (Mutex appMutex = new Mutex(true, "SpeditGlobalMutex", out mutexReserved))
3534
{
@@ -58,10 +57,6 @@ public static void Main(string[] args)
5857
OptionsObject.ReCreateCryptoKey();
5958
MakeRCCKAlert();
6059
}
61-
else if (args[i].ToLowerInvariant() == "-safe")
62-
{
63-
InSafe = true;
64-
}
6560
}
6661
Configs = ConfigLoader.Load();
6762
for (int i = 0; i < Configs.Length; ++i)
@@ -110,41 +105,29 @@ public static void Main(string[] args)
110105
}
111106
#endif
112107
Application app = new Application();
113-
if (InSafe)
114-
{
115-
try
116-
{
117-
#if !DEBUG
118-
if (OptionsObject.Program_CheckForUpdates)
119-
{
120-
UpdateCheck.Check(true);
121-
}
122-
#endif
123-
app.Startup += App_Startup;
124-
app.Run(MainWindow);
125-
OptionsControlIOObject.Save();
126-
}
127-
catch (Exception e)
128-
{
129-
File.WriteAllText("CRASH_" + Environment.TickCount.ToString() + ".txt", BuildExceptionString(e, "SPEDIT MAIN"));
130-
MessageBox.Show("An error occured." + Environment.NewLine + "A crash report was written in the editor-directory.",
131-
"Error",
132-
MessageBoxButton.OK,
133-
MessageBoxImage.Error);
134-
Environment.Exit(Environment.ExitCode);
135-
}
136-
}
137-
else
138-
{
139108
#if !DEBUG
109+
try
110+
{
140111
if (OptionsObject.Program_CheckForUpdates)
141112
{
142113
UpdateCheck.Check(true);
143114
}
144115
#endif
145-
app.Run(MainWindow);
116+
app.Startup += App_Startup;
117+
app.Run(MainWindow);
146118
OptionsControlIOObject.Save();
119+
#if !DEBUG
147120
}
121+
catch (Exception e)
122+
{
123+
File.WriteAllText("CRASH_" + Environment.TickCount.ToString() + ".txt", BuildExceptionString(e, "SPEDIT MAIN"));
124+
MessageBox.Show("An error occured." + Environment.NewLine + "A crash report was written in the editor-directory.",
125+
"Error",
126+
MessageBoxButton.OK,
127+
MessageBoxImage.Error);
128+
Environment.Exit(Environment.ExitCode);
129+
}
130+
#endif
148131
}
149132
else
150133
{

0 commit comments

Comments
 (0)