private void lstOptionsProfiles_SelectedIndexChanged(object sender, EventArgs e) { if (Profiles[lstOptionsProfiles.SelectedIndex] == null) { return; } XTUProfile selectedProfile = Profiles[lstOptionsProfiles.SelectedIndex]; txtName.Text = selectedProfile.Name; numMinW.Value = (decimal)selectedProfile.MinimumWatt; numMaxW.Value = (decimal)selectedProfile.MaximumWatt; numCPUuv.Value = selectedProfile.CPUUndervolt; numGPUuv.Value = selectedProfile.GPUUndervolt; cmbProfileImage.SelectedItem = selectedProfile.ProfileImage.ToString(); if (lstOptionsProfiles.SelectedIndex == 0) { DisableEditControls(); } else { EnableEditControls(); } }
public static void AddLogonProfileKey(XTUProfile profile) { ClearLogonProfileKey(); RegistryKey key = Registry.CurrentUser.OpenSubKey(Shared.RUN_AT_LOGON_PATH, true); key.SetValue(Shared.APP_NAME_VALUE, '"' + Application.ExecutablePath + '"' + " " + profile.Name); }
private void AddSelectedProfileInComboboxToLogon() { if (cmbProfileLogOn.SelectedIndex < 0) { return; } XTUProfile selectedProfile = Profiles[cmbProfileLogOn.SelectedIndex]; StartupTaskManager.CreateTask(selectedProfile.Name); }
private void ApplyXTUProfile(XTUProfile xtuProfile) { string minWResult = ""; string maxWResult = ""; string cpuUvResult = ""; string gpuUvResult = ""; StartXTUService(); // XTU doesn't apply the underclocks reliably, so we need multiple tries int maxTries = 5; int currentTry = 0; while (currentTry < maxTries && !cpuUvResult.Contains(xtuProfile.CPUUndervolt + "mV") || !gpuUvResult.Contains(xtuProfile.GPUUndervolt + "mV")) { currentTry++; minWResult = ExecuteInXTUAndGetOutput("-t -id 48 -v " + xtuProfile.MinimumWatt); Console.WriteLine(minWResult); maxWResult = ExecuteInXTUAndGetOutput("-t -id 47 -v " + xtuProfile.MaximumWatt); Console.WriteLine(maxWResult); cpuUvResult = ExecuteInXTUAndGetOutput("-t -id 34 -v -" + xtuProfile.CPUUndervolt); Console.WriteLine(cpuUvResult); gpuUvResult = ExecuteInXTUAndGetOutput("-t -id 100 -v -" + xtuProfile.GPUUndervolt); Console.WriteLine(gpuUvResult); // turbo boost power max ExecuteInXTUAndGetOutput("-t -id 66 -v " + 96); } if (minWResult.Contains("Successful") && maxWResult.Contains("Successful") && cpuUvResult.Contains("Successful") && gpuUvResult.Contains("Successful")) { txtInfo.Text = "Applied " + xtuProfile.Name + " profile succesfully!\r\n"; Console.WriteLine("Applied " + xtuProfile.Name + " profile succesfully!"); ReadCurrentValues(); } else { txtInfo.Text = "Failed to fully apply " + xtuProfile.Name + " profile. Results:\n"; txtInfo.Text += minWResult + "\n" + maxWResult + "\n" + cpuUvResult + "\n" + gpuUvResult + "\n"; Console.WriteLine("Failed to fully apply " + xtuProfile.Name + " profile. Results:\n"); Console.WriteLine(minWResult + "\n" + maxWResult + "\n" + cpuUvResult + "\n" + gpuUvResult + "\n"); } StopXTUService(); }
private void CreateAndAddNewProfile() { if (Profiles.Count < 8) { XTUProfile newProfile = new XTUProfile(); int newProfileCount = Profiles.Count(p => p.Name.StartsWith(newProfile.Name)); if (newProfileCount > 0) // Already NEW_PROFILE profiles { newProfile.Name += (newProfileCount + 1); } Profiles.Add(newProfile); UpdateProfileList(); CheckForLogonTask(); lstOptionsProfiles.SelectedIndex = lstOptionsProfiles.Items.Count - 1; } }
private void RefreshButtonInfo() { for (int i = 0; i < 8; i++) { if (i < _xtuProfiles.Count) { XTUProfile profile = _xtuProfiles[i]; _profileButtons[i].Text = profile.Name + "\n\n" + "Min W: " + profile.MinimumWatt + "\nMax W: " + profile.MaximumWatt + "\nCPU: -" + profile.CPUUndervolt + " mV" + "\nGPU: -" + profile.GPUUndervolt + " mV"; _profileButtons[i].Image = Shared.IMAGE_RESOURCES_DICTIONARY[profile.ProfileImage]; } else { _profileButtons[i].Text = "Create profile..."; _profileButtons[i].Image = Resources.Plus; } } }
public MainForm(string[] args = null) { InitializeComponent(); CheckForXTU(); StartXTUService(); LoadProfilesIntoList(); if (args == null) { return; } if (args.Length > 0) { if (args.Length == 4) // Temp profile application. Parameters: minW maxW cpuUV gpuUV { XTUProfile tempProfile = new XTUProfile("TEMP", Convert.ToDouble(args[0]), Convert.ToDouble(args[1]), Convert.ToInt32(args[2]), Convert.ToInt32(args[3]), ProfileImage.Gaming); ApplyXTUProfile(tempProfile); Environment.Exit(0); } else if (args.Length == 1) // Apply profile by name. Parameter: profile name. { XTUProfile profileToApply = _xtuProfiles.Find(p => p.Name == args[0]); if (profileToApply != null) { ApplyXTUProfile(profileToApply); Environment.Exit(0); } else { MessageBox.Show("Attempted to start a profile named " + args[0] + " that isn't defined. Closing application.", "GPD Win 2 XTU Manager: Profile not defined!", MessageBoxButtons.OK, MessageBoxIcon.Error); Environment.Exit(404); } } else { MessageBox.Show("Incorrect number of arguments. Expected 4, but was given " + args.Length); } } }