示例#1
0
        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");
            }
        }
示例#2
0
        public HeliosInterface DeserializeInterface(XmlReader xmlReader)
        {
            string          interfaceType   = xmlReader.GetAttribute("TypeIdentifier");
            HeliosInterface heliosInterface = (HeliosInterface)CreateNewObject("Interface", interfaceType);

            if (heliosInterface != null)
            {
                String name = xmlReader.GetAttribute("Name");
                if (xmlReader.IsEmptyElement)
                {
                    xmlReader.Read();
                }
                else
                {
                    xmlReader.ReadStartElement("Interface");
                    heliosInterface.ReadXml(xmlReader);
                    xmlReader.ReadEndElement();
                }
                heliosInterface.Name = name;
            }
            else
            {
                xmlReader.Skip();
            }

            return(heliosInterface);
        }