public static EDControlsBindings ParseFile(string customBindingsOptionsPath) { var bindings = new EDControlsBindings(); var doc = XDocument.Load(customBindingsOptionsPath); foreach (var control in doc.Descendants()) { if (Enum.IsDefined(typeof(EDControlButton), control.Name.LocalName)) { var controlButton = (EDControlButton)Enum.Parse(typeof(EDControlButton), control.Name.LocalName); var controlBinding = new ControlButtonBinding(); controlBinding.Primary = ParseControlBinding(control, "Primary"); controlBinding.Secondary = ParseControlBinding(control, "Secondary"); bindings.buttonBindings.Add(controlButton, controlBinding); } // @todo Parse axis and options if we ever have a use for them } return(bindings); }
/** * Read the user's Custom.3.0.binds and parse the control bindings from it */ private void LoadControlBindings() { // @todo Handle the situation where the custom bindings cannot be found controlBindings = EDControlsBindings.ParseFile(CustomBindingsOptionsPath); }