Beispiel #1
0
 private static MethodParameterBindings GetMethodParameterKind(StaticMethodParameterMetadata methodParameter)
 {
     MethodParameterBindings bindings = 0;
     if (methodParameter.CmdletParameterMetadata != null)
     {
         bindings |= MethodParameterBindings.In;
     }
     if (methodParameter.CmdletOutputMetadata == null)
     {
         return bindings;
     }
     if (methodParameter.CmdletOutputMetadata.ErrorCode == null)
     {
         return (bindings | MethodParameterBindings.Out);
     }
     return (bindings | MethodParameterBindings.Error);
 }
 private void Write26_StaticMethodParameterMetadata(string n, string ns, StaticMethodParameterMetadata o, bool isNullable, bool needType)
 {
     if (o == null)
     {
         if (isNullable)
         {
             base.WriteNullTagLiteral(n, ns);
         }
     }
     else
     {
         if (!needType && !(o.GetType() == typeof(StaticMethodParameterMetadata)))
         {
             throw base.CreateUnknownTypeException(o);
         }
         base.WriteStartElement(n, ns, o, false, null);
         if (needType)
         {
             base.WriteXsiType("StaticMethodParameterMetadata", "http://schemas.microsoft.com/cmdlets-over-objects/2009/11");
         }
         base.WriteAttribute("ParameterName", "", o.ParameterName);
         base.WriteAttribute("DefaultValue", "", o.DefaultValue);
         this.Write2_TypeMetadata("Type", "http://schemas.microsoft.com/cmdlets-over-objects/2009/11", o.Type, false, false);
         this.Write8_Item("CmdletParameterMetadata", "http://schemas.microsoft.com/cmdlets-over-objects/2009/11", o.CmdletParameterMetadata, false, false);
         this.Write22_CmdletOutputMetadata("CmdletOutputMetadata", "http://schemas.microsoft.com/cmdlets-over-objects/2009/11", o.CmdletOutputMetadata, false, false);
         base.WriteEndElement(o);
     }
 }
 private StaticMethodParameterMetadata Read26_StaticMethodParameterMetadata(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.id28_StaticMethodParameterMetadata) || (type.Namespace != this.id2_Item)))
     {
         throw base.CreateUnknownTypeException(type);
     }
     if (flag)
     {
         return null;
     }
     StaticMethodParameterMetadata o = new StaticMethodParameterMetadata();
     bool[] flagArray = new bool[5];
     while (base.Reader.MoveToNextAttribute())
     {
         if ((!flagArray[1] && (base.Reader.LocalName == this.id87_ParameterName)) && (base.Reader.NamespaceURI == this.id4_Item))
         {
             o.ParameterName = base.Reader.Value;
             flagArray[1] = true;
         }
         else
         {
             if ((!flagArray[2] && (base.Reader.LocalName == this.id88_DefaultValue)) && (base.Reader.NamespaceURI == this.id4_Item))
             {
                 o.DefaultValue = base.Reader.Value;
                 flagArray[2] = true;
                 continue;
             }
             if (!base.IsXmlnsAttribute(base.Reader.Name))
             {
                 base.UnknownNode(o, ":ParameterName, :DefaultValue");
             }
         }
     }
     base.Reader.MoveToElement();
     if (base.Reader.IsEmptyElement)
     {
         base.Reader.Skip();
         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.id89_Type)) && (base.Reader.NamespaceURI == this.id2_Item))
             {
                 o.Type = this.Read2_TypeMetadata(false, true);
                 flagArray[0] = true;
             }
             else if ((!flagArray[3] && (base.Reader.LocalName == this.id11_CmdletParameterMetadata)) && (base.Reader.NamespaceURI == this.id2_Item))
             {
                 o.CmdletParameterMetadata = this.Read8_Item(false, true);
                 flagArray[3] = true;
             }
             else if ((!flagArray[4] && (base.Reader.LocalName == this.id29_CmdletOutputMetadata)) && (base.Reader.NamespaceURI == this.id2_Item))
             {
                 o.CmdletOutputMetadata = this.Read22_CmdletOutputMetadata(false, true);
                 flagArray[4] = true;
             }
             else
             {
                 base.UnknownNode(o, "http://schemas.microsoft.com/cmdlets-over-objects/2009/11:Type, http://schemas.microsoft.com/cmdlets-over-objects/2009/11:CmdletParameterMetadata, http://schemas.microsoft.com/cmdlets-over-objects/2009/11:CmdletOutputMetadata");
             }
         }
         else
         {
             base.UnknownNode(o, "http://schemas.microsoft.com/cmdlets-over-objects/2009/11:Type, http://schemas.microsoft.com/cmdlets-over-objects/2009/11:CmdletParameterMetadata, http://schemas.microsoft.com/cmdlets-over-objects/2009/11:CmdletOutputMetadata");
         }
         base.Reader.MoveToContent();
         base.CheckReaderCount(ref whileIterations, ref readerCount);
     }
     base.ReadEndElement();
     return o;
 }
Beispiel #4
0
        private static MethodParameterBindings GetMethodParameterKind(StaticMethodParameterMetadata methodParameter)
        {
            Dbg.Assert(methodParameter != null, "Caller should verify methodParameter != null");

            MethodParameterBindings bindings = 0;
            if (methodParameter.CmdletParameterMetadata != null)
            {
                bindings |= MethodParameterBindings.In;
            }
            if (methodParameter.CmdletOutputMetadata != null)
            {
                if (methodParameter.CmdletOutputMetadata.ErrorCode == null)
                {
                    bindings |= MethodParameterBindings.Out;
                }
                else
                {
                    bindings |= MethodParameterBindings.Error;
                }
            }

            return bindings;
        }