private void Write2_VsixLanguagePack(string n, string ns, VsixLanguagePack o, bool isNullable, bool needType)
 {
     if (o == null)
     {
         if (!isNullable)
         {
             return;
         }
         this.WriteNullTagLiteral(n, ns);
     }
     else
     {
         if (!needType && !(o.GetType() == typeof(VsixLanguagePack)))
         {
             throw this.CreateUnknownTypeException((object)o);
         }
         this.WriteStartElement(n, ns, (object)o, false, (XmlSerializerNamespaces)null);
         if (needType)
         {
             this.WriteXsiType((string)null, "http://schemas.microsoft.com/developer/vsx-schema-lp/2010");
         }
         this.WriteAttribute("Version", "", o.Version);
         this.WriteElementString("LocalizedName", "http://schemas.microsoft.com/developer/vsx-schema-lp/2010", o.LocalizedName);
         this.WriteElementString("LocalizedDescription", "http://schemas.microsoft.com/developer/vsx-schema-lp/2010", o.LocalizedDescription);
         this.WriteElementString("MoreInfoUrl", "http://schemas.microsoft.com/developer/vsx-schema-lp/2010", o.MoreInfoUrl);
         this.WriteElementString("License", "http://schemas.microsoft.com/developer/vsx-schema-lp/2010", o.License);
         this.WriteEndElement((object)o);
     }
 }
コード例 #2
0
        private VsixLanguagePack Read2_VsixLanguagePack(bool isNullable, bool checkType)
        {
            XmlQualifiedName type = checkType ? this.GetXsiType() : (XmlQualifiedName)null;
            bool             flag = false;

            if (isNullable)
            {
                flag = this.ReadNull();
            }
            if (checkType && !(type == (XmlQualifiedName)null) && (type.Name != this.id3_Item || type.Namespace != this.id2_Item))
            {
                throw this.CreateUnknownTypeException(type);
            }
            if (flag)
            {
                return((VsixLanguagePack)null);
            }
            VsixLanguagePack vsixLanguagePack = new VsixLanguagePack();

            bool[] flagArray = new bool[5];
            while (this.Reader.MoveToNextAttribute())
            {
                if (!flagArray[4] && this.Reader.LocalName == this.id4_Version && this.Reader.NamespaceURI == this.id3_Item)
                {
                    vsixLanguagePack.Version = this.Reader.Value;
                    flagArray[4]             = true;
                }
                else if (!this.IsXmlnsAttribute(this.Reader.Name))
                {
                    this.UnknownNode((object)vsixLanguagePack, ":Version");
                }
            }
            this.Reader.MoveToElement();
            if (this.Reader.IsEmptyElement)
            {
                this.Reader.Skip();
                return(vsixLanguagePack);
            }
            else
            {
                this.Reader.ReadStartElement();
                int num1            = (int)this.Reader.MoveToContent();
                int whileIterations = 0;
                int readerCount     = this.ReaderCount;
                while (this.Reader.NodeType != XmlNodeType.EndElement && this.Reader.NodeType != XmlNodeType.None)
                {
                    if (this.Reader.NodeType == XmlNodeType.Element)
                    {
                        if (!flagArray[0] && this.Reader.LocalName == this.id5_LocalizedName && this.Reader.NamespaceURI == this.id2_Item)
                        {
                            vsixLanguagePack.LocalizedName = this.Reader.ReadElementString();
                            flagArray[0] = true;
                        }
                        else if (!flagArray[1] && this.Reader.LocalName == this.id6_LocalizedDescription && this.Reader.NamespaceURI == this.id2_Item)
                        {
                            vsixLanguagePack.LocalizedDescription = this.Reader.ReadElementString();
                            flagArray[1] = true;
                        }
                        else if (!flagArray[2] && this.Reader.LocalName == this.id7_MoreInfoUrl && this.Reader.NamespaceURI == this.id2_Item)
                        {
                            vsixLanguagePack.MoreInfoUrl = this.Reader.ReadElementString();
                            flagArray[2] = true;
                        }
                        else if (!flagArray[3] && this.Reader.LocalName == this.id8_License && this.Reader.NamespaceURI == this.id2_Item)
                        {
                            vsixLanguagePack.License = this.Reader.ReadElementString();
                            flagArray[3]             = true;
                        }
                        else
                        {
                            this.UnknownNode((object)vsixLanguagePack, "http://schemas.microsoft.com/developer/vsx-schema-lp/2010:LocalizedName, http://schemas.microsoft.com/developer/vsx-schema-lp/2010:LocalizedDescription, http://schemas.microsoft.com/developer/vsx-schema-lp/2010:MoreInfoUrl, http://schemas.microsoft.com/developer/vsx-schema-lp/2010:License");
                        }
                    }
                    else
                    {
                        this.UnknownNode((object)vsixLanguagePack, "http://schemas.microsoft.com/developer/vsx-schema-lp/2010:LocalizedName, http://schemas.microsoft.com/developer/vsx-schema-lp/2010:LocalizedDescription, http://schemas.microsoft.com/developer/vsx-schema-lp/2010:MoreInfoUrl, http://schemas.microsoft.com/developer/vsx-schema-lp/2010:License");
                    }
                    int num2 = (int)this.Reader.MoveToContent();
                    this.CheckReaderCount(ref whileIterations, ref readerCount);
                }
                this.ReadEndElement();
                return(vsixLanguagePack);
            }
        }