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 SerializeInterfaces(HeliosInterfaceCollection interfaces, XmlWriter xmlWriter) { xmlWriter.WriteStartElement("Interfaces"); foreach (HeliosInterface heliosInterface in interfaces) { SerializeInterface(heliosInterface, xmlWriter); } xmlWriter.WriteEndElement(); // Interfaces }
private ProfileExplorerTreeItem(string name, HeliosInterfaceCollection interfaces, ProfileExplorerTreeItem parent, ProfileExplorerTreeItemType includeTypes) : this(name, "", parent, includeTypes) { _itemType = ProfileExplorerTreeItemType.Folder; foreach (HeliosInterface heliosInterface in interfaces) { ProfileExplorerTreeItem item = new ProfileExplorerTreeItem(heliosInterface, this, includeTypes); Children.Add(item); } }
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(); } }