示例#1
0
        private void Load()
        {
            int psid  = 0;
            int pfid  = 0;
            int osid  = 0;
            int dtcid = 0;
            int dtid  = 0;

            //int langid;

            if (File.Exists(GlobalVars.exepath + "sd.envy"))
            {
                radioSD.IsChecked = true;
            }

            // 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");
                osid  = Util.GetIDs("osid");
                dtcid = Util.GetDTCID();
                //dtid = Util.GetDTID();
            }
            else
            {
                psid                  = Debug.LoadFakeIDs("psid");
                pfid                  = Debug.LoadFakeIDs("pfid");
                osid                  = Debug.LoadFakeIDs("osid");
                dtcid                 = Debug.LoadFakeIDs("dtcid");
                dtid                  = Debug.LoadFakeIDs("dtid");
                localDriv             = Debug.LocalDriv();
                textblockGPU.Text     = localDriv;
                textblockGPUName.Text = Debug.GPUname();
            }

            //Temporary Studio Driver override logic
            try
            {
                if (radioSD.IsChecked == true)
                {
                    dtid = 18;
                }
                else
                {
                    dtid = 1;
                }
            }
            catch (NullReferenceException)
            { }

            gpuURL = "http://www.nvidia.com/Download/processDriver.aspx?psid=" + psid.ToString() + "&pfid=" + pfid.ToString() + "&osid=" + osid.ToString() + "&dtcid=" + dtcid.ToString() + "&dtid=" + dtid.ToString(); // + "&lid=" + langid.ToString();
            WebClient c = new WebClient();

            gpuURL = c.DownloadString(gpuURL);
            string pContent = c.DownloadString(gpuURL);
            var    pattern  = @"Windows\/\d{3}\.\d{2}";
            Regex  rgx      = new Regex(pattern);
            var    matches  = rgx.Matches(pContent);

            onlineDriv           = Regex.Replace(Convert.ToString(matches[0]), "Windows/", "");
            textblockOnline.Text = onlineDriv;
            c.Dispose();

            if (float.Parse(localDriv) < float.Parse(onlineDriv))
            {
                textblockOnline.Foreground = Brushes.Red;
                buttonDL.IsEnabled         = true;
                Notify.ShowDrivUpdatePopup();
            }
            else
            {
                textblockOnline.Foreground = Brushes.Green;
            }

            if (GlobalVars.exepath == GlobalVars.appdata)
            {
                WindowState = WindowState.Minimized;
                Hide();
            }
        }