public override BuildStep CreateStep(BuildContext context, BuildStage stage, string workingDir) { if (context == null || context.Settings == null) { return(null); } BuildSettings settings = context.Settings; string helpDirectory = context.OutputDirectory; if (String.IsNullOrEmpty(workingDir)) { workingDir = context.WorkingDirectory; } string helpName = settings.HelpName; if (String.IsNullOrEmpty(helpName)) { helpName = "Documentation"; } string helpTitle = settings.HelpTitle; if (String.IsNullOrEmpty(helpTitle)) { helpTitle = helpName; } string helpFolder = this.OutputFolder; string helpPath = Path.Combine(helpDirectory, String.Format(@"{0}\index.htm", helpFolder)); // Case 2: Starting the default browser viewer... if (stage == BuildStage.StartViewer) { StepWebViewerStart viewerStart = new StepWebViewerStart( helpDirectory, helpPath); return(viewerStart); } // Case 3: Compiling the WebHelp help file... if (stage == BuildStage.Compilation) { string sandassistDir = settings.SandAssistDirectory; string webStyle = Path.Combine(sandassistDir, String.Format(@"Web\{0}\Themes\{1}", _framework, _theme)); if (!Directory.Exists(webStyle)) { return(null); } string tempOutputDir = Path.Combine(workingDir, helpFolder); string webHelpDir = Path.Combine(helpDirectory, helpFolder); BuildMultiStep listSteps = new BuildMultiStep(); listSteps.LogTitle = "Building document output format - " + this.Name; listSteps.LogTimeSpan = true; StepDirectoryCopy dirCopy = new StepDirectoryCopy(); dirCopy.LogTitle = String.Empty; dirCopy.Message = "Copying the format files to the help folder."; dirCopy.Recursive = true; dirCopy.Add(webStyle, Path.Combine(tempOutputDir, "webtheme")); listSteps.Add(dirCopy); string tocFile = context["$HelpTocFile"]; FormatWebOptions options = new FormatWebOptions(); options.HelpTitle = helpTitle; options.HelpTocFile = tocFile; options.ProjectName = helpName; options.WorkingDirectory = workingDir; options.HtmlDirectory = Path.Combine(workingDir, @"Output\" + this.FormatFolder); options.OutputDirectory = tempOutputDir; StepWebBuilder webBuilder = new StepWebBuilder(options, workingDir); webBuilder.Format = this; webBuilder.LogTitle = String.Empty; webBuilder.Message = "Creating the WebHelp files."; webBuilder.HelpDirectory = webHelpDir; listSteps.Add(webBuilder); // 3. Move the output html files to the help folder... StepDirectoryMove dirMove = new StepDirectoryMove(workingDir); dirMove.LogTitle = String.Empty; dirMove.Message = "Moving the output html files to the help folder."; dirMove.Add(options.OutputDirectory, webHelpDir); listSteps.Add(dirMove); return(listSteps); } return(null); }
public override BuildStep CreateStep(BuildContext context, BuildStage stage, string workingDir) { if (context == null || context.Settings == null) { return(null); } BuildSettings settings = context.Settings; string helpDirectory = context.OutputDirectory; if (String.IsNullOrEmpty(workingDir)) { workingDir = context.WorkingDirectory; } string helpName = settings.HelpName; if (String.IsNullOrEmpty(helpName)) { helpName = "Documentation"; } string helpTitle = settings.HelpTitle; if (String.IsNullOrEmpty(helpTitle)) { helpTitle = helpName; } string helpFolder = this.OutputFolder; string helpPath = Path.Combine(helpDirectory, String.Format(@"{0}\{1}.mshc", helpFolder, helpName)); string helpSetup = Path.Combine(helpDirectory, String.Format(@"{0}\{1}", helpFolder, StepMhvBuilder.HelpContentSetup)); // Case 1: Closing the HtmlHelp 3.x viewer... if (stage == BuildStage.CloseViewer) { StepMhvViewerClose mhvClose = new StepMhvViewerClose(workingDir); return(mhvClose); } // Case 2: Starting the HtmlHelp 3.x viewer... if (stage == BuildStage.StartViewer) { StepMhvViewerStart mhvStart = new StepMhvViewerStart( helpDirectory, helpPath, helpSetup); return(mhvStart); } // Case 3: Compiling the HtmlHelp 3.x help file... if (stage == BuildStage.Compilation) { CultureInfo culture = settings.CultureInfo; int lcid = 1033; if (culture != null) { lcid = culture.LCID; } BuildMultiStep listSteps = new BuildMultiStep(); listSteps.LogTitle = "Building document output format - " + this.Name; listSteps.LogTimeSpan = true; // 1. Move the output html files to the help folder for compilation... StepDirectoryMove dirMove = new StepDirectoryMove(workingDir); dirMove.LogTitle = String.Empty; dirMove.Message = "Moving the output html files to the help folder for compilation"; dirMove.Add(@"Output\" + this.FormatFolder, helpFolder + @"\html"); listSteps.Add(dirMove); // 2. Compile or build the HtmlHelp 3.x format... StepMhvBuilder mhvBuilder = new StepMhvBuilder(workingDir); mhvBuilder.Message = "Compiling the help file."; mhvBuilder.LogTitle = String.Empty; mhvBuilder.HelpName = helpName; mhvBuilder.HelpFolder = helpFolder; mhvBuilder.HelpDirectory = helpDirectory; mhvBuilder.OptimizeStyle = this.OptimizeStyle; listSteps.Add(mhvBuilder); return(listSteps); } return(null); }
public override BuildStep CreateStep(BuildContext context, BuildStage stage, string workingDir) { if (context == null || context.Settings == null) { return(null); } BuildSettings settings = context.Settings; string helpDirectory = context.OutputDirectory; if (String.IsNullOrEmpty(workingDir)) { workingDir = context.WorkingDirectory; } string helpName = settings.HelpName; if (String.IsNullOrEmpty(helpName)) { helpName = "Documentation"; } string helpTitle = settings.HelpTitle; if (String.IsNullOrEmpty(helpTitle)) { helpTitle = helpName; } string helpFolder = this.OutputFolder; string helpPath = Path.Combine(helpDirectory, String.Format(@"{0}\{1}.hxs", helpFolder, helpName)); if (String.IsNullOrEmpty(_helpTitleId)) { _helpTitleId = helpName.Trim(); } // Case 1: Closing the HtmlHelp 2.x viewer... if (stage == BuildStage.CloseViewer) { StepHxsViewerClose hxsClose = new StepHxsViewerClose( workingDir, helpPath, helpTitle); return(hxsClose); } // Case 2: Starting the HtmlHelp 2.x viewer... if (stage == BuildStage.StartViewer) { string collPrefix = this["CollectionPrefix"]; if (String.IsNullOrEmpty(collPrefix)) { collPrefix = "Coll"; this.AddProperty("CollectionPrefix", collPrefix); } string helpColl = Path.Combine(helpDirectory, String.Format(@"{0}\{1}{2}.hxC", helpFolder, collPrefix, helpName)); string registrar = Path.Combine(this.CompilerDirectory, "HxReg.exe"); StepHxsViewerStart hxsStart = new StepHxsViewerStart( Path.GetDirectoryName(helpPath), helpPath, helpColl); hxsStart.Registrar = registrar; hxsStart.HelpTitleId = _helpTitleId; hxsStart.SeparateIndexFile = _separateIndex; return(hxsStart); } // Case 3: Compiling the HtmlHelp 2.x help file... if (stage == BuildStage.Compilation) { CultureInfo culture = settings.CultureInfo; int lcid = 1033; if (culture != null) { lcid = culture.LCID; } BuildMultiStep listSteps = new BuildMultiStep(); listSteps.LogTitle = "Building document output format - " + this.Name; listSteps.LogTimeSpan = true; // Prepare the help html files, and create the html project // 1. Move the output html files to the help folder for compilation... StepDirectoryMove dirMove = new StepDirectoryMove(workingDir); dirMove.LogTitle = String.Empty; dirMove.Message = "Moving the output html files to the help folder for compilation"; dirMove.Add(@"Output\" + this.FormatFolder, helpFolder + @"\html"); listSteps.Add(dirMove); // 2. Creating the project file... string tocFile = context["$HelpTocFile"]; StepHxsBuilder hxsBuilder = new StepHxsBuilder(workingDir); hxsBuilder.LogTitle = String.Empty; hxsBuilder.Message = "Creating project, content and configuration files."; hxsBuilder.HelpFolder = helpFolder; hxsBuilder.HelpToc = tocFile; hxsBuilder.HelpName = helpName; hxsBuilder.HelpTitleId = _helpTitleId; hxsBuilder.HelpCultureInfo = culture; listSteps.Add(hxsBuilder); // 3. Compile the Html help files hxcomp.exe -p Help\Manual.hxc string application = this.CompilerFile; string arguments = String.Format( @"-p {0}\{1}.HxC -n Output\{1}.log", helpFolder, helpName); StepHxsCompiler hxsCompiler = new StepHxsCompiler(workingDir, application, arguments); hxsCompiler.Message = "Compiling the help file (HxComp Tool)"; hxsCompiler.LogTitle = String.Empty; hxsCompiler.LogFile = Path.Combine(workingDir, String.Format(@"Output\{0}.log", helpName)); hxsCompiler.ProjectFile = Path.Combine(workingDir, String.Format(@"{0}\{1}.HxC", helpFolder, helpName)); //hxsCompiler.CopyrightNotice = 2; hxsCompiler.HelpFolder = helpFolder; hxsCompiler.HelpToc = tocFile; hxsCompiler.HelpName = helpName; hxsCompiler.HelpTitleId = _helpTitleId; hxsCompiler.HelpDirectory = helpDirectory; hxsCompiler.HelpCultureInfo = culture; listSteps.Add(hxsCompiler); return(listSteps); } return(null); }