private void ProcessCommandLineOptions(Action <string, BaseUtils.CommandArgs, bool> getopt) // go thru command line.. { string[] cmdlineopts = Environment.GetCommandLineArgs().ToArray(); BaseUtils.CommandArgs ca = new BaseUtils.CommandArgs(cmdlineopts, 1); //System.Diagnostics.Debug.WriteLine("Command Line:"); while (ca.More) { getopt(ca.Next().ToLowerInvariant(), ca, false); } }
private void ProcessOptionFile(string filepath, Action <string, BaseUtils.CommandArgs, bool> getopt) // read file and process options { //System.Diagnostics.Debug.WriteLine("Read File " + filepath); foreach (string line in File.ReadAllLines(filepath)) { if (!line.IsEmpty()) { //string[] cmds = line.Split(new char[] { ' ' }, 2).Select(s => s.Trim()).ToArray(); // old version.. string[] cmds = BaseUtils.StringParser.ParseWordList(line, separ: ' ').ToArray(); BaseUtils.CommandArgs ca = new BaseUtils.CommandArgs(cmds); getopt("-" + ca.Next().ToLowerInvariant(), ca, true); } } }