From ef98df1c92fb2b601dff08e484e48e8aadc4ee32 Mon Sep 17 00:00:00 2001 From: fyr77 Date: Sun, 2 May 2021 16:48:44 +0200 Subject: [PATCH] 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();