/// <summary> /// Read the xml profile and return its content. /// </summary> /// <param name="path">File path</param> /// <returns></returns> public XElement ImportProfile(out XmlPhone xmlPhone, out XmlMenu xmlMenu) { xmlPhone = ReadPhoneValues(_profileFile); xmlMenu = ReadMenuValues(_profileFile); return(_profileFile); }
private XmlMenu ReadMenuValues(XElement profile) { if (profile?.Element("Menu") != null) { XElement menu = profile.Element("Menu"); XmlMenu xmlmenu = new XmlMenu(); xmlmenu.Banner = menu.Element("Banner")?.Value ?? XmlMenu.DefaultBanner; try { // Backward compatibility if (menu.Element("Keys") != null) { xmlmenu.HotkeyModifier = (ModifierKeys)int.Parse(menu.Element("Keys").Element("ModifierKey")?.Value ?? "0"); xmlmenu.Hotkey = (Key)int.Parse(menu.Element("Keys").Element("Key")?.Value ?? "0"); xmlmenu.GamepadHotkey = int.Parse(menu.Element("Keys").Element("GamepadKey")?.Value ?? "0"); } else { xmlmenu.HotkeyModifier = (ModifierKeys)int.Parse(menu.Element("ModifierKey")?.Value ?? "0"); xmlmenu.Hotkey = (Key)int.Parse(menu.Element("Key")?.Value ?? "0"); xmlmenu.GamepadHotkey = int.Parse(menu.Element("GamepadKey")?.Value ?? "0"); } } catch { // Hotkeys to open the menu aren't required. } xmlmenu.Items = GetMenuSection(menu)?.Items ?? new List <NativeUIItem>(); return(xmlmenu); } else { return(null); } }
public XmlProfile(XmlPhone xmlPhone, XmlMenu xmlMenu) { _phone = xmlPhone; _menu = xmlMenu; }