public AboutForm(ModManagerForm form) { InitializeComponent(); modManager = form; // Use the same icon as executable Icon = Icon.ExtractAssociatedIcon(Application.ExecutablePath); pictureBox.Image = Icon.ToBitmap(); // Get values from ModManagerForm autoupdateCheckBox.Checked = modManager.GetSetting(ModManagerForm.AUTOUPDATE) == 1; if (modManager.GetSetting(ModManagerForm.AOT_COMPILATION) == 1) { AOTCompilationRadioButton.Checked = true; } else if (modManager.GetSetting(ModManagerForm.MULTITHREADED_JIT) == 1) { multithreadedJITCompilationRadioButton.Checked = true; } else { singlethreadedJITCompilationRadioButton.Checked = true; } // We have to add those methods to the EventHandler here so we could avoid accidental firing of those methods after we would change the state of the CheckBox autoupdateCheckBox.CheckedChanged += new EventHandler(AutoupdateCheckBox_CheckedChanged); singlethreadedJITCompilationRadioButton.CheckedChanged += new EventHandler(SinglethreadedJITCompilationRadioButton_CheckedChanged); multithreadedJITCompilationRadioButton.CheckedChanged += new EventHandler(MultithreadedJITCompilationRadioButton_CheckedChanged); AOTCompilationRadioButton.CheckedChanged += new EventHandler(AOTCompilationRadioButton_CheckedChanged); }
/// <summary> /// Creates the Form of the Mod Merger Window /// </summary> /// <param name="Form"></param> public ModMergerForm(ModManagerForm Form) { InitializeComponent(); modManager = Form; GetLoadableMods(); // Use the same icon as executable Icon = Icon.ExtractAssociatedIcon(Application.ExecutablePath); // Disable the simpler textboxes UsedModsList.Enabled = false; AvailableModsList.Enabled = false; }
public SystemPerformanceManagerForm(ModManagerForm form) { InitializeComponent(); modManager = form; timer = new Timer() { Enabled = true, Interval = 1000 }; timer.Tick += new EventHandler(TimerTick); // Use the same icon as executable Icon = Icon.ExtractAssociatedIcon(Application.ExecutablePath); TimerCaps caps = WinApiCalls.QueryTimerResolution(); minimumTimerResolutionTextBox.Text = caps.PeriodMax / 10000.0 + " ms"; maximumTimerResolutionTextBox.Text = caps.PeriodMin / 10000.0 + " ms"; currentTimerResolutionTextBox.Text = caps.PeriodCurrent / 10000.0 + " ms"; if (caps.PeriodCurrent / 10000.0 < 0.8) { modManager.IsTimerResolutionLowered = true; } REG_DOW_PATH = modManager.CurrentDir + "\\" + modManager.CurrentGameEXE; // We are checking for Compatibility settings in Registry using (RegistryKey key = Registry.CurrentUser.OpenSubKey(REG_COMPATIBILITY_PATH, false)) { if (key != null) { object valueObject = key.GetValue(REG_DOW_PATH); if (valueObject != null) { string value = valueObject.ToString(); if (value.Contains(REG_VALUE_FULLSCREEN_OPTIMIZATIONS)) { fullscreenOptimizationsCheckBox.Checked = true; } if (value.Contains(REG_VALUE_RUN_AS_ADMIN)) { runAsAdministratorCheckBox.Checked = true; } if (value.Contains(REG_VALUE_HDPI_AWARE)) { HDPIiScalingCheckBox.Checked = true; } if (value.Contains(REG_VALUE_COMPATIBILITY_WITH)) { comatibilityModeCheckBox.Checked = true; } } } } // We are checking for Power Settings in Registry using (RegistryKey key = Registry.LocalMachine.OpenSubKey(REG_POWER_SCHEMES_PATH + "\\" + GUID_ULTIMATE_PERFORMANCE_2, false)) { if (key != null) { powerPlanComboBox.Items.Add(NAME_ULTIMATE_PERFORMANCE); unlockUltimatePerformanceButton.Enabled = false; ultimatePerformanceGUIDIndex = 2; } } using (RegistryKey key = Registry.LocalMachine.OpenSubKey(REG_POWER_SCHEMES_PATH + "\\" + GUID_ULTIMATE_PERFORMANCE, false)) { if (key != null && ultimatePerformanceGUIDIndex == 0) { powerPlanComboBox.Items.Add(NAME_ULTIMATE_PERFORMANCE); unlockUltimatePerformanceButton.Enabled = false; ultimatePerformanceGUIDIndex = 1; } } using (RegistryKey key = Registry.LocalMachine.OpenSubKey(REG_POWER_SCHEMES_PATH + "\\" + GUID_MAX_PERFORMANCE, false)) { if (key != null) { powerPlanComboBox.Items.Add(NAME_MAX_PERFORMANCE); } } using (RegistryKey key = Registry.LocalMachine.OpenSubKey(REG_POWER_SCHEMES_PATH + "\\" + GUID_BALANCED, false)) { if (key != null) { powerPlanComboBox.Items.Add(NAME_BALANCED); } } using (RegistryKey key = Registry.LocalMachine.OpenSubKey(REG_POWER_SCHEMES_PATH + "\\" + GUID_POWER_SAVER, false)) { if (key != null) { powerPlanComboBox.Items.Add(NAME_POWER_SAVER); } } using (RegistryKey key = Registry.LocalMachine.OpenSubKey(REG_POWER_SCHEMES_PATH, false)) { if (key != null) { object valueObject = key.GetValue("ActivePowerScheme"); if (valueObject != null) { string value = valueObject.ToString(); switch (value) { case GUID_ULTIMATE_PERFORMANCE: case GUID_ULTIMATE_PERFORMANCE_2: powerPlanComboBox.SelectedItem = NAME_ULTIMATE_PERFORMANCE; break; case GUID_MAX_PERFORMANCE: powerPlanComboBox.SelectedItem = NAME_MAX_PERFORMANCE; break; case GUID_BALANCED: powerPlanComboBox.SelectedItem = NAME_BALANCED; break; case GUID_POWER_SAVER: powerPlanComboBox.SelectedItem = NAME_POWER_SAVER; break; } } } } // We have to add those methods to the EventHandler here so we could avoid accidental firing of those methods after we would change the state of the CheckBox runAsAdministratorCheckBox.CheckedChanged += new EventHandler(CheckBox_CheckedChanged); HDPIiScalingCheckBox.CheckedChanged += new EventHandler(CheckBox_CheckedChanged); comatibilityModeCheckBox.CheckedChanged += new EventHandler(CheckBox_CheckedChanged); fullscreenOptimizationsCheckBox.CheckedChanged += new EventHandler(CheckBox_CheckedChanged); powerPlanComboBox.SelectedIndexChanged += new EventHandler(PowerPlanComboBox_SelectedIndexChanged); }
/// <summary> /// Creates the Form of the Mod Downloader Window /// </summary> /// <param name="form"></param> /// <param name="moduleFileName"></param> public ModDownloaderForm(ModManagerForm form, string moduleFileName = "") { InitializeComponent(); modManager = form; // Use the same icon as executable Icon = Icon.ExtractAssociatedIcon(Application.ExecutablePath); // Add mods to the modlist based on what version of Dawn of War was detected // DO NOT extract this as a method - it will be x2 times slower! Even with "AggressiveInlining" modlist = new List <Mod>(); if (modManager.CurrentGameEXE == ModManagerForm.GameExecutable.SOULSTORM) { popularModsLabel.Text += "Soulstorm:"; ReadModsFromFile("[SS]"); } else if (modManager.CurrentGameEXE == ModManagerForm.GameExecutable.DARK_CRUSADE) { popularModsLabel.Text += "Dark Crusade:"; ReadModsFromFile("[DC]"); } else if (modManager.CurrentGameEXE == ModManagerForm.GameExecutable.WINTER_ASSAULT) { popularModsLabel.Text += "Winter Assault:"; ReadModsFromFile("[WA]"); } else if (modManager.CurrentGameEXE == ModManagerForm.GameExecutable.ORIGINAL) { popularModsLabel.Text += "Original:"; modlist = new List <Mod>() { new Mod("First I have to find a few mods for Original :-)", "", "", "", "") }; openModPageButton.Enabled = false; downloadModButton.Enabled = false; } // If we want to search by the *.module file name - we don't have to populate modListBox.Items if (moduleFileName.Length > 0) { searchTextBox.Text = moduleFileName; return; } for (int i = 0; i < modlist.Count; i++) { modListBox.Items.Add(modlist[i].ModName); } findByModuleName = false; modListBox.Select(); // AddRange(new Mod()) 3.5 ms // Add(new Mod()) 2.87 ms // { new Mod() } 2.7 ms // AddRange() is the slowest? NANI? BAKANA! :-) }