Esempio n. 1
0
 public JavaHelpGenerator(string mainSourceFile, ChmDocument document, UserInterface ui,
                          ChmProject project, HtmlPageDecorator decorator)
     : base(document, ui, project, decorator)
 {
     JavaHelpDirectoryGeneration = Path.Combine(Path.GetTempPath(), Path.GetFileNameWithoutExtension(mainSourceFile)) +
                                   "-javahelp";
 }
Esempio n. 2
0
 protected ContentDirectoryGenerator(ChmDocument document, UserInterface ui,
                                     ChmProject project, HtmlPageDecorator decorator)
 {
     this.Document  = document;
     this.UI        = ui;
     this.Project   = project;
     this.Decorator = decorator;
 }
Esempio n. 3
0
        public ChmGenerator(ChmDocument document, UserInterface ui, ChmProject project,
                            List <string> additionalFiles, HtmlPageDecorator decorator)
            : base(document, ui, project, decorator)
        {
            this.Document        = document;
            this.UI              = ui;
            this.Project         = project;
            this.AdditionalFiles = additionalFiles;

            // Get the encoding and culture for the chm:
            this.HelpWorkshopCulture = project.GetChmCulture(UI);
            this.Encoding            = ChmProject.GetChmEncoding(UI, this.HelpWorkshopCulture);
        }
Esempio n. 4
0
        /// <summary>
        /// Saves the splitted content of this node into a file, if it has any.
        /// </summary>
        /// <param name="document">Owner of this node</param>
        /// <param name="directoryDstPath">Directory path where the content files will be stored</param>
        /// <param name="decorator">Tool to generate and decorate the HTML content files</param>
        /// <param name="indexer">Tool to index the saved content files. It can be null, if the content
        /// does not need to be indexed.</param>
        /// <returns>The content file name saved. Is this node has no content, it returns null</returns>
        public string SaveContent(ChmDocument document, string directoryDstPath, HtmlPageDecorator decorator, WebIndex indexer)
        {
            if (SplittedPartBody == null)
            {
                return(null);
            }

            // Save the section, adding header, footers, etc:
            string filePath = Path.Combine(directoryDstPath, DestinationFileName);

            decorator.ProcessAndSavePage(this, document, filePath);

            if (indexer != null)
            {
                // Store the document at the full text search index:
                indexer.AddPage(DestinationFileName, Title, SplittedPartBody);
            }

            return(DestinationFileName);
        }
Esempio n. 5
0
        /// <summary>
        /// Saves the splitted content files of the document to HTML files into a directory.
        /// </summary>
        /// <param name="directoryDstPath">Directory path where the content files will be stored</param>
        /// <param name="decorator">Tool to generate and decorate the HTML content files</param>
        /// <param name="indexer">Tool to index the saved content files. It can be null, if the content
        /// does not need to be indexed.</param>
        /// <returns>The content file names saved</returns>
        public List <string> SaveContentFiles(string directoryDstPath, HtmlPageDecorator decorator, WebIndex indexer)
        {
            // Search nodes with body on the document tree
            List <string> savedFiles = new List <string>();

            foreach (ChmDocumentNode node in RootNode.Children)
            {
                SaveContentFiles(node, savedFiles, directoryDstPath, decorator, indexer);
            }

            // Save the CSS file:
            if (!string.IsNullOrEmpty(EmbeddedStylesTagContent))
            {
                string       cssFilePath = Path.Combine(directoryDstPath, EMBEDDEDCSSFILENAME);
                StreamWriter writer      = new StreamWriter(cssFilePath);
                writer.Write(EmbeddedStylesTagContent);
                writer.Close();
                savedFiles.Add(EMBEDDEDCSSFILENAME);
            }

            return(savedFiles);
        }
Esempio n. 6
0
 public WebHelpGenerator(ChmDocument document, UserInterface ui, ChmProject project,
                         HtmlPageDecorator decorator)
     : base(document, ui, project, decorator)
 {
 }
Esempio n. 7
0
        /// <summary>
        /// Saves the splitted content files of the document to HTML files into a directory.
        /// </summary>
        /// <param name="node">Current node on the recursive search</param>
        /// <param name="savedFiles">The content file names saved</param>
        /// <param name="directoryDstPath">Directory path where the content files will be stored</param>
        /// <param name="decorator">Tool to generate and decorate the HTML content files</param>
        /// <param name="indexer">Tool to index the saved content files. It can be null, if the content
        /// does not need to be indexed.</param>
        private void SaveContentFiles(ChmDocumentNode node, List <string> savedFiles, string directoryDstPath, HtmlPageDecorator decorator, WebIndex indexer)
        {
            string fileName = node.SaveContent(this, directoryDstPath, decorator, indexer);

            if (fileName != null)
            {
                savedFiles.Add(fileName);
            }

            foreach (ChmDocumentNode child in node.Children)
            {
                SaveContentFiles(child, savedFiles, directoryDstPath, decorator, indexer);
            }
        }