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);
|
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
|
// Check if EnvyUpdate is already running
|
||||||
if (Util.IsInstanceOpen("EnvyUpdate"))
|
if (Util.IsInstanceOpen("EnvyUpdate"))
|
||||||
{
|
{
|
||||||
Debug.LogToFile("FATAL Found another instance, terminating.");
|
Debug.LogToFile("FATAL Found another instance, terminating.");
|
||||||
|
|
||||||
|
|
||||||
MessageBox.Show(Properties.Resources.instance_already_running);
|
MessageBox.Show(Properties.Resources.instance_already_running);
|
||||||
Environment.Exit(1);
|
Environment.Exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Delete installed legacy versions
|
// Delete installed legacy versions, required for people upgrading from very old versions.
|
||||||
if (Directory.Exists(GlobalVars.appdata))
|
if (Directory.Exists(GlobalVars.appdata))
|
||||||
{
|
{
|
||||||
Debug.LogToFile("INFO Found old appdata installation, uninstalling.");
|
Debug.LogToFile("INFO Found old appdata installation, uninstalling.");
|
||||||
Util.UninstallAll();
|
Util.UninstallAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Allow for running using a fake graphics card if no nvidia card is present.
|
||||||
if (arguments.Contains("/fake"))
|
if (arguments.Contains("/fake"))
|
||||||
{
|
{
|
||||||
Debug.isFake = true;
|
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>
|
/// <summary>
|
||||||
/// Looks up a localized string similar to A new driver update is available for your graphics card..
|
/// Looks up a localized string similar to A new driver update is available for your graphics card..
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -225,6 +225,9 @@
|
||||||
<data name="uninstall_legacy_message" xml:space="preserve">
|
<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>
|
<value>Aufgrund eines Programmfehlers musste EnvyUpdate deinstalliert werden. Bitte laden Sie die neuste Version erneut manuell herunter.</value>
|
||||||
</data>
|
</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">
|
<data name="update_popup_message" xml:space="preserve">
|
||||||
<value>Eine neue Treiberversion ist verfügbar.</value>
|
<value>Eine neue Treiberversion ist verfügbar.</value>
|
||||||
</data>
|
</data>
|
||||||
|
|
|
@ -225,6 +225,9 @@
|
||||||
<data name="uninstall_legacy_message" xml:space="preserve">
|
<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>
|
<value>EnvyUpdate must be uninstalled because of an application bug. Please download the most recent version again.</value>
|
||||||
</data>
|
</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">
|
<data name="update_popup_message" xml:space="preserve">
|
||||||
<value>A new driver update is available for your graphics card.</value>
|
<value>A new driver update is available for your graphics card.</value>
|
||||||
</data>
|
</data>
|
||||||
|
|
|
@ -296,31 +296,21 @@ namespace EnvyUpdate
|
||||||
private static int GetOSID()
|
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.
|
// 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;
|
int value;
|
||||||
string OS = Environment.OSVersion.Version.Major.ToString() + "." + Environment.OSVersion.Version.Minor.ToString();
|
|
||||||
|
|
||||||
// Here the 32bit values are used. Later, if the OS is 64bit, we'll add 1, since that is how Nvidia does their IDs.
|
if (Environment.OSVersion.Version.Build < 22000)
|
||||||
switch (OS) //TODO until Win10 EOL: Differentiate between Win10 and Win11
|
|
||||||
{
|
{
|
||||||
case "10.0": //Win10 or Win11
|
// This means we are running Windows 10.
|
||||||
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.
|
|
||||||
if (Environment.Is64BitOperatingSystem)
|
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;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
Reference in a new issue