예제 #1
0
 public ParamsObject(string[] args)
 {
     try
     {
         this.args             = args;
         _defaultSwitchOptions = new SwitchOptions(new List <char> {
             '/'
         }, new List <char> {
             ':'
         }, "[_A-Za-z]+[_A-Za-z0-9]*");
         _defaultTypeParser     = new PrimitiveParser();
         _defaultSwitchParser   = new SwitchParser(TypeParser, this);
         _helpOptions           = new HelpTextOptions(HelpTextLength, HelpTextIndentLength, HelpCommands);
         _defaultHelpTextParser = new BasicHelpTextParser(_helpOptions, TypeParser);
         if (GetHelpIfNeeded() == string.Empty)
         {
             SwitchParser.ParseSwitches(args);
         }
         _paramExceptionDictionary = new Dictionary <Func <bool>, string>();
         AddAdditionalParamChecks();
         foreach (var item in GetParamExceptionDictionary())
         {
             _paramExceptionDictionary.Add(item.Key, item.Value);
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
예제 #2
0
 private void PostInitialize()
 {
     if (GetHelpIfNeeded() == string.Empty)
     {
         SwitchParser.ParseSwitches(args);
     }
     _paramExceptionDictionary = new Dictionary <Func <bool>, string>();
     AddAdditionalParamChecks();
     foreach (var item in GetParamExceptionDictionary())
     {
         _paramExceptionDictionary.Add(item.Key, item.Value);
     }
 }