private void SetupLabels(OSInfo osInfo) { lblOSVersion.Text += string.Format("{0} {1} - {2}", osInfo.OS, osInfo.Version, (osInfo.is64bit ? "64bit" : "32bit")); lblCurrentDriverVer.Text += GPUInfo.Instance.currentGPUVersion; Version currentVersion = new Version(GPUInfo.Instance.currentGPUVersion); Version newestVersion = new Version(driverList.Keys.ToArray()[0]); if (currentVersion.CompareTo(newestVersion) < 0) { lblNewVersionCheck.Text = "New Nvidia Driver Version " + newestVersion.ToString() + " available."; } else { lblNewVersionCheck.Text = "Newest Nvidia Driver already installed."; } }
private string GetOSId(OSInfo osInfo) { if (string.Equals(osInfo.OS, "Windows")) { string versionShort = osInfo.Version.Substring(0, osInfo.Version.IndexOf('.')); switch (versionShort) { case "10": return("57"); case "8": return("41"); case "7": return("19"); default: break; } } return(string.Empty); }
private void frmMain_Load(object sender, EventArgs e) { // Get System info and changed URL for the current OS OSInfo osInfo = OSInfo.Instance; string OSid = GetOSId(osInfo); // osid = Which OS string url = string.Format("http://www.nvidia.de/Download/processFind.aspx?psid=101&pfid=817&osid={0}&lid=9&whql=&lang=de&ctk=0", OSid); HtmlAgilityPack.HtmlDocument doc = new HtmlWeb().Load(url); // Get driver list with XPath HtmlNodeCollection driverNodes = doc.DocumentNode.SelectNodes("//table/tr[@id='driverList']"); driverList = new Dictionary <string, string>(driverNodes.Count); foreach (HtmlNode currentNode in driverNodes) { // Get all column nodes HtmlNodeCollection tmpNodes = currentNode.SelectNodes(".//td"); // Get Version Numbers and create the download Url string version = tmpNodes[2].InnerText; string driverUrl = string.Format("http://de.download.nvidia.com/Windows/{0}/{0}-desktop-win10-{1}-international-whql.exe", version, OSInfo.Instance.is64bit ? "64bit" : "32bit"); // Add to driveList directory try { driverList.Add(version, driverUrl); } catch (Exception ex) { Console.WriteLine(ex.Message); } } // Add driverList to combobox and select first item SetupComboBox(); // Setup labels SetupLabels(osInfo); }