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 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";

View file

@ -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")]

View file

@ -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
/// <param name="query"></param>
/// <param name="psid"></param>
/// <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 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();