public IMapleData GetData(string path) { string dataPath = $"{m_mRoot}//{path}.xml"; if (!File.Exists(dataPath)) { throw new Exception($"文件不存在 路径:{dataPath}"); } var domMapleData = new XmlDomMapleData(dataPath); return(domMapleData); }
public IMapleData GetChildByPath(string path) { var segments = path.Split('/'); if (segments[0].Equals("..")) { return(((IMapleData)Parent).GetChildByPath(path.Substring(path.IndexOf("/") + 1))); } var myNode = m_mNode; for (var x = 0; x < segments.Length; x++) { var childNodes = myNode.ChildNodes; var foundChild = false; for (var i = 0; i < childNodes.Count; i++) { var childNode = childNodes.Item(i); if (childNode.NodeType == XmlNodeType.Element && childNode.Attributes.GetNamedItem("name").Value.Equals(segments[x])) { myNode = childNode; foundChild = true; break; } } if (!foundChild) { return(null); } } var ret = new XmlDomMapleData(myNode); ret.m_mImageDataDir = new DirectoryInfo($"{m_mImageDataDir}\\{Name}\\{path}").Parent.FullName; return(ret); }