static void ReadFieldMapping(FieldMapping fm, XmlNode node) { fm.FieldName = node.Attributes["name"].Value; foreach (XmlNode child in node.ChildNodes) { if (child.Name == "source") { fm.SourceOffset = ParseInt(child.Attributes["offset"].Value, 0); fm.SourceSize = ParseInt(child.Attributes["size"].Value, 0); fm.SourceType = child.Attributes["type"].Value; } else if (child.Name == "property") { fm.PropertyName = child.Attributes["name"].Value; } } }
static void ReadDeviceTypeMapping(DeviceTypeMapping dm, XmlNode node) { dm.Name = node.Attributes["name"].Value; if (node.Attributes["offset"] != null) { dm.Offset = ParseInt(node.Attributes["offset"].Value, 0); } foreach (XmlNode child in node.ChildNodes) { if (child.Name == "field") { var fm = new FieldMapping(); ReadFieldMapping(fm, child); dm.FieldList.Add(fm); } } }