add os check and detect win11
This commit is contained in:
parent
d7e2b8a294
commit
d408b51b0e
5 changed files with 36 additions and 23 deletions
|
@ -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;
|
||||
|
|
9
EnvyUpdate/Properties/Resources.Designer.cs
generated
9
EnvyUpdate/Properties/Resources.Designer.cs
generated
|
@ -384,6 +384,15 @@ namespace EnvyUpdate.Properties {
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Your operating system is not supported by EnvyUpdate. Windows 10 or later is required..
|
||||
/// </summary>
|
||||
public static string unsupported_os {
|
||||
get {
|
||||
return ResourceManager.GetString("unsupported_os", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to A new driver update is available for your graphics card..
|
||||
/// </summary>
|
||||
|
|
|
@ -225,6 +225,9 @@
|
|||
<data name="uninstall_legacy_message" xml:space="preserve">
|
||||
<value>Aufgrund eines Programmfehlers musste EnvyUpdate deinstalliert werden. Bitte laden Sie die neuste Version erneut manuell herunter.</value>
|
||||
</data>
|
||||
<data name="unsupported_os" xml:space="preserve">
|
||||
<value>Diese Betriebssystemversion wird von EnvyUpdate nicht unterstützt. Windows 10 oder neuer wird vorausgesetzt.</value>
|
||||
</data>
|
||||
<data name="update_popup_message" xml:space="preserve">
|
||||
<value>Eine neue Treiberversion ist verfügbar.</value>
|
||||
</data>
|
||||
|
|
|
@ -225,6 +225,9 @@
|
|||
<data name="uninstall_legacy_message" xml:space="preserve">
|
||||
<value>EnvyUpdate must be uninstalled because of an application bug. Please download the most recent version again.</value>
|
||||
</data>
|
||||
<data name="unsupported_os" xml:space="preserve">
|
||||
<value>Your operating system is not supported by EnvyUpdate. Windows 10 or later is required.</value>
|
||||
</data>
|
||||
<data name="update_popup_message" xml:space="preserve">
|
||||
<value>A new driver update is available for your graphics card.</value>
|
||||
</data>
|
||||
|
|
|
@ -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
|
||||
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;
|
||||
}
|
||||
|
||||
//Simply increment the ID by 1 if OS is 64bit.
|
||||
// This means we are running Windows 10.
|
||||
if (Environment.Is64BitOperatingSystem)
|
||||
value++;
|
||||
value = 56;
|
||||
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.
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
|
Reference in a new issue