Esempio n. 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;
     }
 }
Esempio n. 2
0
 private void Initialize()
 {
     _defaultSwitchOptions = new SwitchOptions(new List <char> {
         '/'
     }, new List <char> {
         ':'
     }, "[_A-Za-z]+[_A-Za-z0-9]*");
     _defaultTypeParserContainer = new DefaultTypeContainer();
     _defaultSwitchParser        = new SwitchParser(TypeParser, this);
     _helpOptions           = new HelpTextOptions(HelpTextLength, HelpTextIndentLength, HelpCommands);
     _defaultHelpTextParser = new BasicHelpTextParser(_helpOptions, TypeParser);
     _defaultArgMaker       = new DefaultArgumentCreator();
 }