/// <summary> /// Override argument setting. /// It is not used in practice, mainly for unit test. /// </summary> /// <param name="cat">The argument category</param> /// <param name="argList">The free argument list</param> /// <param name="argDict">The constrained argument dict</param> /// <param name="configFilePath">The config file path</param> public Argument(ArgumentCategory cat, List <string> argList, Dictionary <string, string> argDict, string configFilePath) { Category = cat; FreeArgList = argList; ConstrainedArgDict = argDict; ConfigFilePath = configFilePath; }
/// <summary> /// Parameterized constructor for building the object instance with /// specified parameters. /// </summary> /// <param name="argument">The command line argument.</param> /// <param name="type">The argument type.</param> public ArgumentInfo(string argument, ArgumentCategory type) { this.Argument = argument; this.Category = type; }
static void Main(string[] args) { bool noNext = false; foreach (string arg in args) { counter++; /* * Categories */ if (category == ArgumentCategory.None) { if (args.Length <= counter) { noNext = true; } switch (arg) { case "help": if (noNext) { ArgumentOptions.Help(null, null); } category = ArgumentCategory.Help; break;; case "config": if (noNext) { ArgumentOptions.Config(null, null); } category = ArgumentCategory.Config; break;; case "mod": if (noNext) { ArgumentOptions.Mod(null, null); } category = ArgumentCategory.Mod; break;; case "run": category = ArgumentCategory.Run; break;; } if (category == ArgumentCategory.None) { showBasicUsage(); } } else { // mod category if (category == ArgumentCategory.Mod) { ArgumentOptions.Mod(arg, args); } // config category if (category == ArgumentCategory.Config) { ArgumentOptions.Config(arg, args); } // help category if (category == ArgumentCategory.Help) { ArgumentOptions.Help(arg, args); } } } if (counter == 0) { showBasicUsage(); } }