コード例 #1
0
 private void Write4_WorkHoursTimeZone(string n, string ns, WorkHoursTimeZone o, bool isNullable, bool needType)
 {
     if (o == null)
     {
         if (isNullable)
         {
             base.WriteNullTagLiteral(n, ns);
         }
         return;
     }
     if (!needType)
     {
         Type type = o.GetType();
         if (!(type == typeof(WorkHoursTimeZone)))
         {
             throw base.CreateUnknownTypeException(o);
         }
     }
     base.WriteStartElement(n, ns, o, false, null);
     if (needType)
     {
         base.WriteXsiType("WorkHoursTimeZone", "WorkingHours.xsd");
     }
     base.WriteElementStringRaw("Bias", "WorkingHours.xsd", XmlConvert.ToString(o.Bias));
     this.Write3_ZoneTransition("Standard", "WorkingHours.xsd", o.Standard, false, false);
     this.Write3_ZoneTransition("DaylightSavings", "WorkingHours.xsd", o.DaylightSavings, false, false);
     base.WriteElementString("Name", "WorkingHours.xsd", o.Name);
     base.WriteEndElement(o);
 }
        private WorkHoursTimeZone Read4_WorkHoursTimeZone(bool isNullable, bool checkType)
        {
            XmlQualifiedName xmlQualifiedName = checkType ? base.GetXsiType() : null;
            bool             flag             = false;

            if (isNullable)
            {
                flag = base.ReadNull();
            }
            if (checkType && !(xmlQualifiedName == null) && (xmlQualifiedName.Name != this.id10_WorkHoursTimeZone || xmlQualifiedName.Namespace != this.id2_WorkingHoursxsd))
            {
                throw base.CreateUnknownTypeException(xmlQualifiedName);
            }
            if (flag)
            {
                return(null);
            }
            WorkHoursTimeZone workHoursTimeZone = new WorkHoursTimeZone();

            bool[] array = new bool[4];
            while (base.Reader.MoveToNextAttribute())
            {
                if (!base.IsXmlnsAttribute(base.Reader.Name))
                {
                    base.UnknownNode(workHoursTimeZone);
                }
            }
            base.Reader.MoveToElement();
            if (base.Reader.IsEmptyElement)
            {
                base.Reader.Skip();
                return(workHoursTimeZone);
            }
            base.Reader.ReadStartElement();
            base.Reader.MoveToContent();
            int num         = 0;
            int readerCount = base.ReaderCount;

            while (base.Reader.NodeType != XmlNodeType.EndElement && base.Reader.NodeType != XmlNodeType.None)
            {
                if (base.Reader.NodeType == XmlNodeType.Element)
                {
                    if (!array[0] && base.Reader.LocalName == this.id11_Bias && base.Reader.NamespaceURI == this.id2_WorkingHoursxsd)
                    {
                        workHoursTimeZone.Bias = XmlConvert.ToInt32(base.Reader.ReadElementString());
                        array[0] = true;
                    }
                    else if (!array[1] && base.Reader.LocalName == this.id12_Standard && base.Reader.NamespaceURI == this.id2_WorkingHoursxsd)
                    {
                        workHoursTimeZone.Standard = this.Read3_ZoneTransition(false, true);
                        array[1] = true;
                    }
                    else if (!array[2] && base.Reader.LocalName == this.id13_DaylightSavings && base.Reader.NamespaceURI == this.id2_WorkingHoursxsd)
                    {
                        workHoursTimeZone.DaylightSavings = this.Read3_ZoneTransition(false, true);
                        array[2] = true;
                    }
                    else if (!array[3] && base.Reader.LocalName == this.id14_Name && base.Reader.NamespaceURI == this.id2_WorkingHoursxsd)
                    {
                        workHoursTimeZone.Name = base.Reader.ReadElementString();
                        array[3] = true;
                    }
                    else
                    {
                        base.UnknownNode(workHoursTimeZone, "WorkingHours.xsd:Bias, WorkingHours.xsd:Standard, WorkingHours.xsd:DaylightSavings, WorkingHours.xsd:Name");
                    }
                }
                else
                {
                    base.UnknownNode(workHoursTimeZone, "WorkingHours.xsd:Bias, WorkingHours.xsd:Standard, WorkingHours.xsd:DaylightSavings, WorkingHours.xsd:Name");
                }
                base.Reader.MoveToContent();
                base.CheckReaderCount(ref num, ref readerCount);
            }
            base.ReadEndElement();
            return(workHoursTimeZone);
        }