public static Options Parse(string[] args) { Options options = new Options(); foreach (string arg in args) { if (null == arg || 0 == arg.Length) continue; if (arg.StartsWith("-")) { if ("-vb" == arg) { options.VisualBasicOutput = true; } else { InvalidArgument(arg); } } else { if (null == options.SourceDir) { options.SourceDir = arg; } else { if (null != options.TargetDir) InvalidArgument(arg); options.TargetDir = arg; } } } return options; }
Program(Options options) { _options = options; }