Пример #1
0
        internal string GetParameterType(string parameter, ulong parameterSetsBitmask)
        {
            if (this.IsAllParameterSet(parameterSetsBitmask))
            {
                PSParameterSet allParameterSet = this.GetAllParameterSet();
                if (allParameterSet != null)
                {
                    PSParameterInfo pSParameterInfo = null;
                    if (allParameterSet.Parameters.TryGetValue(parameter, out pSParameterInfo))
                    {
                        return(pSParameterInfo.Type);
                    }
                }
            }
            HashSet <string> parameterTypes = this.GetParameterTypes(parameter, parameterSetsBitmask);

            if (parameterTypes.Count != 1)
            {
                return(null);
            }
            else
            {
                return(parameterTypes.ElementAt <string>(0));
            }
        }
Пример #2
0
 public void VerifyMandatoryParameterAdded(IEnumerable <string> parameters, ulong parameterSetMask)
 {
     if (parameters.Count <string>() == 0)
     {
         parameterSetMask = (ulong)(~((long)-1 << (this.ParameterSets.Count & 63)));
     }
     if (parameterSetMask != 0)
     {
         List <int> .Enumerator enumerator = this.GetParameterSetsFromBitmask(parameterSetMask).GetEnumerator();
         try
         {
             while (enumerator.MoveNext())
             {
                 int            current = enumerator.Current;
                 PSParameterSet item    = this.ParameterSets[current];
                 bool           flag    = false;
                 Dictionary <string, PSParameterInfo> .KeyCollection.Enumerator enumerator1 = item.Parameters.Keys.GetEnumerator();
                 try
                 {
                     while (enumerator1.MoveNext())
                     {
                         string str = enumerator1.Current;
                         if (!item.Parameters[str].IsMandatory || parameters.Contains <string>(str))
                         {
                             continue;
                         }
                         flag = true;
                         break;
                     }
                 }
                 finally
                 {
                     enumerator1.Dispose();
                 }
                 if (flag)
                 {
                     continue;
                 }
                 return;
             }
             object[] cmdletName = new object[1];
             cmdletName[0] = this.CmdletName;
             throw new DataServiceException(0x190, ExceptionHelpers.GetDataServiceExceptionMessage(HttpStatusCode.BadRequest, Resources.MandatoryParameterMissing, cmdletName));
         }
         finally
         {
             enumerator.Dispose();
         }
         return;
     }
     else
     {
         return;
     }
 }