From babacb68dd00753ddc6d94b8a7709337890ce5b3 Mon Sep 17 00:00:00 2001 From: fyr77 Date: Sun, 2 May 2021 16:16:03 +0200 Subject: [PATCH 001/136] add workaround for registry read error --- EnvyUpdate/Debug.cs | 1 + EnvyUpdate/Util.cs | 23 ++++++++++++++++++++--- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/EnvyUpdate/Debug.cs b/EnvyUpdate/Debug.cs index 3b4d7f0..ff64185 100644 --- a/EnvyUpdate/Debug.cs +++ b/EnvyUpdate/Debug.cs @@ -1,4 +1,5 @@ using System; +using System.IO; using System.Linq; namespace EnvyUpdate diff --git a/EnvyUpdate/Util.cs b/EnvyUpdate/Util.cs index 56f9158..ecfa422 100644 --- a/EnvyUpdate/Util.cs +++ b/EnvyUpdate/Util.cs @@ -387,10 +387,27 @@ namespace EnvyUpdate RegistryKey nvlddmkm = Registry.LocalMachine.OpenSubKey(@"System\CurrentControlSet\services\nvlddmkm", true); return nvlddmkm.GetValueNames().Contains("DCHUVen"); } - catch (NullReferenceException) + catch (Exception ex) { - // Assume no DCH driver is installed if key is not found. - return false; + if (ex.InnerException is NullReferenceException) + { + // Assume no DCH driver is installed if key is not found. + return false; + } + else if (ex.InnerException is System.Security.SecurityException) + { + //Registry reading error. Check for existance of file nvsvs.dll instead. + if (System.IO.File.Exists(Path.Combine(Environment.SystemDirectory, "nvsvs.dll"))) + return true; + else + return false; + } + else + { + MessageBox.Show("An error has occured. Please report this on GitHub.\nError:" + ex.Message); + Environment.Exit(20); + return false; + } } } public static int GetDTCID() From bc26b5caac932ed59dd75be5a5f092ae4a3334c5 Mon Sep 17 00:00:00 2001 From: fyr77 Date: Sun, 2 May 2021 16:24:05 +0200 Subject: [PATCH 002/136] Bump and argh --- EnvyUpdate/GlobalVars.cs | 2 +- EnvyUpdate/Util.cs | 25 ++++++++++++++----------- 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/EnvyUpdate/GlobalVars.cs b/EnvyUpdate/GlobalVars.cs index 352f9cb..068498c 100644 --- a/EnvyUpdate/GlobalVars.cs +++ b/EnvyUpdate/GlobalVars.cs @@ -9,7 +9,7 @@ namespace EnvyUpdate public static readonly string exeloc = System.Reflection.Assembly.GetEntryAssembly().Location; public static readonly string exepath = Path.GetDirectoryName(System.Reflection.Assembly.GetEntryAssembly().Location) + "\\"; public static readonly string startmenu = Environment.GetFolderPath(Environment.SpecialFolder.StartMenu); - public static readonly float version = 2.4F; + public static readonly float version = 2.5F; public static readonly string appdata = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\envyupdate\\"; public static readonly string startup = Environment.GetFolderPath(Environment.SpecialFolder.Startup); public static readonly string desktopOverride = exepath + "desktop.envy"; diff --git a/EnvyUpdate/Util.cs b/EnvyUpdate/Util.cs index ecfa422..0a826b1 100644 --- a/EnvyUpdate/Util.cs +++ b/EnvyUpdate/Util.cs @@ -394,19 +394,22 @@ namespace EnvyUpdate // Assume no DCH driver is installed if key is not found. return false; } - else if (ex.InnerException is System.Security.SecurityException) - { - //Registry reading error. Check for existance of file nvsvs.dll instead. - if (System.IO.File.Exists(Path.Combine(Environment.SystemDirectory, "nvsvs.dll"))) - return true; - else - return false; - } else { - MessageBox.Show("An error has occured. Please report this on GitHub.\nError:" + ex.Message); - Environment.Exit(20); - return false; + try + { + //Registry reading error. Check for existance of file nvsvs.dll instead. + if (System.IO.File.Exists(Path.Combine(Environment.SystemDirectory, "nvsvs.dll"))) + return true; + else + return false; + } + catch (Exception) + { + MessageBox.Show("An error has occured. Please report this on GitHub.\nError:" + ex.Message); + Environment.Exit(20); + return false; + } } } } From ef98df1c92fb2b601dff08e484e48e8aadc4ee32 Mon Sep 17 00:00:00 2001 From: fyr77 Date: Sun, 2 May 2021 16:48:44 +0200 Subject: [PATCH 003/136] Fix different bug in detection --- EnvyUpdate/GlobalVars.cs | 2 +- EnvyUpdate/Properties/AssemblyInfo.cs | 8 +++----- EnvyUpdate/Util.cs | 27 +++++++++++++-------------- 3 files changed, 17 insertions(+), 20 deletions(-) diff --git a/EnvyUpdate/GlobalVars.cs b/EnvyUpdate/GlobalVars.cs index 068498c..595daaf 100644 --- a/EnvyUpdate/GlobalVars.cs +++ b/EnvyUpdate/GlobalVars.cs @@ -9,7 +9,7 @@ namespace EnvyUpdate public static readonly string exeloc = System.Reflection.Assembly.GetEntryAssembly().Location; public static readonly string exepath = Path.GetDirectoryName(System.Reflection.Assembly.GetEntryAssembly().Location) + "\\"; public static readonly string startmenu = Environment.GetFolderPath(Environment.SpecialFolder.StartMenu); - public static readonly float version = 2.5F; + public static readonly float version = 2.6F; public static readonly string appdata = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\envyupdate\\"; public static readonly string startup = Environment.GetFolderPath(Environment.SpecialFolder.Startup); public static readonly string desktopOverride = exepath + "desktop.envy"; diff --git a/EnvyUpdate/Properties/AssemblyInfo.cs b/EnvyUpdate/Properties/AssemblyInfo.cs index 0791eb4..a765e84 100644 --- a/EnvyUpdate/Properties/AssemblyInfo.cs +++ b/EnvyUpdate/Properties/AssemblyInfo.cs @@ -1,6 +1,4 @@ using System.Reflection; -using System.Resources; -using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Windows; @@ -12,7 +10,7 @@ using System.Windows; [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("EnvyUpdate")] -[assembly: AssemblyCopyright("Copyright © 2020")] +[assembly: AssemblyCopyright("Copyright © 2021")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] @@ -51,5 +49,5 @@ using System.Windows; // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("2.4")] -[assembly: AssemblyFileVersion("2.4")] +[assembly: AssemblyVersion("2.6")] +[assembly: AssemblyFileVersion("2.6")] diff --git a/EnvyUpdate/Util.cs b/EnvyUpdate/Util.cs index 0a826b1..fdfa325 100644 --- a/EnvyUpdate/Util.cs +++ b/EnvyUpdate/Util.cs @@ -1,17 +1,15 @@ using IWshRuntimeLibrary; +using Microsoft.Win32; +using Newtonsoft.Json; using System; using System.Diagnostics; using System.IO; using System.Linq; using System.Management; using System.Net; -using System.Windows; -using Newtonsoft.Json; -using System.Xml; -using System.Xml.Linq; using System.Text.RegularExpressions; -using System.Runtime.InteropServices; -using Microsoft.Win32; +using System.Windows; +using System.Xml.Linq; namespace EnvyUpdate { @@ -202,10 +200,10 @@ namespace EnvyUpdate switch (IDtype) { case "psid": - id = GetValueFromName(xDoc, gpuName, false); + id = GetValueFromName(xDoc, gpuName, true); break; case "pfid": - id = GetValueFromName(xDoc, gpuName, true); + id = GetValueFromName(xDoc, gpuName, false); break; case "osid": id = GetOSID(); @@ -228,7 +226,7 @@ namespace EnvyUpdate /// /// /// - private static int GetValueFromName (XDocument xDoc, string query, bool psid) + private static int GetValueFromName(XDocument xDoc, string query, bool psid) { int value = 0; int i = 0; @@ -333,11 +331,11 @@ namespace EnvyUpdate { //if (obj["Description"].ToString().ToLower().Contains("radeon")) //{ - // If it's an AMD card, use the "Name" field, because they use chip code numbers in "VideoProcessor", which we do not need. - // Todo for 3.0: Find a way to ignore mobile Radeon GPUs in Laptops. - // For now: Since we only care about Nvidia GPUs, this is commented out. - //GPUName = obj["Name"].ToString().ToLower(); - //break; + // If it's an AMD card, use the "Name" field, because they use chip code numbers in "VideoProcessor", which we do not need. + // Todo for 3.0: Find a way to ignore mobile Radeon GPUs in Laptops. + // For now: Since we only care about Nvidia GPUs, this is commented out. + //GPUName = obj["Name"].ToString().ToLower(); + //break; //} if (obj["Description"].ToString().ToLower().Contains("nvidia")) { @@ -347,6 +345,7 @@ namespace EnvyUpdate GPUName = obj["VideoProcessor"].ToString().ToLower(); // Remove any 3GB, 6GB or similar from name. We don't need to know the VRAM to get results. GPUName = Regex.Replace(GPUName, "\\d+GB", ""); + GPUName = Regex.Replace(GPUName, "nvidia ", ""); } else GPUName = obj["VideoProcessor"].ToString(); From 48786a49f7d68c19f9174095ff5019c456458395 Mon Sep 17 00:00:00 2001 From: fyr77 Date: Sun, 2 May 2021 17:00:39 +0200 Subject: [PATCH 004/136] Fix updater --- EnvyUpdate/EnvyUpdate.csproj | 28 +++++++++++++++++++++++++++- EnvyUpdate/Util.cs | 5 +++-- 2 files changed, 30 insertions(+), 3 deletions(-) diff --git a/EnvyUpdate/EnvyUpdate.csproj b/EnvyUpdate/EnvyUpdate.csproj index 4d0512f..4ac9c50 100644 --- a/EnvyUpdate/EnvyUpdate.csproj +++ b/EnvyUpdate/EnvyUpdate.csproj @@ -18,6 +18,21 @@ true + publish\ + true + Disk + false + Foreground + 7 + Days + false + false + true + 0 + 1.0.0.%2a + false + false + true AnyCPU @@ -174,7 +189,18 @@ True - + + + False + Microsoft .NET Framework 4.7.2 %28x86 and x64%29 + true + + + False + .NET Framework 3.5 SP1 + false + + diff --git a/EnvyUpdate/Util.cs b/EnvyUpdate/Util.cs index fdfa325..1404bf8 100644 --- a/EnvyUpdate/Util.cs +++ b/EnvyUpdate/Util.cs @@ -111,14 +111,15 @@ namespace EnvyUpdate using (var wc = new WebClient()) { // Use some user agent to not get 403'd by GitHub. - wc.Headers.Add("user-agent", "Mozilla/5.0 (Windows NT 10.0; Trident/7.0; rv:11.0) like Gecko"); + wc.Headers.Add("user-agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:88.0) Gecko/20100101 Firefox/88.0"); string webData = wc.DownloadString(updPath); data = JsonConvert.DeserializeObject(webData); } // I am not catching a possible parsing exception, because I cannot think of any way it could happen. // If there is no internet connection, it should already throw when using the web client. - float version = float.Parse(data.tag_name); + string tagver = data.tag_name; + float version = float.Parse(tagver); return version; } From 85ae027c2822433aa49804694bf88ddd595d9974 Mon Sep 17 00:00:00 2001 From: fyr77 Date: Sun, 2 May 2021 17:03:44 +0200 Subject: [PATCH 005/136] bump version --- EnvyUpdate/GlobalVars.cs | 2 +- EnvyUpdate/Properties/AssemblyInfo.cs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/EnvyUpdate/GlobalVars.cs b/EnvyUpdate/GlobalVars.cs index 595daaf..ab234c7 100644 --- a/EnvyUpdate/GlobalVars.cs +++ b/EnvyUpdate/GlobalVars.cs @@ -9,7 +9,7 @@ namespace EnvyUpdate public static readonly string exeloc = System.Reflection.Assembly.GetEntryAssembly().Location; public static readonly string exepath = Path.GetDirectoryName(System.Reflection.Assembly.GetEntryAssembly().Location) + "\\"; public static readonly string startmenu = Environment.GetFolderPath(Environment.SpecialFolder.StartMenu); - public static readonly float version = 2.6F; + public static readonly float version = 2.7F; public static readonly string appdata = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\envyupdate\\"; public static readonly string startup = Environment.GetFolderPath(Environment.SpecialFolder.Startup); public static readonly string desktopOverride = exepath + "desktop.envy"; diff --git a/EnvyUpdate/Properties/AssemblyInfo.cs b/EnvyUpdate/Properties/AssemblyInfo.cs index a765e84..f912aaf 100644 --- a/EnvyUpdate/Properties/AssemblyInfo.cs +++ b/EnvyUpdate/Properties/AssemblyInfo.cs @@ -49,5 +49,5 @@ using System.Windows; // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("2.6")] -[assembly: AssemblyFileVersion("2.6")] +[assembly: AssemblyVersion("2.7")] +[assembly: AssemblyFileVersion("2.7")] From b54de3eb36a6b0ee58fc1e0be3f984c91ccf0dc0 Mon Sep 17 00:00:00 2001 From: fyr77 Date: Sat, 8 May 2021 00:04:40 +0200 Subject: [PATCH 006/136] remove broken updater for now --- EnvyUpdate/GlobalVars.cs | 2 +- EnvyUpdate/MainWindow.xaml | 2 -- EnvyUpdate/MainWindow.xaml.cs | 36 ++++++++++++++++++++-- EnvyUpdate/Properties/AssemblyInfo.cs | 4 +-- README.md | 44 ++++++++++++--------------- 5 files changed, 56 insertions(+), 32 deletions(-) diff --git a/EnvyUpdate/GlobalVars.cs b/EnvyUpdate/GlobalVars.cs index ab234c7..c5ab17d 100644 --- a/EnvyUpdate/GlobalVars.cs +++ b/EnvyUpdate/GlobalVars.cs @@ -9,7 +9,7 @@ namespace EnvyUpdate public static readonly string exeloc = System.Reflection.Assembly.GetEntryAssembly().Location; public static readonly string exepath = Path.GetDirectoryName(System.Reflection.Assembly.GetEntryAssembly().Location) + "\\"; public static readonly string startmenu = Environment.GetFolderPath(Environment.SpecialFolder.StartMenu); - public static readonly float version = 2.7F; + public static readonly float version = 2.8F; public static readonly string appdata = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\envyupdate\\"; public static readonly string startup = Environment.GetFolderPath(Environment.SpecialFolder.Startup); public static readonly string desktopOverride = exepath + "desktop.envy"; diff --git a/EnvyUpdate/MainWindow.xaml b/EnvyUpdate/MainWindow.xaml index 77c6c30..f5e1ec4 100644 --- a/EnvyUpdate/MainWindow.xaml +++ b/EnvyUpdate/MainWindow.xaml @@ -19,9 +19,7 @@