void AddChildren(XmlNode parentNode, FileDepend fd) { XmlElement parent = parentNode as XmlElement; if (parent == null) return; fd.mFile = parent.GetAttribute("path"); foreach (XmlNode child in parentNode.ChildNodes) { XmlElement elem = child as XmlElement; if (elem != null) { if (elem.Name.ToLower() == "file") { string file = elem.GetAttribute("path"); //string packagePath = GetPackagePath(file); fd.mDependFiles.Add(file); } } } }
public void Init(string xml) { //if (!Game.GetInstance().IsUsePackage()) //return; // 读取xml文件 XmlDocument xmlDoc = new XmlDocument(); xmlDoc.LoadXml(xml); XmlNode node = xmlDoc.SelectSingleNode("Root"); if (node != null) { foreach (XmlNode child in node) { XmlElement elem = child as XmlElement; if (elem != null) { if (elem.Name.ToLower() == "file") { FileDepend f = new FileDepend(); AddChildren(child, f); mFileDependencies.Add(f.mFile, f); } } } } }