예제 #1
0
 private CmdletParameterMetadataForStaticMethodParameter Read8_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.id18_Item) || (type.Namespace != this.id2_Item)))
     {
         throw base.CreateUnknownTypeException(type);
     }
     if (flag)
     {
         return null;
     }
     CmdletParameterMetadataForStaticMethodParameter o = new CmdletParameterMetadataForStaticMethodParameter();
     string[] a = null;
     int index = 0;
     bool[] flagArray = new bool[15];
     while (base.Reader.MoveToNextAttribute())
     {
         if ((!flagArray[9] && (base.Reader.LocalName == this.id46_IsMandatory)) && (base.Reader.NamespaceURI == this.id4_Item))
         {
             o.IsMandatory = XmlConvert.ToBoolean(base.Reader.Value);
             o.IsMandatorySpecified = true;
             flagArray[9] = true;
         }
         else
         {
             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[11] && (base.Reader.LocalName == this.id48_PSName)) && (base.Reader.NamespaceURI == this.id4_Item))
             {
                 o.PSName = base.Reader.Value;
                 flagArray[11] = true;
             }
             else
             {
                 if ((!flagArray[12] && (base.Reader.LocalName == this.id49_Position)) && (base.Reader.NamespaceURI == this.id4_Item))
                 {
                     o.Position = base.CollapseWhitespace(base.Reader.Value);
                     flagArray[12] = true;
                     continue;
                 }
                 if ((!flagArray[13] && (base.Reader.LocalName == this.id50_ValueFromPipeline)) && (base.Reader.NamespaceURI == this.id4_Item))
                 {
                     o.ValueFromPipeline = XmlConvert.ToBoolean(base.Reader.Value);
                     o.ValueFromPipelineSpecified = true;
                     flagArray[13] = true;
                     continue;
                 }
                 if ((!flagArray[14] && (base.Reader.LocalName == this.id51_Item)) && (base.Reader.NamespaceURI == this.id4_Item))
                 {
                     o.ValueFromPipelineByPropertyName = XmlConvert.ToBoolean(base.Reader.Value);
                     o.ValueFromPipelineByPropertyNameSpecified = true;
                     flagArray[14] = true;
                     continue;
                 }
                 if (!base.IsXmlnsAttribute(base.Reader.Name))
                 {
                     base.UnknownNode(o, ":IsMandatory, :Aliases, :PSName, :Position, :ValueFromPipeline, :ValueFromPipelineByPropertyName");
                 }
             }
         }
     }
     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)
         {
             if ((!flagArray[0] && (base.Reader.LocalName == this.id54_AllowEmptyCollection)) && (base.Reader.NamespaceURI == this.id2_Item))
             {
                 o.AllowEmptyCollection = this.Read1_Object(false, true);
                 flagArray[0] = true;
             }
             else if ((!flagArray[1] && (base.Reader.LocalName == this.id55_AllowEmptyString)) && (base.Reader.NamespaceURI == this.id2_Item))
             {
                 o.AllowEmptyString = this.Read1_Object(false, true);
                 flagArray[1] = true;
             }
             else if ((!flagArray[2] && (base.Reader.LocalName == this.id56_AllowNull)) && (base.Reader.NamespaceURI == this.id2_Item))
             {
                 o.AllowNull = this.Read1_Object(false, true);
                 flagArray[2] = true;
             }
             else if ((!flagArray[3] && (base.Reader.LocalName == this.id57_ValidateNotNull)) && (base.Reader.NamespaceURI == this.id2_Item))
             {
                 o.ValidateNotNull = this.Read1_Object(false, true);
                 flagArray[3] = true;
             }
             else if ((!flagArray[4] && (base.Reader.LocalName == this.id58_ValidateNotNullOrEmpty)) && (base.Reader.NamespaceURI == this.id2_Item))
             {
                 o.ValidateNotNullOrEmpty = this.Read1_Object(false, true);
                 flagArray[4] = true;
             }
             else if ((!flagArray[5] && (base.Reader.LocalName == this.id59_ValidateCount)) && (base.Reader.NamespaceURI == this.id2_Item))
             {
                 o.ValidateCount = this.Read4_Item(false, true);
                 flagArray[5] = true;
             }
             else if ((!flagArray[6] && (base.Reader.LocalName == this.id60_ValidateLength)) && (base.Reader.NamespaceURI == this.id2_Item))
             {
                 o.ValidateLength = this.Read5_Item(false, true);
                 flagArray[6] = true;
             }
             else if ((!flagArray[7] && (base.Reader.LocalName == this.id61_ValidateRange)) && (base.Reader.NamespaceURI == this.id2_Item))
             {
                 o.ValidateRange = this.Read6_Item(false, true);
                 flagArray[7] = true;
             }
             else if ((base.Reader.LocalName == this.id62_ValidateSet) && (base.Reader.NamespaceURI == this.id2_Item))
             {
                 if (!base.ReadNull())
                 {
                     string[] strArray3 = null;
                     int num5 = 0;
                     if (base.Reader.IsEmptyElement)
                     {
                         base.Reader.Skip();
                     }
                     else
                     {
                         base.Reader.ReadStartElement();
                         base.Reader.MoveToContent();
                         int num6 = 0;
                         int num7 = base.ReaderCount;
                         while ((base.Reader.NodeType != XmlNodeType.EndElement) && (base.Reader.NodeType != XmlNodeType.None))
                         {
                             if (base.Reader.NodeType == XmlNodeType.Element)
                             {
                                 if ((base.Reader.LocalName == this.id63_AllowedValue) && (base.Reader.NamespaceURI == this.id2_Item))
                                 {
                                     strArray3 = (string[]) base.EnsureArrayIndex(strArray3, num5, typeof(string));
                                     strArray3[num5++] = base.Reader.ReadElementString();
                                 }
                                 else
                                 {
                                     base.UnknownNode(null, "http://schemas.microsoft.com/cmdlets-over-objects/2009/11:AllowedValue");
                                 }
                             }
                             else
                             {
                                 base.UnknownNode(null, "http://schemas.microsoft.com/cmdlets-over-objects/2009/11:AllowedValue");
                             }
                             base.Reader.MoveToContent();
                             base.CheckReaderCount(ref num6, ref num7);
                         }
                         base.ReadEndElement();
                     }
                     o.ValidateSet = (string[]) base.ShrinkArray(strArray3, num5, typeof(string), false);
                 }
             }
             else
             {
                 base.UnknownNode(o, "http://schemas.microsoft.com/cmdlets-over-objects/2009/11:AllowEmptyCollection, http://schemas.microsoft.com/cmdlets-over-objects/2009/11:AllowEmptyString, http://schemas.microsoft.com/cmdlets-over-objects/2009/11:AllowNull, http://schemas.microsoft.com/cmdlets-over-objects/2009/11:ValidateNotNull, http://schemas.microsoft.com/cmdlets-over-objects/2009/11:ValidateNotNullOrEmpty, http://schemas.microsoft.com/cmdlets-over-objects/2009/11:ValidateCount, http://schemas.microsoft.com/cmdlets-over-objects/2009/11:ValidateLength, http://schemas.microsoft.com/cmdlets-over-objects/2009/11:ValidateRange, http://schemas.microsoft.com/cmdlets-over-objects/2009/11:ValidateSet");
             }
         }
         else
         {
             base.UnknownNode(o, "http://schemas.microsoft.com/cmdlets-over-objects/2009/11:AllowEmptyCollection, http://schemas.microsoft.com/cmdlets-over-objects/2009/11:AllowEmptyString, http://schemas.microsoft.com/cmdlets-over-objects/2009/11:AllowNull, http://schemas.microsoft.com/cmdlets-over-objects/2009/11:ValidateNotNull, http://schemas.microsoft.com/cmdlets-over-objects/2009/11:ValidateNotNullOrEmpty, http://schemas.microsoft.com/cmdlets-over-objects/2009/11:ValidateCount, http://schemas.microsoft.com/cmdlets-over-objects/2009/11:ValidateLength, http://schemas.microsoft.com/cmdlets-over-objects/2009/11:ValidateRange, http://schemas.microsoft.com/cmdlets-over-objects/2009/11:ValidateSet");
         }
         base.Reader.MoveToContent();
         base.CheckReaderCount(ref whileIterations, ref readerCount);
     }
     o.Aliases = (string[]) base.ShrinkArray(a, index, typeof(string), true);
     base.ReadEndElement();
     return o;
 }
예제 #2
0
 private ParameterMetadata GetParameter(string parameterSetName, string objectModelParameterName, TypeMetadata parameterType, CmdletParameterMetadataForStaticMethodParameter parameterCmdletization)
 {
     return this.GetParameter(parameterSetName, objectModelParameterName, parameterType, parameterCmdletization, ((parameterCmdletization != null) && parameterCmdletization.ValueFromPipelineSpecified) && parameterCmdletization.ValueFromPipeline, ((parameterCmdletization != null) && parameterCmdletization.ValueFromPipelineByPropertyNameSpecified) && parameterCmdletization.ValueFromPipelineByPropertyName);
 }
예제 #3
0
 private void Write8_Item(string n, string ns, CmdletParameterMetadataForStaticMethodParameter o, bool isNullable, bool needType)
 {
     if (o == null)
     {
         if (isNullable)
         {
             base.WriteNullTagLiteral(n, ns);
         }
     }
     else
     {
         if (!needType && !(o.GetType() == typeof(CmdletParameterMetadataForStaticMethodParameter)))
         {
             throw base.CreateUnknownTypeException(o);
         }
         base.WriteStartElement(n, ns, o, false, null);
         if (needType)
         {
             base.WriteXsiType("CmdletParameterMetadataForStaticMethodParameter", "http://schemas.microsoft.com/cmdlets-over-objects/2009/11");
         }
         if (o.IsMandatorySpecified)
         {
             base.WriteAttribute("IsMandatory", "", XmlConvert.ToString(o.IsMandatory));
         }
         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();
         }
         base.WriteAttribute("PSName", "", o.PSName);
         base.WriteAttribute("Position", "", o.Position);
         if (o.ValueFromPipelineSpecified)
         {
             base.WriteAttribute("ValueFromPipeline", "", XmlConvert.ToString(o.ValueFromPipeline));
         }
         if (o.ValueFromPipelineByPropertyNameSpecified)
         {
             base.WriteAttribute("ValueFromPipelineByPropertyName", "", XmlConvert.ToString(o.ValueFromPipelineByPropertyName));
         }
         this.Write1_Object("AllowEmptyCollection", "http://schemas.microsoft.com/cmdlets-over-objects/2009/11", o.AllowEmptyCollection, false, false);
         this.Write1_Object("AllowEmptyString", "http://schemas.microsoft.com/cmdlets-over-objects/2009/11", o.AllowEmptyString, false, false);
         this.Write1_Object("AllowNull", "http://schemas.microsoft.com/cmdlets-over-objects/2009/11", o.AllowNull, false, false);
         this.Write1_Object("ValidateNotNull", "http://schemas.microsoft.com/cmdlets-over-objects/2009/11", o.ValidateNotNull, false, false);
         this.Write1_Object("ValidateNotNullOrEmpty", "http://schemas.microsoft.com/cmdlets-over-objects/2009/11", o.ValidateNotNullOrEmpty, false, false);
         this.Write4_Item("ValidateCount", "http://schemas.microsoft.com/cmdlets-over-objects/2009/11", o.ValidateCount, false, false);
         this.Write5_Item("ValidateLength", "http://schemas.microsoft.com/cmdlets-over-objects/2009/11", o.ValidateLength, false, false);
         this.Write6_Item("ValidateRange", "http://schemas.microsoft.com/cmdlets-over-objects/2009/11", o.ValidateRange, false, false);
         string[] validateSet = o.ValidateSet;
         if (validateSet != null)
         {
             base.WriteStartElement("ValidateSet", "http://schemas.microsoft.com/cmdlets-over-objects/2009/11", null, false);
             for (int j = 0; j < validateSet.Length; j++)
             {
                 base.WriteElementString("AllowedValue", "http://schemas.microsoft.com/cmdlets-over-objects/2009/11", validateSet[j]);
             }
             base.WriteEndElement();
         }
         bool isMandatorySpecified = o.IsMandatorySpecified;
         bool valueFromPipelineSpecified = o.ValueFromPipelineSpecified;
         bool valueFromPipelineByPropertyNameSpecified = o.ValueFromPipelineByPropertyNameSpecified;
         base.WriteEndElement(o);
     }
 }