private void ParseBindFile() { Global.logger.Error("Current bind file: " + currentBindFile); HashSet <string> modifierKeys = new HashSet <string>(); Dictionary <string, Bind> commandToBind = new Dictionary <string, Bind>(); Dictionary <Bind, string> bindToCommand = new Dictionary <Bind, string>(); XmlDocument doc = new XmlDocument(); try { doc.Load(currentBindFile); XmlNodeList commands = doc.DocumentElement.ChildNodes; foreach (XmlNode command in commands) { Bind bind = new Bind(command.Name); foreach (XmlNode xmlMapping in command.ChildNodes) { if (xmlMapping.Name != "Primary" && xmlMapping.Name != "Secondary") { continue; } if (xmlMapping.Attributes["Key"] == null) { continue; } Bind.Mapping mapping = new Bind.Mapping(); if (xmlMapping.Attributes["Device"].Value == "Keyboard") { mapping.SetKey(xmlMapping.Attributes["Key"].Value); } foreach (XmlNode property in xmlMapping.ChildNodes) { if (property.Name != "Modifier") { continue; } if (property.Attributes["Device"].Value == "Keyboard" && !string.IsNullOrEmpty(property.Attributes["Key"].Value)) { modifierKeys.Add(property.Attributes["Key"].Value); mapping.AddModifier(property.Attributes["Key"].Value); } } if (mapping.HasKey()) { bind.AddMapping(mapping); } } if (bind.mappings.Any()) { commandToBind[command.Name] = bind; bindToCommand[bind] = command.Name; } } } catch (System.IO.FileNotFoundException) { Global.logger.Error("Error loading binds file: " + currentBindFile); } GSI.Nodes.Controls controls = (_game_state as GameState_EliteDangerous).Controls; controls.modifierKeys = modifierKeys; controls.commandToBind = commandToBind; controls.bindToCommand = bindToCommand; }