public override bool Execute() { if (!base.Execute()) { return(false); } BuildProject project = null; try { BuildDocumenter documenter = new BuildDocumenter(); documenter.DocumentFile = new BuildFilePath(this.SandcastleFile); documenter.Load(); if (documenter.IsEmpty) { this.Log.LogError(null, String.Empty, String.Empty, "Error", 0, 0, 0, 0, "The documentation is empty or has no valid content."); return(false); } BuildSettings settings = documenter.Settings; string outputPath = this.OutputPath; if (!String.IsNullOrEmpty(outputPath)) { Directory.CreateDirectory(outputPath); settings.WorkingDirectory = new BuildDirectoryPath(outputPath); } IList <string> loggers = this.Loggers; if (loggers != null && loggers.Count != 0) { BuildLogging logging = settings.Logging; for (int i = 0; i < loggers.Count; i++) { string logger = loggers[i]; if (!String.IsNullOrEmpty(logger)) { logging.AddLogger(logger); } } } // Create the project, with the documentation data, the type // of system and the type of build... project = new BuildProject(documenter, BuildSystem.MSBuild, Sandcastle.BuildType.Testing); // Initialize the project, if successful, build it... project.Initialize(this.BuildLogger); if (project.IsInitialized) { return(project.Build()); } else { this.Log.LogError(null, String.Empty, String.Empty, "Error", 0, 0, 0, 0, "Error in reference build initialization."); return(false); } } catch (Exception ex) { #if DEBUG this.Log.LogErrorFromException(ex, true); #else this.Log.LogErrorFromException(ex, false); #endif return(false); } finally { // Finally, un-initialize the project and dispose it... if (project != null) { project.Uninitialize(); project.Dispose(); project = null; } } }
public void Create() { bool useCustomStyles = true; BuildStyleType styleType = BuildStyleType.ClassicWhite; _settings.WorkingDirectory = new BuildDirectoryPath(_workingDir); _settings.CleanIntermediate = false; _settings.ShowPreliminary = true; _settings.Style.StyleType = styleType; //_settings.SyntaxType = BuildSyntaxType.None; _settings.HeaderText = "Header: This is the header text."; _settings.FooterText = "Footer: This is the footer text."; BuildFeedback feedBack = _settings.Feedback; feedBack.CompanyName = "Sandcastle Assist"; feedBack.ProductName = "Sandcastle Helpers"; feedBack.EmailAddress = "*****@*****.**"; feedBack.FeedbackType = BuildFeedbackType.None; feedBack.CopyrightText = "Copyright © 2007-2008 Sandcastle Assist. All Rights Reserved."; feedBack.CopyrightLink = "http://www.codeplex.com/SandAssist"; // Configure the logo image information... feedBack.LogoEnabled = true; // show it... feedBack.LogoImage = new BuildFilePath(Path.Combine(_sandAssistDir, "AssistLogo.jpg")); feedBack.LogoWidth = 64; feedBack.LogoHeight = 64; feedBack.LogoPadding = 3; feedBack.LogoText = "Sandcastle Assist"; feedBack.LogoLink = "http://www.codeplex.com/SandAssist"; feedBack.LogoAlignment = BuildLogoAlignment.Center; feedBack.LogoPlacement = BuildLogoPlacement.Right; // Configure the logging, we add some loggers by their names... BuildLogging logging = _settings.Logging; //logging.Verbosity = BuildLoggerVerbosity.Detailed; //logging.AddLogger(XmlLogger.LoggerName); //logging.AddLogger(HtmlLogger.LoggerName); ///logging.AddLogger(XamlLogger.LoggerName); logging.AddLogger(ConsoleLogger.LoggerName); BuildStyle style = _settings.Style; // Add direct code snippet root folder... SnippetContent snippets = style.Snippets; snippets.Add(new SnippetItem( Path.Combine(_sampleDir, "SampleSnippets"))); // Add some custom math packages and commands... MathPackageContent mathPackages = style.MathPackages; mathPackages.Add("picture", "calc"); mathPackages.Add("xy", "all", "knot", "poly"); MathCommandContent mathCommands = style.MathCommands; mathCommands.Add(@"\quot", @"\dfrac{\varphi \cdot X_{n, #1}}{\varphi_{#2} \times \varepsilon_{#1}}", 2); mathCommands.Add(@"\exn", @"(x+\varepsilon_{#1})^{#1}", 1); if (useCustomStyles) { string stylesDir = @"Presentations"; stylesDir = Path.GetFullPath(stylesDir); if (Directory.Exists(stylesDir)) { _settings.Style.Directory = new BuildDirectoryPath(stylesDir); } } FormatChm chmFormat = _settings.Formats[BuildFormatType.HtmlHelp1] as FormatChm; if (chmFormat != null) { chmFormat.Enabled = true; chmFormat.UseBinaryToc = false; chmFormat.Indent = true; } //FormatHxs hxsFormat = // _settings.Formats[BuildFormatType.HtmlHelp2] as FormatHxs; //if (hxsFormat != null) //{ // //hxsFormat.SeparateIndexFile = true; // hxsFormat.Enabled = true; // hxsFormat.Indent = true; //} //FormatMhv mhvFormat = // _settings.Formats[BuildFormatType.HtmlHelp3] as FormatMhv; //if (mhvFormat != null) //{ // mhvFormat.Enabled = true; // mhvFormat.Indent = true; //} //FormatWeb webFormat = // _settings.Formats[BuildFormatType.WebHelp] as FormatWeb; //if (webFormat != null) //{ // webFormat.Enabled = true; // webFormat.Indent = true; //} //_settings.HelpName = "HelpRegister"; //_settings.HelpTitle = "Sandcastle HelpRegister"; _settings.HelpName = "SandcastleHelpers"; _settings.HelpTitle = "Sandcastle Helpers Test Sample"; }