예제 #1
0
 private PropertyQuery Read13_PropertyQuery(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.id34_PropertyQuery) || (type.Namespace != this.id2_Item)))
     {
         if ((type.Name != this.id35_WildcardablePropertyQuery) || (type.Namespace != this.id2_Item))
         {
             throw base.CreateUnknownTypeException(type);
         }
         return this.Read12_WildcardablePropertyQuery(isNullable, false);
     }
     if (flag)
     {
         return null;
     }
     PropertyQuery o = new PropertyQuery();
     bool[] flagArray = new bool[1];
     while (base.Reader.MoveToNextAttribute())
     {
         if (!base.IsXmlnsAttribute(base.Reader.Name))
         {
             base.UnknownNode(o);
         }
     }
     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.id11_CmdletParameterMetadata)) && (base.Reader.NamespaceURI == this.id2_Item))
             {
                 o.CmdletParameterMetadata = this.Read11_Item(false, true);
                 flagArray[0] = true;
             }
             else
             {
                 base.UnknownNode(o, "http://schemas.microsoft.com/cmdlets-over-objects/2009/11:CmdletParameterMetadata");
             }
         }
         else
         {
             base.UnknownNode(o, "http://schemas.microsoft.com/cmdlets-over-objects/2009/11:CmdletParameterMetadata");
         }
         base.Reader.MoveToContent();
         base.CheckReaderCount(ref whileIterations, ref readerCount);
     }
     base.ReadEndElement();
     return o;
 }
예제 #2
0
 private ParameterMetadata GenerateQueryClause(IEnumerable<string> commonParameterSets, IEnumerable<string> queryParameterSets, IEnumerable<string> methodParameterSets, string queryBuilderMethodName, PropertyMetadata property, PropertyQuery query, TextWriter output)
 {
     ParameterMetadata cmdletParameterMetadata = this.GetParameter(queryParameterSets, property.PropertyName, property.Type, query.CmdletParameterMetadata);
     WildcardablePropertyQuery query2 = query as WildcardablePropertyQuery;
     if ((query2 != null) && !cmdletParameterMetadata.SwitchParameter)
     {
         if (cmdletParameterMetadata.ParameterType == null)
         {
             cmdletParameterMetadata.ParameterType = typeof(object);
         }
         cmdletParameterMetadata.ParameterType = cmdletParameterMetadata.ParameterType.MakeArrayType();
     }
     this.GenerateIfBoundParameter(commonParameterSets, methodParameterSets, cmdletParameterMetadata, output);
     string str = (query2 == null) ? "__cmdletization_value" : "__cmdletization_values";
     if (query2 == null)
     {
         output.WriteLine("        [object]${0} = ${{{1}}}", str, CommandMetadata.EscapeVariableName(cmdletParameterMetadata.Name));
     }
     else
     {
         output.WriteLine("        ${0} = @(${{{1}}})", str, CommandMetadata.EscapeVariableName(cmdletParameterMetadata.Name));
     }
     output.Write("        $__cmdletization_queryBuilder.{0}('{1}', ${2}", queryBuilderMethodName, CommandMetadata.EscapeSingleQuotedString(property.PropertyName), str);
     if (query2 == null)
     {
         output.WriteLine(", '{0}')", GetBehaviorWhenNoMatchesFound(query.CmdletParameterMetadata));
     }
     else
     {
         bool flag = (!query2.AllowGlobbingSpecified && cmdletParameterMetadata.ParameterType.Equals(typeof(string[]))) || (query2.AllowGlobbingSpecified && query2.AllowGlobbing);
         output.WriteLine(", {0}, '{1}')", flag ? "$true" : "$false", GetBehaviorWhenNoMatchesFound(query.CmdletParameterMetadata));
     }
     output.WriteLine("    }");
     return cmdletParameterMetadata;
 }
예제 #3
0
 private void Write13_PropertyQuery(string n, string ns, PropertyQuery o, bool isNullable, bool needType)
 {
     if (o == null)
     {
         if (isNullable)
         {
             base.WriteNullTagLiteral(n, ns);
         }
     }
     else
     {
         if (!needType)
         {
             Type type = o.GetType();
             if (type != typeof(PropertyQuery))
             {
                 if (type != typeof(WildcardablePropertyQuery))
                 {
                     throw base.CreateUnknownTypeException(o);
                 }
                 this.Write12_WildcardablePropertyQuery(n, ns, (WildcardablePropertyQuery) o, isNullable, true);
                 return;
             }
         }
         base.WriteStartElement(n, ns, o, false, null);
         if (needType)
         {
             base.WriteXsiType("PropertyQuery", "http://schemas.microsoft.com/cmdlets-over-objects/2009/11");
         }
         this.Write11_Item("CmdletParameterMetadata", "http://schemas.microsoft.com/cmdlets-over-objects/2009/11", o.CmdletParameterMetadata, false, false);
         base.WriteEndElement(o);
     }
 }