Esempio n. 1
0
 /// <summary>
 /// This method is used to execute the plug-in during the build process
 /// </summary>
 /// <param name="context">The current execution context</param>
 public void Execute(ExecutionContext context)
 {
     if (context.BuildStep == BuildStep.CompilingHelpFile)
     {
         // Merge the additional reference links information
         if (builder.CurrentFormat == HelpFileFormats.HtmlHelp1)
         {
             builder.ReportProgress("Adjusting generated help topics for X# Functions and procedures for local help");
             XSharpDocChanger.Convert(builder, builder.CurrentFormat);
         }
         if (builder.CurrentFormat == HelpFileFormats.MSHelpViewer)
         {
             builder.ReportProgress("Adjusting generated help topics for X# Functions and procedures for local help");
             XSharpDocChanger.Convert(builder, builder.CurrentFormat);
         }
         return;
     }
     if (context.BuildStep == BuildStep.CopyingWebsiteFiles)
     {
         // Merge the additional reference links information
         builder.ReportProgress("Adjusting generated help topics for X# Functions and procedures for website");
         XSharpDocChanger.Convert(builder, builder.CurrentFormat);
         return;
     }
 }
Esempio n. 2
0
 /// <summary>
 /// This method is used to execute the plug-in during the build process
 /// </summary>
 /// <param name="context">The current execution context</param>
 public void Execute(ExecutionContext context)
 {
     if (context.BuildStep == BuildStep.CompilingHelpFile)
     {
         // Merge the additional reference links information
         if (builder.CurrentFormat == HelpFileFormats.HtmlHelp1)
         {
             builder.ReportProgress("Adjusting generated help topics for X# Functions and procedures for local help");
             XSharpDocChanger.Convert(builder, builder.CurrentFormat);
         }
         if (builder.CurrentFormat == HelpFileFormats.MSHelpViewer)
         {
             builder.ReportProgress("Adjusting generated help topics for X# Functions and procedures for local help");
             XSharpDocChanger.Convert(builder, builder.CurrentFormat);
         }
         return;
     }
     if (context.BuildStep == BuildStep.GenerateHelpFormatTableOfContents)
     {
         ;
     }
     if (context.BuildStep == BuildStep.GenerateFullTextIndex)
     {
         // Merge the additional reference links information
         XSharpDocChanger.Convert(builder, builder.CurrentFormat);
         builder.ReportProgress("Adjusting web TOC for X# Functions and procedures for website");
         // Load the web TOC generated by SandcastleHtmlExtract
         string    file        = Path.Combine(builder.WorkingFolder, "WebTOC.xml");
         XDocument webtoc      = XDocument.Load(file);
         var       elements    = webtoc.XPathSelectElements("//*");
         var       websitePath = builder.WorkingFolder + "Output\\Website";
         foreach (var element in elements)
         {
             var attr = element.Attribute("Url");
             if (attr != null)
             {
                 var url  = attr.Value;
                 var path = Path.Combine(websitePath, url);
                 if (System.IO.File.Exists(path))
                 {
                     // Load the title from the topic page
                     XDocument topic        = XDocument.Load(path);
                     var       titleElement = topic.XPathSelectElement("//title");
                     attr = element.Attribute("Title");
                     if (attr != null)
                     {
                         element.SetAttributeValue("Title", titleElement.Value);
                     }
                 }
             }
         }
         webtoc.Save(file);
         return;
     }
 }
Esempio n. 3
0
        static internal void Convert(BuildProcess builder, HelpFileFormats format)
        {
            // Check which modes all need to be compiled
            string basePath         = builder.WorkingFolder;
            string htmlHelp1Path    = @"Output\HtmlHelp1";
            string MsHelpViewerPath = @"Output\MsHelpViewer";
            string websitePath      = @"Output\Website";
            string htmlPath         = "html";

            if (format == HelpFileFormats.HtmlHelp1)
            {
                builder.ReportProgress("Editing htmlHelp1 files...");
                string   htmlFolderPath = Path.Combine(basePath, htmlHelp1Path, htmlPath);
                string[] hhcPaths       = Directory.GetFiles(basePath, "*.hhc", SearchOption.TopDirectoryOnly);
                string[] hhkPaths       = Directory.GetFiles(basePath, "*.hhk", SearchOption.TopDirectoryOnly);

                if (Directory.Exists(htmlFolderPath))
                {
                    builder.ReportProgress("  Editing html topic pages...");
                    XSharpDocChanger.editHtmlFolder(builder, htmlFolderPath, format);
                }
                else
                {
                    builder.ReportProgress("  Could not find html folder!");
                }
                if (hhcPaths.Length > 0)
                {
                    builder.ReportProgress("  Editing {0} TOC's for HtmlHelp1...", hhcPaths.Length);
                    foreach (string hhc in hhcPaths)
                    {
                        XSharpDocChanger.editHhc(hhc);
                        XSharpDocChanger.editForTypeNames(hhc);
                    }
                }
                else
                {
                    builder.ReportProgress("   Found no TOC for HtmlHelp1");
                }

                if (hhkPaths.Length > 0)
                {
                    builder.ReportProgress("  Editing {0} index file(s) for HtmlHelp1...", hhkPaths.Length);
                    foreach (string hhk in hhkPaths)
                    {
                        XSharpDocChanger.editHhk(hhk);
                        XSharpDocChanger.editForTypeNames(hhk);
                    }
                }
                else
                {
                    builder.ReportProgress("  Found no index file for HtmlHelp1");
                }
            }
            if (format == HelpFileFormats.MSHelpViewer)
            {
                builder.ReportProgress("Editing MsHelpViewer files...");
                string htmlFolderPath = Path.Combine(basePath, MsHelpViewerPath, htmlPath);
                if (Directory.Exists(htmlFolderPath))
                {
                    builder.ReportProgress("  Editing html topic pages...");
                    XSharpDocChanger.editHtmlFolder(builder, htmlFolderPath, format);
                    // builder.ReportProgress("   Editing TOC and index");
                    //XSharpDocChanger.editHtmlFolderForMSHV(builder, htmlFolderPath);
                }
                else
                {
                    builder.ReportProgress("  Could not find html folder!");
                }
            }
            if (format == HelpFileFormats.Website)
            {
                builder.ReportProgress("Editing Website files...");
                string htmlFolderPath = Path.Combine(basePath, websitePath, htmlPath);
                if (Directory.Exists(htmlFolderPath))
                {
                    builder.ReportProgress("  Editing html topic pages...");
                    XSharpDocChanger.editHtmlFolder(builder, htmlFolderPath, format);
                    //XSharpDocChanger.editForWebsiteFolder(builder,htmlFolderPath);
                }
            }
        }