fix logic errors and typo
This commit is contained in:
parent
5f56d07f19
commit
a665ecc2ea
2 changed files with 27 additions and 19 deletions
|
@ -127,8 +127,8 @@ namespace EnvyUpdate
|
||||||
// This little bool check is necessary for debug mode on systems without an Nvidia GPU.
|
// This little bool check is necessary for debug mode on systems without an Nvidia GPU.
|
||||||
if (!isDebug)
|
if (!isDebug)
|
||||||
{
|
{
|
||||||
psid = Util.GetIDs("psid");
|
psid = Util.GetIDs("pfid");
|
||||||
pfid = Util.GetIDs("pfid");
|
pfid = Util.GetIDs("psid");
|
||||||
osid = Util.GetIDs("osid");
|
osid = Util.GetIDs("osid");
|
||||||
gpuURL = "http://www.nvidia.com/Download/processDriver.aspx?psid=" + psid.ToString() + "&pfid=" + pfid.ToString() + "&osid=" + osid.ToString(); // + "&lid=" + langid.ToString();
|
gpuURL = "http://www.nvidia.com/Download/processDriver.aspx?psid=" + psid.ToString() + "&pfid=" + pfid.ToString() + "&osid=" + osid.ToString(); // + "&lid=" + langid.ToString();
|
||||||
WebClient c = new WebClient();
|
WebClient c = new WebClient();
|
||||||
|
|
|
@ -247,46 +247,54 @@ 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 value = 0;
|
||||||
|
int i = 0;
|
||||||
|
int value1 = 0;
|
||||||
|
int value2 = 0;
|
||||||
|
|
||||||
var names = xDoc.Descendants("Name");
|
var names = xDoc.Descendants("Name");
|
||||||
foreach (var name in names)
|
foreach (var name in names)
|
||||||
{
|
{
|
||||||
int i = 0;
|
|
||||||
string sName = name.Value.ToString().ToLower();
|
string sName = name.Value.ToString().ToLower();
|
||||||
if (sName == query)
|
if (sName == query)
|
||||||
{
|
{
|
||||||
int value1 = 0;
|
|
||||||
int value2 = 0;
|
|
||||||
string cleanResult = null;
|
string cleanResult = null;
|
||||||
|
|
||||||
if (psid)
|
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
|
else
|
||||||
{
|
{
|
||||||
string result = name.Parent.Value;
|
string result = name.Parent.Value.ToLower();
|
||||||
int index = result.IndexOf(sName);
|
int index = result.IndexOf(sName);
|
||||||
cleanResult = (index < 0)
|
cleanResult = (index < 0)
|
||||||
? result
|
? result
|
||||||
: result.Remove(index, sName.Length);
|
: result.Remove(index, sName.Length);
|
||||||
|
|
||||||
|
if (i == 0)
|
||||||
|
{
|
||||||
|
value1 = int.Parse(cleanResult);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
value2 = int.Parse(cleanResult);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (i == 0)
|
if (GlobalVars.isMobile && (value2 != 0))
|
||||||
{
|
|
||||||
value1 = int.Parse(cleanResult);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
value2 = int.Parse(cleanResult);
|
|
||||||
}
|
|
||||||
|
|
||||||
value = value1;
|
|
||||||
|
|
||||||
if (GlobalVars.isMobile)
|
|
||||||
{
|
{
|
||||||
value = value2;
|
value = value2;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
value = value1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (value2 != 0)
|
||||||
|
break;
|
||||||
|
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
|
Reference in a new issue