예제 #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);
            }
        }
예제 #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);
            }
        }
예제 #3
0
        private static void Main(string[] args)
        {
            var options = new CommandLineOptions();

            try
            {
                var success = CommandLine.Parser.Default.ParseArguments(args, options);

                if (true)
                {
                    LoadReferences(options);

                    var assemblyPath    = options.AssemblyPath;
                    var config          = HttpConfigurationImporter.ImportConfiguration(assemblyPath);
                    var descriptions    = config.Services.GetApiExplorer().ApiDescriptions;
                    var outputGenerator = LoadOutputGenerator(options);

                    outputGenerator.GenerateIndex(descriptions, options);

                    foreach (var api in descriptions)
                    {
                        var sampleGenerator = config.GetHelpPageSampleGenerator();
                        var apiModel        = HelpPageConfigurationExtensions.GetHelpPageApiModel(config, api.GetFriendlyId());

                        if (apiModel != null)
                        {
                            outputGenerator.GenerateApiDetails(apiModel, options);
                        }
                    }
                }
            }
            catch (Exception e)
            {
                PrintException(e);
                Environment.Exit(-1);
            }
        }