Esempio n. 1
0
        public ConsoleArgParser(ConsoleArgParserConfig config)
        {
            if (config == null)
            {
                throw new ArgumentNullException("config");
            }

            this.Config = config;
        }
Esempio n. 2
0
        public ConsoleArgParser(string commands, string commandShortNames = "")
        {
            this.Config                   = new ConsoleArgParserConfig();
            this.Config.Commands          = commands;
            this.Config.CommandShortNames = commandShortNames;

            if (!string.IsNullOrEmpty(commands) && !string.IsNullOrEmpty(commandShortNames))
            {
                var arr1 = commands.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
                var arr2 = commandShortNames.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);

                if (arr1.Length != arr2.Length)
                {
                    throw new ArgumentException("Commands and their shortnames do not match");
                }
            }
        }
Esempio n. 3
0
 public ConsoleArgParser()
 {
     this.Config = new ConsoleArgParserConfig();
 }