Skip to content

Commit 410c524

Browse files
committed
Crasher fix (autostart in RDP session issue)
1 parent bc9cda9 commit 410c524

File tree

1 file changed

+22
-28
lines changed

1 file changed

+22
-28
lines changed

TrayRAMBooster/Program.cs

Lines changed: 22 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -10,39 +10,33 @@ public static void Main(string[] args) {
1010

1111
Crasher.Listen();
1212

13-
try {
14-
15-
if (!OperatingSystemHelper.IsCompatible(true, out var errorMessage, out var fixAction)) {
16-
if (fixAction != null) {
17-
if (MessageBox.Show(errorMessage, Updater.ApplicationName, MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes) {
18-
fixAction.Invoke();
19-
}
20-
}
21-
else {
22-
MessageBox.Show(errorMessage, Updater.ApplicationName, MessageBoxButtons.OK, MessageBoxIcon.Warning);
13+
if (!OperatingSystemHelper.IsCompatible(true, out var errorMessage, out var fixAction)) {
14+
if (fixAction != null) {
15+
if (MessageBox.Show(errorMessage, Updater.ApplicationName, MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes) {
16+
fixAction.Invoke();
2317
}
24-
Environment.Exit(0);
2518
}
26-
27-
if (WinApiHelper.CheckRunningInstances(true, false)) {
28-
MessageBox.Show($"{Updater.ApplicationName} is already running.", Updater.ApplicationName,
29-
MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
30-
return;
19+
else {
20+
MessageBox.Show(errorMessage, Updater.ApplicationName, MessageBoxButtons.OK, MessageBoxIcon.Warning);
3121
}
32-
33-
// if (Environment.Is64BitOperatingSystem != Environment.Is64BitProcess) {
34-
// if (MessageBox.Show("You are running an application build made for a different OS architecture.\nIt is not compatible!\nWould you like to download correct version?", Updater.ApplicationName, MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes) {
35-
// Updater.VisitAppSite("releases");
36-
// }
37-
// Environment.Exit(0);
38-
// }
39-
40-
var applicationContext = new TrayApplicationContext();
41-
Application.Run(applicationContext);
22+
Environment.Exit(0);
4223
}
43-
catch (Exception) {
44-
//Logger.Instance().Err(ex.Message);
24+
25+
if (WinApiHelper.CheckRunningInstances(true, false)) {
26+
MessageBox.Show($"{Updater.ApplicationName} is already running.", Updater.ApplicationName,
27+
MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
28+
return;
4529
}
30+
31+
// if (Environment.Is64BitOperatingSystem != Environment.Is64BitProcess) {
32+
// if (MessageBox.Show("You are running an application build made for a different OS architecture.\nIt is not compatible!\nWould you like to download correct version?", Updater.ApplicationName, MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes) {
33+
// Updater.VisitAppSite("releases");
34+
// }
35+
// Environment.Exit(0);
36+
// }
37+
38+
var applicationContext = new TrayApplicationContext();
39+
Application.Run(applicationContext);
4640
}
4741
}
4842
}

0 commit comments

Comments
 (0)