Exemplo n.º 1
0
 /// <summary>
 /// Lê os dados serializados.
 /// </summary>
 /// <param name="reader"></param>
 void System.Xml.Serialization.IXmlSerializable.ReadXml(System.Xml.XmlReader reader)
 {
     if(reader.MoveToAttribute("uid"))
         Uid = Guid.Parse(reader.ReadContentAsString());
     if(reader.MoveToAttribute("name"))
         Name = reader.ReadContentAsString();
     reader.MoveToElement();
     if(!reader.IsEmptyElement)
     {
         reader.ReadStartElement();
         while (reader.NodeType != System.Xml.XmlNodeType.EndElement)
         {
             switch(reader.LocalName)
             {
             case "Description":
                 Description = reader.ReadElementContentAsString();
                 break;
             case "InputRules":
                 {
                     reader.ReadStartElement();
                     while (reader.NodeType != System.Xml.XmlNodeType.EndElement)
                     {
                         if(reader.LocalName == "InputRulesInputRulesGroup")
                         {
                             var inputRule = new InputRulesInputRulesGroup();
                             ((System.Xml.Serialization.IXmlSerializable)inputRule).ReadXml(reader);
                             InputRules.Add(inputRule);
                         }
                         else
                             reader.Skip();
                     }
                     reader.ReadEndElement();
                 }
                 break;
             default:
                 reader.Skip();
                 break;
             }
         }
         reader.ReadEndElement();
     }
     else
         reader.Skip();
 }
Exemplo n.º 2
0
 /// <summary>
 /// Lê os dados serializados.
 /// </summary>
 /// <param name="reader"></param>
 void System.Xml.Serialization.IXmlSerializable.ReadXml(System.Xml.XmlReader reader)
 {
     reader.MoveToElement();
     if (!reader.IsEmptyElement)
     {
         reader.ReadStartElement();
         while (reader.NodeType != System.Xml.XmlNodeType.EndElement)
         {
             if (reader.IsEmptyElement)
             {
                 reader.Skip();
                 continue;
             }
             if (reader.LocalName == "EntityTypes")
             {
                 reader.ReadStartElement();
                 while (reader.NodeType != System.Xml.XmlNodeType.EndElement)
                 {
                     if (reader.LocalName == "EntityType")
                     {
                         var type = new EntityType();
                         ((System.Xml.Serialization.IXmlSerializable)type).ReadXml(reader);
                         EntityTypes.Add(type);
                     }
                     else
                     {
                         reader.Skip();
                     }
                 }
                 reader.ReadEndElement();
             }
             else if (reader.LocalName == "PropertySettings")
             {
                 reader.ReadStartElement();
                 while (reader.NodeType != System.Xml.XmlNodeType.EndElement)
                 {
                     if (reader.LocalName == "PropertySetting")
                     {
                         var settings = new PropertySettings();
                         ((System.Xml.Serialization.IXmlSerializable)settings).ReadXml(reader);
                         PropertySettings.Add(settings);
                     }
                     else
                     {
                         reader.Skip();
                     }
                 }
                 reader.ReadEndElement();
             }
             else if (reader.LocalName == "ValidationTypes")
             {
                 reader.ReadStartElement();
                 while (reader.NodeType != System.Xml.XmlNodeType.EndElement)
                 {
                     if (reader.LocalName == "ValidationType")
                     {
                         var validationType = new ValidationType();
                         ((System.Xml.Serialization.IXmlSerializable)validationType).ReadXml(reader);
                         ValidationTypes.Add(validationType);
                     }
                     else
                     {
                         reader.Skip();
                     }
                 }
                 reader.ReadEndElement();
             }
             else if (reader.LocalName == "Validations")
             {
                 reader.ReadStartElement();
                 while (reader.NodeType != System.Xml.XmlNodeType.EndElement)
                 {
                     if (reader.LocalName == "Validation")
                     {
                         var validation = new Validation();
                         ((System.Xml.Serialization.IXmlSerializable)validation).ReadXml(reader);
                         Validations.Add(validation);
                     }
                     else
                     {
                         reader.Skip();
                     }
                 }
                 reader.ReadEndElement();
             }
             else if (reader.LocalName == "InputRules")
             {
                 reader.ReadStartElement();
                 while (reader.NodeType != System.Xml.XmlNodeType.EndElement)
                 {
                     if (reader.LocalName == "InputRules")
                     {
                         var inputRules = new InputRules();
                         ((System.Xml.Serialization.IXmlSerializable)inputRules).ReadXml(reader);
                         InputRules.Add(inputRules);
                     }
                     else
                     {
                         reader.Skip();
                     }
                 }
                 reader.ReadEndElement();
             }
             else if (reader.LocalName == "InputRulesGroups")
             {
                 reader.ReadStartElement();
                 while (reader.NodeType != System.Xml.XmlNodeType.EndElement)
                 {
                     if (reader.LocalName == "InputRulesGroup")
                     {
                         var inputRulesGroup = new InputRulesGroup();
                         ((System.Xml.Serialization.IXmlSerializable)inputRulesGroup).ReadXml(reader);
                         InputRulesGroups.Add(inputRulesGroup);
                     }
                     else
                     {
                         reader.Skip();
                     }
                 }
                 reader.ReadEndElement();
             }
             else if (reader.LocalName == "InputValidates")
             {
                 reader.ReadStartElement();
                 while (reader.NodeType != System.Xml.XmlNodeType.EndElement)
                 {
                     if (reader.LocalName == "InputValidate")
                     {
                         var validate = new InputValidate();
                         ((System.Xml.Serialization.IXmlSerializable)validate).ReadXml(reader);
                         InputValidates.Add(validate);
                     }
                     else
                     {
                         reader.Skip();
                     }
                 }
                 reader.ReadEndElement();
             }
             else
             {
                 reader.Skip();
             }
         }
         reader.ReadEndElement();
     }
 }