void Reset(string content) { XmlDocument xmlDoc = new XmlDocument(); xmlDoc.LoadXml(content); var root = xmlDoc.SelectSingleNode("root"); //Parent var parent = root.SelectSingleNode("Parent"); if (parent != null) { Parent = AllEntityDefs[parent.InnerText.Trim()]; } //Volatile var v = root.SelectSingleNode("Volatile"); if (v != null) { Volatile = new DefVolatile(v); } //Implements var implements = root.SelectSingleNode("Implements"); if (implements != null) { foreach (XmlNode item in implements.ChildNodes) { if (item.NodeType == XmlNodeType.Comment || item.Name == "#comment") { continue; } Implements.Add(AllEntityDefs[item.InnerText.Trim()]); } } //Properties var properties = root.SelectSingleNode("Properties"); if (properties != null) { foreach (XmlNode item in properties) { if (item.NodeType == XmlNodeType.Comment || item.Name == "#comment") { continue; } var p = new Property(item); Properties.Add(p); } } //ClientMethods var clientMethods = root.SelectSingleNode("ClientMethods"); if (clientMethods != null) { foreach (XmlNode item in clientMethods) { if (item.NodeType == XmlNodeType.Comment || item.Name == "#comment") { continue; } var c = new Method(item); ClientMethods.Add(c); } } //BaseMethods var baseMethods = root.SelectSingleNode("BaseMethods"); if (baseMethods != null) { foreach (XmlNode item in baseMethods) { if (item.NodeType == XmlNodeType.Comment || item.Name == "#comment") { continue; } var b = new Method(item); BaseMethods.Add(b); } } //CellMethods var cellMethods = root.SelectSingleNode("CellMethods"); if (cellMethods != null) { foreach (XmlNode item in cellMethods) { if (item.NodeType == XmlNodeType.Comment || item.Name == "#comment") { continue; } var cell = new Method(item); CellMethods.Add(cell); } } }
void Reset(string content) { XmlDocument xmlDoc = new XmlDocument(); xmlDoc.LoadXml(content); var root = xmlDoc.SelectSingleNode("root"); //Parent var parent = root.SelectSingleNode("Parent"); if (parent != null) { Parent = AllEntityDefs[parent.InnerText.Trim()]; } //Volatile var v = root.SelectSingleNode("Volatile"); if (v != null) { Volatile = new DefVolatile(v); } //Implements var implements = root.SelectSingleNode("Implements"); if (implements != null) { foreach (XmlNode item in implements.ChildNodes) { Implements.Add(AllEntityDefs[item.InnerText.Trim()]); } } //Properties var properties = root.SelectSingleNode("Properties"); if (properties != null) { foreach (XmlNode item in properties) { if (item.InnerText.Trim().Length > 1 && item.InnerText.Trim().Substring(0, 1) == "<") { MessageBox.Show("定义文件内可能带有‘<--’"); } else { var p = new Property(item); Properties.Add(p); } } } //ClientMethods var clientMethods = root.SelectSingleNode("ClientMethods"); if (clientMethods != null) { foreach (XmlNode item in clientMethods) { if (item.InnerText.Trim().Length > 1 && item.InnerText.Trim().Substring(0, 1) == "<") { MessageBox.Show("定义文件内可能带有‘<--’"); } else { var c = new Method(item); ClientMethods.Add(c); } } } //BaseMethods var baseMethods = root.SelectSingleNode("BaseMethods"); if (baseMethods != null) { foreach (XmlNode item in baseMethods) { if (item.InnerText.Trim().Length > 1 && item.InnerText.Trim().Substring(0, 1) == "<") { MessageBox.Show("定义文件内可能带有‘<--’"); } else { var b = new Method(item); BaseMethods.Add(b); } } } //CellMethods var cellMethods = root.SelectSingleNode("CellMethods"); if (cellMethods != null) { foreach (XmlNode item in cellMethods) { if (item.InnerText.Trim().Length > 1 && item.InnerText.Trim().Substring(0, 1) == "<") { MessageBox.Show("定义文件内可能带有‘<--’"); } else { var cell = new Method(item); CellMethods.Add(cell); } } } }