Beispiel #1
0
        private static void Main(string[] args)
        {
            var options = new CommandLineOptions();

            try
            {
                if (CommandLine.Parser.Default.ParseArguments(args, options))
                {
                    LoadReferences(options);

                    string                      assemblyPath    = options.AssemblyPath;
                    HttpConfiguration           config          = HttpConfigurationImporter.ImportConfiguration(assemblyPath);
                    Collection <ApiDescription> descriptions    = config.Services.GetApiExplorer().ApiDescriptions;
                    IOutputGenerator            outputGenerator = LoadOutputGenerator(options);

                    outputGenerator.GenerateIndex(descriptions);

                    foreach (var api in descriptions)
                    {
                        HelpPageSampleGenerator sampleGenerator = config.GetHelpPageSampleGenerator();
                        HelpPageApiModel        apiModel        = HelpPageConfigurationExtensions.GenerateApiModel(api, sampleGenerator);
                        if (apiModel != null)
                        {
                            outputGenerator.GenerateApiDetails(apiModel);
                        }
                    }
                }
            }
            catch (Exception e)
            {
                Console.WriteLine("Error: {0}", e.Message);
            }
        }
Beispiel #2
0
        private static void Main(string[] args)
        {
            var options = new CommandLineOptions();

            try
            {
                if (CommandLine.Parser.Default.ParseArguments(args, options))
                {
                    LoadReferences(options);

                    string            assemblyPath = options.AssemblyPath;
                    HttpConfiguration config       = HttpConfigurationImporter.ImportConfiguration(assemblyPath);

                    //Get the ApiExplorer instance, and bind our own XML doc provider to it
                    var explorer = (ApiExplorer)config.Services.GetApiExplorer();

                    if (!string.IsNullOrEmpty(options.XmlDocPath))
                    {
                        var docProvider = new XmlDocumentationProvider(options.XmlDocPath);
                        explorer.DocumentationProvider = docProvider;
                    }

                    //And extract our API documentation
                    Collection <ApiDescription> descriptions    = explorer.ApiDescriptions;
                    IOutputGenerator            outputGenerator = LoadOutputGenerator(options);

                    outputGenerator.GenerateIndex(descriptions);

                    foreach (var api in descriptions)
                    {
                        HelpPageSampleGenerator sampleGenerator = config.GetHelpPageSampleGenerator();
                        HelpPageApiModel        apiModel        = HelpPageConfigurationExtensions.GenerateApiModel(api, sampleGenerator);
                        if (apiModel != null)
                        {
                            outputGenerator.GenerateApiDetails(apiModel);
                        }
                    }
                }
            }
            catch (Exception e)
            {
                Console.WriteLine("Error: {0}", e.Message);
            }
        }