Skip to content

Commit 23dfb8d

Browse files
committed
add architecture compatibility check on start
1 parent 290bb26 commit 23dfb8d

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

OpenHardwareMonitor/Program.cs

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
using System;
2-
using System.Diagnostics;
3-
using System.Linq;
42
using System.Windows.Forms;
53
using OpenHardwareMonitor.UI;
64

@@ -13,13 +11,13 @@ public static void Main()
1311
{
1412
Crasher.Listen();
1513

16-
if (!OperatingSystemHelper.IsCompatible(false, out var errorMessage, out var fixAction))
14+
if (!OperatingSystemHelper.IsCompatible(false, out string errorMessage, out var fixAction))
1715
{
1816
if (fixAction != null)
1917
{
2018
if (MessageBox.Show(errorMessage, Updater.ApplicationName, MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes)
2119
{
22-
fixAction?.Invoke();
20+
fixAction();
2321
}
2422
}
2523
else
@@ -37,6 +35,13 @@ public static void Main()
3735
return;
3836
}
3937

38+
if (Environment.Is64BitOperatingSystem != Environment.Is64BitProcess) {
39+
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) {
40+
Updater.VisitAppSite("releases");
41+
}
42+
Environment.Exit(0);
43+
}
44+
4045
Application.EnableVisualStyles();
4146
Application.SetCompatibleTextRenderingDefault(false);
4247
using (MainForm form = new MainForm())

0 commit comments

Comments
 (0)