diff --git a/EnvyUpdate/MainWindow.xaml.cs b/EnvyUpdate/MainWindow.xaml.cs index 6efb4fc..f7729a4 100644 --- a/EnvyUpdate/MainWindow.xaml.cs +++ b/EnvyUpdate/MainWindow.xaml.cs @@ -37,23 +37,31 @@ namespace EnvyUpdate Debug.LogToFile("INFO Starting EnvyUpdate, version " + System.Diagnostics.FileVersionInfo.GetVersionInfo(System.Reflection.Assembly.GetExecutingAssembly().Location).FileVersion); + // Check if running on supported Windows version. + if (Environment.OSVersion.Version.Major < 10) + { + Debug.LogToFile("FATAL Unsupported OS version, terminating."); + MessageBox.Show(Properties.Resources.unsupported_os); + Environment.Exit(1); + } + // Check if EnvyUpdate is already running if (Util.IsInstanceOpen("EnvyUpdate")) { Debug.LogToFile("FATAL Found another instance, terminating."); - MessageBox.Show(Properties.Resources.instance_already_running); Environment.Exit(1); } - // Delete installed legacy versions + // Delete installed legacy versions, required for people upgrading from very old versions. if (Directory.Exists(GlobalVars.appdata)) { Debug.LogToFile("INFO Found old appdata installation, uninstalling."); Util.UninstallAll(); } + // Allow for running using a fake graphics card if no nvidia card is present. if (arguments.Contains("/fake")) { Debug.isFake = true; diff --git a/EnvyUpdate/Properties/Resources.Designer.cs b/EnvyUpdate/Properties/Resources.Designer.cs index e0ed7b3..6cac9c1 100644 --- a/EnvyUpdate/Properties/Resources.Designer.cs +++ b/EnvyUpdate/Properties/Resources.Designer.cs @@ -384,6 +384,15 @@ namespace EnvyUpdate.Properties { } } + /// + /// Looks up a localized string similar to Your operating system is not supported by EnvyUpdate. Windows 10 or later is required.. + /// + public static string unsupported_os { + get { + return ResourceManager.GetString("unsupported_os", resourceCulture); + } + } + /// /// Looks up a localized string similar to A new driver update is available for your graphics card.. /// diff --git a/EnvyUpdate/Properties/Resources.de.resx b/EnvyUpdate/Properties/Resources.de.resx index 13bfb43..7758b15 100644 --- a/EnvyUpdate/Properties/Resources.de.resx +++ b/EnvyUpdate/Properties/Resources.de.resx @@ -225,6 +225,9 @@ Aufgrund eines Programmfehlers musste EnvyUpdate deinstalliert werden. Bitte laden Sie die neuste Version erneut manuell herunter. + + Diese Betriebssystemversion wird von EnvyUpdate nicht unterstützt. Windows 10 oder neuer wird vorausgesetzt. + Eine neue Treiberversion ist verfügbar. diff --git a/EnvyUpdate/Properties/Resources.resx b/EnvyUpdate/Properties/Resources.resx index 308ba4e..8667646 100644 --- a/EnvyUpdate/Properties/Resources.resx +++ b/EnvyUpdate/Properties/Resources.resx @@ -225,6 +225,9 @@ EnvyUpdate must be uninstalled because of an application bug. Please download the most recent version again. + + Your operating system is not supported by EnvyUpdate. Windows 10 or later is required. + A new driver update is available for your graphics card. diff --git a/EnvyUpdate/Util.cs b/EnvyUpdate/Util.cs index 937f40e..2b03540 100644 --- a/EnvyUpdate/Util.cs +++ b/EnvyUpdate/Util.cs @@ -296,31 +296,21 @@ namespace EnvyUpdate private static int GetOSID() { // This is faster than making a whole web request and searching through XML. This application only supports 8 possible IDs, so they are hardcoded. - int value = 0; - string OS = Environment.OSVersion.Version.Major.ToString() + "." + Environment.OSVersion.Version.Minor.ToString(); + int value; - // Here the 32bit values are used. Later, if the OS is 64bit, we'll add 1, since that is how Nvidia does their IDs. - switch (OS) //TODO until Win10 EOL: Differentiate between Win10 and Win11 + if (Environment.OSVersion.Version.Build < 22000) { - case "10.0": //Win10 or Win11 + // This means we are running Windows 10. + if (Environment.Is64BitOperatingSystem) value = 56; - break; - case "6.1": //Win7 - value = 18; - break; - case "6.2": //Win8 - value = 27; - break; - case "6.3": //Win8.1 - value = 40; - break; - default: - break; + else + value = 57; + } + else + { + // This must be Windows 11 (for now, until Windows 12 comes along) + value = 135; // No need to check for 64bit, Win11 can not be 32bit. } - - //Simply increment the ID by 1 if OS is 64bit. - if (Environment.Is64BitOperatingSystem) - value++; return value; }