Esempio n. 1
0
 void System.Xml.Serialization.IXmlSerializable.ReadXml(System.Xml.XmlReader reader)
 {
     if (reader.MoveToAttribute("Name"))
     {
         _name = reader.ReadContentAsString();
     }
     if (reader.MoveToAttribute("LastWriteTime"))
     {
         _lastWriteTime = reader.ReadContentAsDateTime();
     }
     reader.MoveToElement();
     if (!reader.IsEmptyElement)
     {
         reader.ReadStartElement();
         var refs = new List <string>();
         while (reader.NodeType != System.Xml.XmlNodeType.EndElement)
         {
             if (reader.LocalName == "Reference")
             {
                 refs.Add(reader.ReadElementString());
             }
             else
             {
                 reader.Skip();
             }
         }
         this.References = refs.ToArray();
         reader.ReadEndElement();
     }
     else
     {
         reader.Skip();
     }
 }
Esempio n. 2
0
 void System.Xml.Serialization.IXmlSerializable.ReadXml(System.Xml.XmlReader reader)
 {
     if (reader.MoveToAttribute("Uid"))
     {
         this._uid = Guid.Parse(reader.ReadContentAsString());
     }
     if (reader.MoveToAttribute("CreateTime"))
     {
         this._createTime = reader.ReadContentAsDateTime();
     }
     reader.MoveToElement();
     reader.ReadStartElement();
     reader.ReadStartElement("AssemblyParts");
     while (reader.NodeType != System.Xml.XmlNodeType.EndElement)
     {
         if (reader.LocalName == "AssemblyPart")
         {
             AssemblyPart part = new AssemblyPart();
             ((System.Xml.Serialization.IXmlSerializable)part).ReadXml(reader);
             this._items.Add(part);
         }
         else
         {
             reader.Skip();
         }
     }
     reader.ReadEndElement();
 }
Esempio n. 3
0
        public static DateTimeOffset ReadDateTimeOffset(this System.Xml.XmlReader a)
        {
            a.ReadStartElement();
            a.ReadStartElement("DateTime");
            var b = a.ReadContentAsDateTime();

            a.ReadEndElement();
            a.ReadStartElement("OffsetMinutes");
            var c = (short)a.ReadContentAsInt();

            a.ReadEndElement();
            a.ReadEndElement();
            return(new DateTimeOffset(b, TimeSpan.FromMinutes(c)));
        }
Esempio n. 4
0
        public static DateTimeOffset ReadDateTimeOffset(this System.Xml.XmlReader reader)
        {
            reader.ReadStartElement();
            reader.ReadStartElement("DateTime");
            var dateTime = reader.ReadContentAsDateTime();

            reader.ReadEndElement();
            reader.ReadStartElement("OffsetMinutes");
            var offsetMinutes = (short)reader.ReadContentAsInt();

            reader.ReadEndElement();
            reader.ReadEndElement();
            return(new DateTimeOffset(dateTime, TimeSpan.FromMinutes(offsetMinutes)));
        }
Esempio n. 5
0
 /// <summary>
 /// Lê os dados serializados.
 /// </summary>
 /// <param name="reader"></param>
 void System.Xml.Serialization.IXmlSerializable.ReadXml(System.Xml.XmlReader reader)
 {
     if (reader.MoveToAttribute("name"))
     {
         Name = reader.ReadContentAsString();
     }
     if (reader.MoveToAttribute("startDate"))
     {
         StartDate = reader.ReadContentAsDateTime();
     }
     if (reader.MoveToAttribute("customization"))
     {
         CustomizationName = reader.ReadContentAsString();
     }
     if (reader.MoveToAttribute("type"))
     {
         var type = reader.ReadContentAsString();
         Type = !string.IsNullOrEmpty(type) ? new Reflection.TypeName(reader.ReadContentAsString()) : null;
     }
     reader.MoveToElement();
     if (!reader.IsEmptyElement)
     {
         reader.ReadStartElement();
         while (reader.NodeType != System.Xml.XmlNodeType.EndElement)
         {
             if (reader.LocalName == "Properties" && !reader.IsEmptyElement)
             {
                 reader.ReadStartElement();
                 while (reader.NodeType != System.Xml.XmlNodeType.EndElement)
                 {
                     if (reader.LocalName == "EntityTypeVersionProperty")
                     {
                         var property = new EntityTypeVersionProperty();
                         ((System.Xml.Serialization.IXmlSerializable)property).ReadXml(reader);
                         Properties.Add(property);
                     }
                     else
                     {
                         reader.Skip();
                     }
                 }
                 reader.ReadEndElement();
             }
             else if (reader.LocalName == "Events" && !reader.IsEmptyElement)
             {
                 reader.ReadStartElement();
                 while (reader.NodeType != System.Xml.XmlNodeType.EndElement)
                 {
                     if (reader.LocalName == "EntityTypeVersionEvent")
                     {
                         var versionEvent = new EntityTypeVersionEvent();
                         ((System.Xml.Serialization.IXmlSerializable)versionEvent).ReadXml(reader);
                         Events.Add(versionEvent);
                     }
                     else
                     {
                         reader.Skip();
                     }
                 }
                 reader.ReadEndElement();
             }
             else
             {
                 reader.Skip();
             }
         }
         reader.ReadEndElement();
     }
 }