public void ReadData <T>(DataReadBase <T> dataRead) where T : XModule, new () { XmlNodeList nodeList = EXml.GetXmlNodeList(dataRead.xmlPath); for (int i = 0; i < nodeList.Count; i++) { XmlElement xe = nodeList.Item(i) as XmlElement; if (xe == null) { continue; } int key = xe.GetAttribute(dataRead.keyType.ToString()).ToInt32(); for (int j = 0; j < xe.Attributes.Count; j++) { string name = xe.Attributes[j].Name; string value = xe.Attributes[j].Value; dataRead.AppendAttribute(key, name, value); } } }
public void ReadDataExtend <T>(DataReadBase <T> dataRead) where T : XModule, new() { XmlNodeList nodeList = EXml.GetXmlNodeList(dataRead.xmlPath); for (int i = 0; i < nodeList.Count; i++) { XmlAttribute xa = (nodeList[i] as XmlElement).GetAttributeNode(dataRead.keyType.ToString()); if (xa == null) { continue; } int key = Convert.ToInt32(xa.InnerText); for (int k = 0; k < xa.ChildNodes.Count; i++) { XmlElement xe = (XmlElement)xa.ChildNodes[i]; string name = xe.Name; string value = xe.Value; dataRead.AppendAttribute(key, name, value); } } }