private static VSS.VSS_Entry GetVSSFromXMLNode(XmlNode node) { if (node.Attributes[varSoundPath] == null) { if (Enum.TryParse(node.Name, out Keys key)) { string Description = node.Attributes[varDescription].InnerText; VSS.VSS_Entry_Group groupVSSNode = new VSS.VSS_Entry_Group(Description, key); foreach (var child in node.ChildNodes) { var vssChild = GetVSSFromXMLNode((XmlNode)child); if (vssChild != null) { groupVSSNode.Nodes.Add(vssChild); } } return(groupVSSNode); } } else { if (Enum.TryParse(node.Name, out Keys key)) { string Description = node.Attributes[varDescription].InnerText; string FilePath = node.Attributes[varSoundPath].InnerText; return(new VSS.VSS_Entry_Sound(Description, key, FilePath)); } } return(null); }
public static VSS.VSS_Entry_Group LoadVSSBase(string XmlPath) { XmlDocument doc = new XmlDocument(); VSS.VSS_Entry_Group RootGroupNode = null; XmlNode ROOTNODE = null; if (!File.Exists(XmlPath)) { RootGroupNode = new VSS.VSS_Entry_Group("Root Node", Keys.V); ROOTNODE = GetXMLNodeForVSS(doc, RootGroupNode); SaveVSSBase(XmlPath, RootGroupNode); } else { doc.Load(XmlPath); ROOTNODE = doc.FirstChild; RootGroupNode = (VSS.VSS_Entry_Group)GetVSSFromXMLNode(ROOTNODE); } return(RootGroupNode); }