public FormatWebHelper(FormatWebOptions options)
        {
            _kkwdTable    = new List <KKeywordInfo>();
            _defaultTopic = String.Empty;

            _options = options;
            _options.HtmlDirectory = StripEndBackSlash(Path.GetFullPath(
                                                           _options.HtmlDirectory));
            _options.OutputDirectory = StripEndBackSlash(Path.GetFullPath(
                                                             _options.OutputDirectory));
        }
Beispiel #2
0
        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);
        }