Beispiel #1
0
        private static void OutputHtml(Project project, XmlOutputter xmlOutputter, Options options)
        {
            StageStopwatch.Restart();
            Report.NewStatus("Generating htmls... ");

            var reader = CreateSourceXml(project, options);

            var preProcess       = new XsltRunner(Path.Combine(EnvVar.ExecPath, "themes", options.ThemeName, "main_pre.xslt"));
            var preProcessResult = preProcess.Run(xmlOutputter.XDocument, Path.GetFullPath(options.OutputDirectory));

            if (options.SaveXmls)
            {
                preProcessResult.Save(EnvVar.XmlOutputPath(options.OutputDirectory, "documentation_file.xml"));
            }

            var htmlOutputter = new XsltRunner(Path.Combine(EnvVar.ExecPath, "themes", options.ThemeName, "main.xslt"));

            htmlOutputter.Run(
                preProcessResult.ToXDocument(),
                Path.GetFullPath(options.OutputDirectory) + EnvVar.Slash,
                new KeyValuePair <string, object>("verbose", Report.Verbose),
                new KeyValuePair <string, object>("source", reader));

            SaveTiming("html-output", StageStopwatch.ElapsedMilliseconds);
            Report.ContinueStatus("Done");
        }
Beispiel #2
0
        private static XmlOutputter GetXmlOutputter(Project project, XElement xmlInformation)
        {
            StageStopwatch.Restart();
            Report.NewStatus("Generating xml... ");
            var xmlOutputter = new XmlOutputter(project.XEle(xmlInformation));

            SaveTiming("xml-generation", StageStopwatch.ElapsedMilliseconds);
            Report.ContinueStatus("Done");
            return(xmlOutputter);
        }
Beispiel #3
0
        private static Project GetProject(IEnumerable <string> sourceFiles, bool runInSerial)
        {
            StageStopwatch.Restart();
            Report.NewStatus("Analysing project block structure... ");
            var proj = ProgramHelper.ParseProject(sourceFiles, runInSerial);

            SaveTiming("project-parsing", StageStopwatch.ElapsedMilliseconds);
            Report.ContinueStatus("Done");
            return(proj);
        }
Beispiel #4
0
        private static void OutputTheme(Options options)
        {
            StageStopwatch.Restart();
            Report.NewStatus("Outputting theme files... ");
            var themeParts     = DocumentationManager.RequiredThemeParts(options.SourceFilePaths.Select(Path.GetExtension));
            var themeOutputter = new AssetOutputter(themeParts);

            themeOutputter.Output(options.OverwriteExisting, options.OutputDirectory, options.ProjectFilePath, options.ThemeName, options.CopyPaths, options.CopyAndParsePaths);

            SaveTiming("theme-output", StageStopwatch.ElapsedMilliseconds);
            Report.ContinueStatus("Done");
        }
Beispiel #5
0
        public static int Main(string[] args)
        {
#if DEBUG
            Report.SetDebugProfile();
#endif

#if !DEBUG
            AppDomain.CurrentDomain.UnhandledException += UnhandledExceptionTrapper;
            Report.SetReleaseProfile();
#endif

            TotalStopwatch.Restart();
            StageStopwatch.Restart();
            var options = new Options();
            GetCommandLineOptions(args, options);
            GetOptions(options.ProjectFilePath ?? EnvVar.DefaultInfoPath, options);
            Report.Verbose = options.Verbose;
            SaveTiming("options-parsing", StageStopwatch.ElapsedMilliseconds);

            var project = GetProject(options.SourceFilePaths, options.RunInSerial);

            var xmlOutputter = GetXmlOutputter(project, new XElement("Information", options.XmlInformation));
            if (options.SaveXmls)
            {
                xmlOutputter.SaveToDisk(EnvVar.XmlOutputPath(options.OutputDirectory, "project.xml"));
            }

            if (options.NoOutput)
            {
                return(0);
            }

            OutputTheme(options);
            OutputHtml(project, xmlOutputter, options);

            SaveTiming("total", TotalStopwatch.ElapsedMilliseconds);
            if (options.TimeOutput)
            {
                Directory.CreateDirectory(EnvVar.XmlOutputPath(options.OutputDirectory));
                TimingXml.Save(EnvVar.XmlOutputPath(options.OutputDirectory, "timings.xml"));
            }

            Report.NewStatus($@"Documentation can be found at '{Path.GetFullPath(options.OutputDirectory)}'");
            Report.NewStatus("Documentation generation complete.\n");
            return(0);
        }