Exemplo n.º 1
0
 public SPParam this[string strName]
 {
     get
     {
         SPParam param = (SPParam)this.m_NameMap[strName];
         if (param == null)
         {
             param = (SPParam)this.m_ShortNameMap[strName];
         }
         return(param);
     }
 }
Exemplo n.º 2
0
        public virtual void Validate(StringDictionary keyValues)
        {
            string strMessage = null;

            //if (this.m_bTopLevelOperation)
            //{
            //    foreach (string str2 in keyValues.Keys)
            //    {
            //        if ((str2 != "o") && (this.Params[str2] == null))
            //        {
            //            strMessage = strMessage + SPResource.GetString("CommandLineErrorInvalidParameter", new object[0]) + "\n";
            //            break;
            //        }
            //    }
            //}
            //if (strMessage != null)
            //{
            //    throw new SPSyntaxException(strMessage);
            //}
            //strMessage = null;
            for (int i = 0; i < this.Params.Count; i++)
            {
                SPParam param = this.Params[i];
                if ((param.Enabled && param.IsRequired) && !param.UserTypedIn)
                {
                    strMessage = strMessage + SPResource.GetString("MissRequiredArg", new object[] { param.Name }) + "\n";
                }
            }
            if (strMessage != null)
            {
                throw new SPSyntaxException(strMessage);
            }
            strMessage = null;
            foreach (SPParam param2 in this.m_Params)
            {
                if ((param2.Enabled && param2.UserTypedIn) && !param2.Validate())
                {
                    strMessage = strMessage + SPResource.GetString("InvalidArg", new object[] { param2.Name });
                    if ((param2.HelpMessage != null) && (param2.HelpMessage != string.Empty))
                    {
                        strMessage = strMessage + "\n\t" + param2.HelpMessage;
                    }
                    strMessage = strMessage + "\n";
                }
            }
            if (strMessage != null)
            {
                throw new SPSyntaxException(strMessage);
            }
        }
Exemplo n.º 3
0
 public void Add(SPParam param)
 {
     this.m_Collection.Add(param);
     this.m_NameMap.Add(param.Name, param);
     this.m_ShortNameMap.Add(param.ShortName, param);
 }