Fix different bug in detection

This commit is contained in:
fyr77 2021-05-02 16:48:44 +02:00
parent bc26b5caac
commit ef98df1c92
3 changed files with 17 additions and 20 deletions

View file

@ -9,7 +9,7 @@ namespace EnvyUpdate
public static readonly string exeloc = System.Reflection.Assembly.GetEntryAssembly().Location; 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 exepath = Path.GetDirectoryName(System.Reflection.Assembly.GetEntryAssembly().Location) + "\\";
public static readonly string startmenu = Environment.GetFolderPath(Environment.SpecialFolder.StartMenu); 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 appdata = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\envyupdate\\";
public static readonly string startup = Environment.GetFolderPath(Environment.SpecialFolder.Startup); public static readonly string startup = Environment.GetFolderPath(Environment.SpecialFolder.Startup);
public static readonly string desktopOverride = exepath + "desktop.envy"; public static readonly string desktopOverride = exepath + "desktop.envy";

View file

@ -1,6 +1,4 @@
using System.Reflection; using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using System.Windows; using System.Windows;
@ -12,7 +10,7 @@ using System.Windows;
[assembly: AssemblyConfiguration("")] [assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")] [assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("EnvyUpdate")] [assembly: AssemblyProduct("EnvyUpdate")]
[assembly: AssemblyCopyright("Copyright © 2020")] [assembly: AssemblyCopyright("Copyright © 2021")]
[assembly: AssemblyTrademark("")] [assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")] [assembly: AssemblyCulture("")]
@ -51,5 +49,5 @@ using System.Windows;
// You can specify all the values or you can default the Build and Revision Numbers // You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below: // by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")] // [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.4")] [assembly: AssemblyVersion("2.6")]
[assembly: AssemblyFileVersion("2.4")] [assembly: AssemblyFileVersion("2.6")]

View file

@ -1,17 +1,15 @@
using IWshRuntimeLibrary; using IWshRuntimeLibrary;
using Microsoft.Win32;
using Newtonsoft.Json;
using System; using System;
using System.Diagnostics; using System.Diagnostics;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Management; using System.Management;
using System.Net; using System.Net;
using System.Windows;
using Newtonsoft.Json;
using System.Xml;
using System.Xml.Linq;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
using System.Runtime.InteropServices; using System.Windows;
using Microsoft.Win32; using System.Xml.Linq;
namespace EnvyUpdate namespace EnvyUpdate
{ {
@ -202,10 +200,10 @@ namespace EnvyUpdate
switch (IDtype) switch (IDtype)
{ {
case "psid": case "psid":
id = GetValueFromName(xDoc, gpuName, false); id = GetValueFromName(xDoc, gpuName, true);
break; break;
case "pfid": case "pfid":
id = GetValueFromName(xDoc, gpuName, true); id = GetValueFromName(xDoc, gpuName, false);
break; break;
case "osid": case "osid":
id = GetOSID(); id = GetOSID();
@ -228,7 +226,7 @@ namespace EnvyUpdate
/// <param name="query"></param> /// <param name="query"></param>
/// <param name="psid"></param> /// <param name="psid"></param>
/// <returns></returns> /// <returns></returns>
private static int GetValueFromName (XDocument xDoc, string query, bool psid) private static int GetValueFromName(XDocument xDoc, string query, bool psid)
{ {
int value = 0; int value = 0;
int i = 0; int i = 0;
@ -347,6 +345,7 @@ namespace EnvyUpdate
GPUName = obj["VideoProcessor"].ToString().ToLower(); GPUName = obj["VideoProcessor"].ToString().ToLower();
// Remove any 3GB, 6GB or similar from name. We don't need to know the VRAM to get results. // 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, "\\d+GB", "");
GPUName = Regex.Replace(GPUName, "nvidia ", "");
} }
else else
GPUName = obj["VideoProcessor"].ToString(); GPUName = obj["VideoProcessor"].ToString();