private static void LoadSkinXml(string xmlFile) { XmlDocument doc = new XmlDocument(); doc.Load(xmlFile); ArrayList buttons = new ArrayList(); RemoteButton temp; string key = String.Empty; XmlNodeList commandSequence = doc.DocumentElement.SelectNodes("button"); foreach (XmlNode item in commandSequence) { temp = new RemoteButton(); temp.Name = item.Attributes["name"].Value; temp.Code = item.Attributes["code"].Value; try { key = item.Attributes["shortcut"].Value; temp.Shortcut = (Keys)Enum.Parse(typeof(Keys), key, true); } catch (ArgumentException) { IrssLog.Error("Invalid Key Shortcut \"{0}\" in skin \"{1}\"", key, xmlFile); } temp.Top = int.Parse(item.Attributes["top"].Value); temp.Left = int.Parse(item.Attributes["left"].Value); temp.Height = int.Parse(item.Attributes["height"].Value); temp.Width = int.Parse(item.Attributes["width"].Value); buttons.Add(temp); } _buttons = (RemoteButton[])buttons.ToArray(typeof(RemoteButton)); }
private static void LoadSkinXml(string xmlFile) { XmlDocument doc = new XmlDocument(); doc.Load(xmlFile); ArrayList buttons = new ArrayList(); RemoteButton temp; string key = String.Empty; XmlNodeList commandSequence = doc.DocumentElement.SelectNodes("button"); foreach (XmlNode item in commandSequence) { temp = new RemoteButton(); temp.Name = item.Attributes["name"].Value; temp.Code = item.Attributes["code"].Value; try { key = item.Attributes["shortcut"].Value; temp.Shortcut = (Keys) Enum.Parse(typeof (Keys), key, true); } catch (ArgumentException) { IrssLog.Error("Invalid Key Shortcut \"{0}\" in skin \"{1}\"", key, xmlFile); } temp.Top = int.Parse(item.Attributes["top"].Value); temp.Left = int.Parse(item.Attributes["left"].Value); temp.Height = int.Parse(item.Attributes["height"].Value); temp.Width = int.Parse(item.Attributes["width"].Value); buttons.Add(temp); } _buttons = (RemoteButton[]) buttons.ToArray(typeof (RemoteButton)); }