public void SaveConfig(string path) { InputConfig inputConfig = new InputConfig(); foreach (GameCommand command in Enum.GetValues(typeof(GameCommand))) { // Hacky way to prevent certain keys from being written to the XML file (so users don't change them). if ((int)command >= (int)GameCommand.MenuUp) { continue; } inputConfig.InputNodes.Add(inputNodeList[(int)command]); } Util.XmlHelper <InputConfig> .Save(path, inputConfig); }
public void LoadConfig(string path) { if (!File.Exists(path)) { Default(); SaveConfig(path); return; } InputConfig inputConfig = Util.XmlHelper <InputConfig> .Load(path); foreach (InputNode inputNode in inputConfig.InputNodes) { inputNodeList[(int)inputNode.GameCommand] = inputNode; } Reset(); }