Beispiel #1
0
        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);
        }
Beispiel #2
0
        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();
        }