Beispiel #1
0
        /// <summary>
        /// Runs this instance.
        /// </summary>
        public void Run()
        {
            // Force loading of dynamics for RazorEngine
            bool loaded = typeof(Microsoft.CSharp.RuntimeBinder.Binder).Assembly != null;
            
            var clock = Stopwatch.StartNew();

            // New instance of a template context used by the RazorEngine
            var context = new TemplateContext
            {
                Config = Config,
                StyleManager = StyleManager,
            };

            // Setup the context based on the config and StyleManager
            context.Initialize();

            // Delete output directory first
            try
            {
                if (Directory.Exists(context.OutputDirectory))
                    Directory.Delete(context.OutputDirectory, true);
            } catch
            {
            }

            // Verify the validity of the style
            foreach (var styleName in Config.StyleNames)
            {
                Logger.Message("-------------------------------------------------------------------------------");
                Logger.Message("Generating documentation using [{0}] style", styleName);
                Logger.Message("-------------------------------------------------------------------------------");
                context.UseStyle(styleName);
                context.Parse(StyleDefinition.DefaultBootableTemplateName);
            }

            Logger.Message("Total time: {0:F1}s", clock.ElapsedMilliseconds / 1000.0f);
            //Logger.Message("Time for assembly processing: {0:F1}s", timeForModelProcessor/1000.0f);
            //Logger.Message("Time for writing content: {0:F1}s", timeForWriting/1000.0f);

            if ((Config.OutputType & OutputType.DocPak) != 0 )
                GenerateDocPak();
        }
Beispiel #2
0
        /// <summary>
        /// Runs this instance.
        /// </summary>
        public void Run()
        {
            var clock = Stopwatch.StartNew();

            var razorizer = new Razorizer(typeof (PageTemplateDoc)) { EnableDebug = true };

            // New instance of a template context used by the RazorEngine
            var context = new TemplateContext(razorizer)
            {
                Config = Config,
                StyleManager = StyleManager,
            };

            // Create web documentation
            if (Config.WebDocumentationUrl != null)
            {
                context.WebDocumentation = new WebDocumentation(Config.WebDocumentationUrl, Config.WebDocumentationLogin);
            }

            // Setup the context based on the config and StyleManager
            context.Initialize();

            // Verify the validity of the style
            foreach (var styleName in Config.StyleNames)
            {
                Logger.Message("-------------------------------------------------------------------------------");
                Logger.Message("Generating documentation using [{0}] style", styleName);
                Logger.Message("-------------------------------------------------------------------------------");
                context.UseStyle(styleName);
                context.Parse(StyleDefinition.DefaultBootableTemplateName);
            }

            Logger.Message("Total time: {0:F1}s", clock.ElapsedMilliseconds / 1000.0f);
            //Logger.Message("Time for assembly processing: {0:F1}s", timeForModelProcessor/1000.0f);
            //Logger.Message("Time for writing content: {0:F1}s", timeForWriting/1000.0f);

            if ((Config.OutputType & OutputType.DocPak) != 0 )
                GenerateDocPak();
        }