fix logic errors and typo

This commit is contained in:
fyr77 2020-08-04 12:16:27 +02:00
parent 5f56d07f19
commit a665ecc2ea
2 changed files with 27 additions and 19 deletions

View file

@ -127,8 +127,8 @@ namespace EnvyUpdate
// This little bool check is necessary for debug mode on systems without an Nvidia GPU.
if (!isDebug)
{
psid = Util.GetIDs("psid");
pfid = Util.GetIDs("pfid");
psid = Util.GetIDs("pfid");
pfid = Util.GetIDs("psid");
osid = Util.GetIDs("osid");
gpuURL = "http://www.nvidia.com/Download/processDriver.aspx?psid=" + psid.ToString() + "&pfid=" + pfid.ToString() + "&osid=" + osid.ToString(); // + "&lid=" + langid.ToString();
WebClient c = new WebClient();

View file

@ -247,30 +247,32 @@ namespace EnvyUpdate
private static int GetValueFromName (XDocument xDoc, string query, bool psid)
{
int value = 0;
int i = 0;
int value1 = 0;
int value2 = 0;
var names = xDoc.Descendants("Name");
foreach (var name in names)
{
int i = 0;
string sName = name.Value.ToString().ToLower();
if (sName == query)
{
int value1 = 0;
int value2 = 0;
string cleanResult = null;
if (psid)
{
cleanResult = name.Parent.FirstAttribute.Value;
if (i == 0)
value1 = int.Parse(name.Parent.FirstAttribute.Value);
else
value2 = int.Parse(name.Parent.FirstAttribute.Value);
}
else
{
string result = name.Parent.Value;
string result = name.Parent.Value.ToLower();
int index = result.IndexOf(sName);
cleanResult = (index < 0)
? result
: result.Remove(index, sName.Length);
}
if (i == 0)
{
@ -280,13 +282,19 @@ namespace EnvyUpdate
{
value2 = int.Parse(cleanResult);
}
}
value = value1;
if (GlobalVars.isMobile)
if (GlobalVars.isMobile && (value2 != 0))
{
value = value2;
}
else
{
value = value1;
}
if (value2 != 0)
break;
i++;
}