public IEnumerable <string> DeserializeInterface(HeliosInterfaceCollection destination, XmlReader xmlReader) { string interfaceType = xmlReader.GetAttribute("TypeIdentifier"); ComponentUnsupportedSeverity unsupportedSeverity = ReadUnsupportedSeverity(xmlReader); HeliosInterface heliosInterface = (HeliosInterface)CreateNewObject("Interface", interfaceType, unsupportedSeverity); if (heliosInterface != null) { string name = xmlReader.GetAttribute("Name"); if (xmlReader.IsEmptyElement) { // don't read from empty XML element xmlReader.Read(); } else { xmlReader.ReadStartElement("Interface"); heliosInterface.ReadXml(xmlReader); xmlReader.ReadEndElement(); } heliosInterface.Name = name; heliosInterface.UnsupportedSeverity = unsupportedSeverity; destination.Add(heliosInterface); yield return($"loaded {heliosInterface.TypeIdentifier} {heliosInterface.Name}"); } else { xmlReader.Skip(); yield return("failed to load interface"); } }
public void DeserializeInterfaces(HeliosInterfaceCollection destination, XmlReader xmlReader) { if (!xmlReader.IsEmptyElement) { xmlReader.ReadStartElement("Interfaces"); while (xmlReader.NodeType != XmlNodeType.EndElement) { HeliosInterface heliosInterface = DeserializeInterface(xmlReader); if (heliosInterface != null) { destination.Add(heliosInterface); } } xmlReader.ReadEndElement(); } else { xmlReader.Read(); } }