From 2e4fa930ff5e1fb89d96c451f24e1e36eee6ec10 Mon Sep 17 00:00:00 2001 From: Jakob Date: Tue, 14 Mar 2023 20:59:44 +0100 Subject: [PATCH] add check for cards not supporting studio drivers --- EnvyUpdate/MainWindow.xaml.cs | 26 ++++++++++++++++++++- EnvyUpdate/Properties/Resources.Designer.cs | 9 +++++++ EnvyUpdate/Properties/Resources.de.resx | 3 +++ EnvyUpdate/Properties/Resources.resx | 3 +++ EnvyUpdate/Util.cs | 7 ++++-- 5 files changed, 45 insertions(+), 3 deletions(-) diff --git a/EnvyUpdate/MainWindow.xaml.cs b/EnvyUpdate/MainWindow.xaml.cs index d17226a..25c49dd 100644 --- a/EnvyUpdate/MainWindow.xaml.cs +++ b/EnvyUpdate/MainWindow.xaml.cs @@ -146,7 +146,31 @@ namespace EnvyUpdate textblockGPUName.Text = Debug.GPUname(); } - gpuURL = Util.GetGpuUrl(); + try + { + gpuURL = Util.GetGpuUrl(); + } + catch (ArgumentException) + { + try + { + // disable SD and try with GRD + if (File.Exists(GlobalVars.exepath + "sd.envy")) + { + File.Delete(GlobalVars.exepath + "sd.envy"); + } + + gpuURL = Util.GetGpuUrl(); //try again with GRD + MessageBox.Show(Properties.Resources.ui_studionotsupported); + radioGRD.IsChecked = true; + } + catch (ArgumentException) + { + // Now we have a problem. + MessageBox.Show("ERROR: Invalid API response from Nvidia. Please file an issue on GitHub."); + Environment.Exit(10); + } + } using (var c = new WebClient()) { diff --git a/EnvyUpdate/Properties/Resources.Designer.cs b/EnvyUpdate/Properties/Resources.Designer.cs index c102a9a..cd696e7 100644 --- a/EnvyUpdate/Properties/Resources.Designer.cs +++ b/EnvyUpdate/Properties/Resources.Designer.cs @@ -222,6 +222,15 @@ namespace EnvyUpdate.Properties { } } + /// + /// Looks up a localized string similar to Studio Driver is not supported by this graphics card.. + /// + public static string ui_studionotsupported { + get { + return ResourceManager.GetString("ui_studionotsupported", resourceCulture); + } + } + /// /// Looks up a localized string similar to Are you sure you want to uninstall EnvyUpdate?. /// diff --git a/EnvyUpdate/Properties/Resources.de.resx b/EnvyUpdate/Properties/Resources.de.resx index 8457d37..1329401 100644 --- a/EnvyUpdate/Properties/Resources.de.resx +++ b/EnvyUpdate/Properties/Resources.de.resx @@ -171,6 +171,9 @@ Diese Version überspringen + + Studio Treiber wird von dieser Grafikkarte nicht unterstützt. + Sind Sie sich sicher, dass Sie EnvyUpdate deinstallieren wollen? diff --git a/EnvyUpdate/Properties/Resources.resx b/EnvyUpdate/Properties/Resources.resx index 12997c9..abdfedd 100644 --- a/EnvyUpdate/Properties/Resources.resx +++ b/EnvyUpdate/Properties/Resources.resx @@ -171,6 +171,9 @@ Skip this version + + Studio Driver is not supported by this graphics card. + Are you sure you want to uninstall EnvyUpdate? diff --git a/EnvyUpdate/Util.cs b/EnvyUpdate/Util.cs index d729681..26df59f 100644 --- a/EnvyUpdate/Util.cs +++ b/EnvyUpdate/Util.cs @@ -394,8 +394,6 @@ namespace EnvyUpdate public static string GetGpuUrl() { - //TODO: Make a list of languages and match OS language to driver - //int langid; int psid; int pfid; int osid; @@ -437,6 +435,11 @@ namespace EnvyUpdate //relative url gpuURL = "https://www.nvidia.com/Download/" + gpuURL; } + else if (gpuURL.Contains("No certified downloads were found")) + { + //configuration not supported + throw new ArgumentException(); + } else { //panic.