static void Main(string[] args) { Console.WriteLine("*********************** Object Model Generator ***********************"); ICodeGenerator generator = null; // TODO: Try using Microsoft.CodeAnalysis.CommandLineParser var arg = ArgumentParser.Parse(args); if (arg.ContainsKey("format")) { if (arg["format"] == "image") { generator = new Generators.OMDGenerator(); } else if (arg["format"] == "html") { generator = new Generators.HtmlOmdGenerator(); } else { Console.WriteLine("Invalid format parameter."); WriteUsage(); return; } } else { generator = new Generators.HtmlOmdGenerator(); } if (!arg.ContainsKey("source")) { WriteUsage(); return; } GeneratorSettings.ShowPrivateMembers = arg.ContainsKey("ShowPrivate"); GeneratorSettings.ShowInternalMembers = arg.ContainsKey("ShowInternal"); string[] filters = arg.ContainsKey("filters") ? arg["filters"].Split(';', StringSplitOptions.RemoveEmptyEntries) : null; System.Text.RegularExpressions.Regex regexfilter = arg.ContainsKey("regexfilter") ? new System.Text.RegularExpressions.Regex(arg["filter"]) : null; string[] source = arg["source"].Split(';', StringSplitOptions.RemoveEmptyEntries); string[] oldSource = arg.ContainsKey("compareSource") ? arg["compareSource"].Split(';', StringSplitOptions.RemoveEmptyEntries) : null; string[] preprocessors = arg.ContainsKey("preprocessors") ? arg["preprocessors"].Split(';', StringSplitOptions.RemoveEmptyEntries) : null; var g = new Generator(generator); if (oldSource != null) { g.ProcessDiffs(oldSource, source, preprocessors, regexfilter, filters).Wait(); } else { g.Process(source, preprocessors, regexfilter, filters).Wait(); } Console.ReadKey(); }
static void Main(string[] args) { Console.WriteLine("*********************** Object Model Generator ***********************"); ICodeGenerator generator = null; var arg = ArgumentParser.Parse(args); if (arg.ContainsKey("format")) { if (arg["format"] == "image") { generator = new Generators.OMDGenerator(); } else if (arg["format"] == "html") { generator = new Generators.HtmlOmdGenerator(); } else { Console.WriteLine("Invalid format parameter."); WriteUsage(); return; } } else { generator = new Generators.HtmlOmdGenerator(); } if (!arg.ContainsKey("source")) { WriteUsage(); return; } GeneratorSettings.ShowPrivateMembers = arg.ContainsKey("ShowPrivate"); GeneratorSettings.ShowInternalMembers = arg.ContainsKey("ShowInternal"); string[] source = arg["source"].Split('|'); string[] oldSource = arg.ContainsKey("compareSource") ? arg["compareSource"].Split('|') : null; var g = new Generator(generator); if (oldSource != null) { g.ProcessDiffs(oldSource, source).Wait(); } else { g.Process(source).Wait(); } Console.ReadKey(); }