//Method which will parse the string input and return a hashtable public static CommandLineOptions Parse(String[] args) { //Hashtable argTable = new Hashtable(); var options = new CommandLineOptions(); var normalizedArgs = NormalizeArguments(args); foreach (string argument in normalizedArgs) { string option = argument.Substring(1); string optionValue = string.Empty; int optoinSeparatorIndex = option.IndexOf(':'); if (optoinSeparatorIndex > 0) { optionValue = option.Substring(optoinSeparatorIndex + 1); option = option.Substring(0, optoinSeparatorIndex); } switch (option) { case "ProjectDir": options.ProjectDir = TrimQuotes(optionValue); break; case "OutputFileName": options.OutputFileName = optionValue; break; case "FileExtensions": options.FileExtensions = optionValue; break; case "Mode": options.Mode = optionValue; break; case "ProjectFile": options.ProjectFile = TrimQuotes(optionValue); break; case "GeneratesGroupList": options.GeneratesGroupList = true; options.ProjectDir = TrimQuotes(optionValue); break; case "ValidatesXmlFile": options.ValidatesXmlFile = true; break; case "XmlFilePath": options.XmlFilePath = optionValue; break; case "XmlSchemaFilePath": options.XmlSchemaFilePath = optionValue; break; default: break; } } return options; }
private static void GenerateList(CommandLineOptions options) { if (!string.IsNullOrEmpty(options.ProjectDir)) { ProjectDir = options.ProjectDir; } if (!string.IsNullOrEmpty(options.FileExtensions)) { FileExtensions = options.FileExtensions.Split(',').ToList(); } else { FileExtensions = new List<string>() { "xaml", "cs", "fx", "vb" }; } if (!string.IsNullOrEmpty(options.OutputFileName)) { OutputFileName = options.OutputFileName; } GetFilesRecursive(ProjectDir); WriteFilesListToXML(); }