private void button1_Click(object sender, EventArgs e) { SimCSettings.currentSettings.Cooldowns.key = (Keys)cdKey.SelectedItem; SimCSettings.currentSettings.Execution.key = (Keys)exKey.SelectedItem; SimCSettings.currentSettings.Burst.key = (Keys)BKey.SelectedItem; SimCSettings.currentSettings.Aoe.key = (Keys)AoeKey.SelectedItem; SimCSettings.currentSettings.Cooldowns.mod = (ModifierKeys)cdMod.SelectedItem; SimCSettings.currentSettings.Execution.mod = (ModifierKeys)exMod.SelectedItem; SimCSettings.currentSettings.Burst.mod = (ModifierKeys)bMod.SelectedItem; SimCSettings.currentSettings.Aoe.mod = (ModifierKeys)aoeMod.SelectedItem; SimCSettings.Save(); SimcraftImpl.UnregisterHotkeys(); SimcraftImpl.RegisterHotkeys(); Close(); }
public static void Load() { try { SimcraftImpl.Write("Loading configuration"); var reader = new XmlSerializer(typeof(SimCSettings)); var file = new StreamReader(Path.Combine(Settings.CharacterSettingsDirectory, "SimCSettings.xml")); currentSettings = (SimCSettings)reader.Deserialize(file); SimcraftImpl.Write("Configuration successfully loaded."); } catch { SimcraftImpl.Write("Failed to load configuration, creating default configuration."); //Write("Exception: " + e); _currentSettings = DefaultConfig(); } }
private static SimCSettings DefaultConfig() { var ret = new SimCSettings { Cooldowns = new Hotkey(), Aoe = new Hotkey(), Burst = new Hotkey(), Execution = new Hotkey() }; ret.Cooldowns.key = Keys.C; ret.Cooldowns.mod = ModifierKeys.NoRepeat; ret.Aoe.key = Keys.A; ret.Aoe.mod = ModifierKeys.NoRepeat; ret.Burst.key = Keys.B; ret.Burst.mod = ModifierKeys.NoRepeat; ret.Execution.key = Keys.X; ret.Execution.mod = ModifierKeys.NoRepeat; return(ret); }