static async Task Main(string[] args) { Console.WriteLine("*********************** Object Model Generator ***********************"); var arg = ArgumentParser.Parse(args); List <ICodeGenerator> generators = new List <ICodeGenerator>(); if (arg.ContainsKey("format")) { var formats = arg["format"].Split(';', StringSplitOptions.RemoveEmptyEntries); foreach (var format in formats) { if (format == "md") { generators.Add(new Generators.MarkdownGenerator()); } else if (format == "html") { generators.Add(new Generators.HtmlOmdGenerator()); } else { Console.WriteLine("Invalid format parameter."); WriteUsage(); return; } } } if (!generators.Any()) { generators.Add(new Generators.HtmlOmdGenerator()); } if (!arg.ContainsKey("source") && !arg.ContainsKey("assemblies")) { WriteUsage(); return; } GeneratorSettings.ShowPrivateMembers = arg.ContainsKey("showPrivate"); GeneratorSettings.ShowInternalMembers = arg.ContainsKey("showInternal"); if (arg.ContainsKey("output")) { GeneratorSettings.OutputLocation = arg["output"]; } List <Regex> filters = arg.ContainsKey("exclude") ? arg["exclude"].Split(';', StringSplitOptions.RemoveEmptyEntries).Select(f => CreateFilter(f)).ToList() : new List <Regex>(); if (arg.ContainsKey("regexfilter")) { filters.Add(new Regex(arg["regexfilter"])); } string[] source = arg.ContainsKey("source") ? arg["source"].Split(';', StringSplitOptions.RemoveEmptyEntries) : new string[] { }; string[] oldSource = arg.ContainsKey("compareSource") ? arg["compareSource"].Split(';', StringSplitOptions.RemoveEmptyEntries) : null; string[] preprocessors = arg.ContainsKey("preprocessors") ? arg["preprocessors"].Split(';', StringSplitOptions.RemoveEmptyEntries) : null; string[] assemblies = arg.ContainsKey("assemblies") ? arg["assemblies"].Split(';', StringSplitOptions.RemoveEmptyEntries) : new string[] { }; string[] compareAssemblies = arg.ContainsKey("compareAssemblies") ? arg["compareAssemblies"].Split(';', StringSplitOptions.RemoveEmptyEntries) : null; string[] referenceAssemblies = arg.ContainsKey("referenceAssemblies") ? arg["referenceAssemblies"].Split(';', StringSplitOptions.RemoveEmptyEntries) : null; var g = new Generator(generators); //Set up output filename if (string.IsNullOrEmpty(GeneratorSettings.OutputLocation)) { GeneratorSettings.OutputLocation = "./"; } var fi = new System.IO.FileInfo(GeneratorSettings.OutputLocation); if (!fi.Directory.Exists) { throw new System.IO.DirectoryNotFoundException(fi.Directory.FullName); } if (fi.Attributes == System.IO.FileAttributes.Directory) { GeneratorSettings.OutputLocation = System.IO.Path.Combine(GeneratorSettings.OutputLocation, "OMD"); } if (oldSource != null || compareAssemblies != null) { await g.ProcessDiffs(oldSource, source, compareAssemblies, assemblies, preprocessors, filters.ToArray(), referenceAssemblies); } else { await g.Process(source, assemblies, preprocessors, filters.ToArray(), referenceAssemblies); } if (System.Diagnostics.Debugger.IsAttached) { Console.ReadKey(); } }