Ejemplo n.º 1
0
 private StaticCmdletMetadataCmdletMetadata Read44_Item(bool isNullable, bool checkType)
 {
     XmlQualifiedName type = checkType ? base.GetXsiType() : null;
     bool flag = false;
     if (isNullable)
     {
         flag = base.ReadNull();
     }
     if ((checkType && (type != null)) && ((type.Name != this.id24_Item) || (type.Namespace != this.id2_Item)))
     {
         throw base.CreateUnknownTypeException(type);
     }
     if (flag)
     {
         return null;
     }
     StaticCmdletMetadataCmdletMetadata o = new StaticCmdletMetadataCmdletMetadata();
     string[] a = null;
     int index = 0;
     bool[] flagArray = new bool[6];
     while (base.Reader.MoveToNextAttribute())
     {
         if ((!flagArray[0] && (base.Reader.LocalName == this.id93_Verb)) && (base.Reader.NamespaceURI == this.id4_Item))
         {
             o.Verb = base.Reader.Value;
             flagArray[0] = true;
         }
         else
         {
             if ((!flagArray[1] && (base.Reader.LocalName == this.id94_Noun)) && (base.Reader.NamespaceURI == this.id4_Item))
             {
                 o.Noun = base.Reader.Value;
                 flagArray[1] = true;
                 continue;
             }
             if ((base.Reader.LocalName == this.id47_Aliases) && (base.Reader.NamespaceURI == this.id4_Item))
             {
                 string[] strArray2 = base.Reader.Value.Split(null);
                 for (int i = 0; i < strArray2.Length; i++)
                 {
                     a = (string[]) base.EnsureArrayIndex(a, index, typeof(string));
                     a[index++] = strArray2[i];
                 }
                 continue;
             }
             if ((!flagArray[3] && (base.Reader.LocalName == this.id22_ConfirmImpact)) && (base.Reader.NamespaceURI == this.id4_Item))
             {
                 o.ConfirmImpact = this.Read19_ConfirmImpact(base.Reader.Value);
                 o.ConfirmImpactSpecified = true;
                 flagArray[3] = true;
             }
             else
             {
                 if ((!flagArray[4] && (base.Reader.LocalName == this.id95_HelpUri)) && (base.Reader.NamespaceURI == this.id4_Item))
                 {
                     o.HelpUri = base.CollapseWhitespace(base.Reader.Value);
                     flagArray[4] = true;
                     continue;
                 }
                 if ((!flagArray[5] && (base.Reader.LocalName == this.id96_DefaultCmdletParameterSet)) && (base.Reader.NamespaceURI == this.id4_Item))
                 {
                     o.DefaultCmdletParameterSet = base.Reader.Value;
                     flagArray[5] = true;
                     continue;
                 }
                 if (!base.IsXmlnsAttribute(base.Reader.Name))
                 {
                     base.UnknownNode(o, ":Verb, :Noun, :Aliases, :ConfirmImpact, :HelpUri, :DefaultCmdletParameterSet");
                 }
             }
         }
     }
     base.Reader.MoveToElement();
     if (base.Reader.IsEmptyElement)
     {
         base.Reader.Skip();
         o.Aliases = (string[]) base.ShrinkArray(a, index, typeof(string), true);
         return o;
     }
     base.Reader.ReadStartElement();
     base.Reader.MoveToContent();
     int whileIterations = 0;
     int readerCount = base.ReaderCount;
     while ((base.Reader.NodeType != XmlNodeType.EndElement) && (base.Reader.NodeType != XmlNodeType.None))
     {
         if (base.Reader.NodeType == XmlNodeType.Element)
         {
             base.UnknownNode(o, "");
         }
         else
         {
             base.UnknownNode(o, "");
         }
         base.Reader.MoveToContent();
         base.CheckReaderCount(ref whileIterations, ref readerCount);
     }
     o.Aliases = (string[]) base.ShrinkArray(a, index, typeof(string), true);
     base.ReadEndElement();
     return o;
 }
Ejemplo n.º 2
0
 private void Write44_Item(string n, string ns, StaticCmdletMetadataCmdletMetadata o, bool isNullable, bool needType)
 {
     if (o == null)
     {
         if (isNullable)
         {
             base.WriteNullTagLiteral(n, ns);
         }
     }
     else
     {
         if (!needType && !(o.GetType() == typeof(StaticCmdletMetadataCmdletMetadata)))
         {
             throw base.CreateUnknownTypeException(o);
         }
         base.WriteStartElement(n, ns, o, false, null);
         if (needType)
         {
             base.WriteXsiType("StaticCmdletMetadataCmdletMetadata", "http://schemas.microsoft.com/cmdlets-over-objects/2009/11");
         }
         base.WriteAttribute("Verb", "", o.Verb);
         base.WriteAttribute("Noun", "", o.Noun);
         string[] aliases = o.Aliases;
         if (aliases != null)
         {
             base.Writer.WriteStartAttribute(null, "Aliases", "");
             for (int i = 0; i < aliases.Length; i++)
             {
                 string str = aliases[i];
                 if (i != 0)
                 {
                     base.Writer.WriteString(" ");
                 }
                 base.WriteValue(str);
             }
             base.Writer.WriteEndAttribute();
         }
         if (o.ConfirmImpactSpecified)
         {
             base.WriteAttribute("ConfirmImpact", "", this.Write19_ConfirmImpact(o.ConfirmImpact));
         }
         base.WriteAttribute("HelpUri", "", o.HelpUri);
         base.WriteAttribute("DefaultCmdletParameterSet", "", o.DefaultCmdletParameterSet);
         bool confirmImpactSpecified = o.ConfirmImpactSpecified;
         base.WriteEndElement(o);
     }
 }