Ejemplo n.º 1
0
        /// <summary>
        /// Gets the main style sheets of the specified presentation style
        /// for the given topics.
        /// </summary>
        /// <param name="presentationStyle">The presentation style.</param>
        /// <param name="topics">The topics for which the main style sheets
        /// are to be returned.</param>
        /// <returns>The collection of main style sheets corresponding
        /// to the specified presentation style.</returns>
        /// <exception cref="ArgumentNullException">
        /// <paramref name="presentationStyle"/> is <b>null</b>.
        /// </exception>
        /// <exception cref="ArgumentException">
        /// <paramref name="presentationStyle"/> is not supported
        /// by the SHFB Tools.<br/>
        /// -or-<br/>
        /// <paramref name="topics"/> is not a field of
        /// the <see cref="Topics"/> enumeration.
        /// by the target SHFB.
        /// </exception>
        static IEnumerable <string> GetMainStyleSheets(
            string presentationStyle,
            Topics topics)
        {
            if (null == presentationStyle)
            {
                throw new ArgumentNullException(nameof(presentationStyle));
            }

            if (!Shfb.PresentationStyles.Contains(presentationStyle))
            {
                throw new ArgumentException(
                          "The presentation style is not supported.",
                          nameof(presentationStyle));
            }

            Shfb.Validate(topics);

            List <string> mainStyleSheets = new List <string>();

            if ((topics & Topics.Sandcastle) == Topics.Sandcastle)
            {
                mainStyleSheets.Add(GetSandcastleMainStyleSheet(presentationStyle));
            }
            if ((topics & Topics.Conceptual) == Topics.Conceptual)
            {
                mainStyleSheets.Add(GetConceptualMainStyleSheet(presentationStyle));
            }

            return(mainStyleSheets);
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Installs the specified custom build path.
 /// </summary>
 /// <param name="ewSoftwareCommonApplicationDataPath">The path of the
 /// SHFB common Application Data folder.</param>
 /// <param name="path">The path of the SHFB installation.</param>
 /// <returns>A value equal to <c>0</c> for successful installations; nonzero otherwise.</returns>
 internal static int Install(
     string ewSoftwareCommonApplicationDataPath,
     string path)
 {
     return(Shfb.Update(
                LatexTools.Updater,
                ewSoftwareCommonApplicationDataPath,
                path));
 }
        /// <summary>
        /// Adds a family of class names to be highlighted in a SHFB
        /// installation having the specified path.
        /// </summary>
        /// <param name="family">A string used to identify
        /// the class names.</param>
        /// <param name="names">The class names to highlight.</param>
        /// <param name="languages">The languages for which
        /// the class names need to be highlighted.</param>
        /// <param name="path">
        /// The path of the SHFB installation to update.
        /// </param>
        /// <returns>A value equal to <c>0</c> for successful installations; nonzero otherwise.</returns>
        internal static int AddClassNamesFamily(
            string family,
            IEnumerable <string> names,
            IEnumerable <string> languages,
            string path)
        {
            FamilyInfo updateInfo = new FamilyInfo()
            {
                Family    = family,
                Names     = names,
                Languages = languages
            };

            return(Shfb.Update(HighlightingTools.ClassNamesFamilyAdder, updateInfo, path));
        }
 /// <summary>
 /// Removes a family of class names to be highlighted in a SHFB
 /// installation having the specified path.
 /// </summary>
 /// <param name="family">A string used to identify
 /// the class names.</param>
 /// <param name="path">
 /// The path of the SHFB installation to update.
 /// </param>
 /// <returns>A value equal to <c>0</c> for successful removals; nonzero otherwise.</returns>
 internal static int RemoveClassNamesFamily(
     string family,
     string path)
 {
     return(Shfb.Update(HighlightingTools.ClassNamesFamilyRemover, family, path));
 }
 /// <summary>
 /// Sets the class name highlighting color for a SHFB installation in the specified path.
 /// </summary>
 /// <param name="color">The color to set for class name highlighting.</param>
 /// <param name="path">The path of the SHFB installation to update.</param>
 /// <returns>A value equal to <c>0</c> for successful settings; nonzero otherwise.</returns>
 internal static int SetClassNamesColor(string color, string path)
 {
     return(Shfb.Update(HighlightingTools.ClassNameColorSetter, color, path));
 }
Ejemplo n.º 6
0
        /// <summary>
        /// Enumerates the file managers required to encapsulate the
        /// updating logic of the Novacta SHFB Latex Tools
        /// for the specified path.
        /// </summary>
        /// <param name="updateInfo">The update information.</param>
        /// <param name="path">The path of the SHFB installation to update.</param>
        /// <returns>The collection of file managers required for installation.</returns>
        static IEnumerable <FileManager> Updater(string updateInfo, string path)
        {
            #region STYLE SHEET IMPORTATION

            (string Href, XmlDocument Document)styleSheet;

            styleSheet.Href     = "novacta_latex_tools.xsl";
            styleSheet.Document = GetLatexImgTransform();

            var styleSheets = new List <(string Href, XmlDocument Document)>
            {
                styleSheet
            };

            List <FileManager> managers = new List <FileManager>();
            foreach (var style in Shfb.PresentationStyles)
            {
                var styleManagers = Shfb.PrepareStyleSheetImportation(
                    path,
                    style,
                    Topics.All,
                    styleSheets);
                managers.AddRange(styleManagers);
            }

            #endregion

            #region SHARED CONTENT ITEMS

            List <(string Id, string InnerText)> items;

            #region MARKDOWN

            items = new List <(string Id, string InnerText)>
            {
                ("novacta_latex_tools_path", "media/{0}.{1}"),
                ("novacta_latex_tools_depth", "vertical-align: -{0}px")
            };

            managers.Add(Shfb.PrepareSharedContentItemsModification(
                             path,
                             "Markdown",
                             "SharedContent.xml",
                             items));

            #endregion

            #region OPENXML

            items = new List <(string Id, string InnerText)>
            {
                ("novacta_latex_tools_path", "../media/{0}.{1}"),
                ("novacta_latex_tools_depth", "vertical-align: -{0}px")
            };

            managers.Add(Shfb.PrepareSharedContentItemsModification(
                             path,
                             "OpenXml",
                             "SharedContent.xml",
                             items));

            #endregion

            #region VS2010

            // Outputs: Website, HtmlHelp1

            items = new List <(string Id, string InnerText)>
            {
                ("novacta_latex_tools_path", "../media/{0}.{1}"),
                ("novacta_latex_tools_depth", "vertical-align: -{0}px")
            };

            managers.Add(Shfb.PrepareSharedContentItemsModification(
                             path,
                             "VS2010",
                             "shared_content.xml",
                             items));

            // Output: MsHelpViewer

            items = new List <(string Id, string InnerText)>
            {
                ("novacta_latex_tools_path", "media/{0}.{1}")
            };

            managers.Add(Shfb.PrepareSharedContentItemsModification(
                             path,
                             "VS2010",
                             "shared_content_mshc.xml",
                             items));

            #endregion

            #region VS2013

            // Outputs: Website, HtmlHelp1

            items = new List <(string Id, string InnerText)>
            {
                ("novacta_latex_tools_path", "../media/{0}.{1}"),
                ("novacta_latex_tools_depth", "vertical-align: -{0}px")
            };

            managers.Add(Shfb.PrepareSharedContentItemsModification(
                             path,
                             "VS2013",
                             "shared_content.xml",
                             items));

            // Output: MsHelpViewer

            items = new List <(string Id, string InnerText)>
            {
                ("novacta_latex_tools_path", "media/{0}.{1}")
            };

            managers.Add(Shfb.PrepareSharedContentItemsModification(
                             path,
                             "VS2013",
                             "shared_content_mshc.xml",
                             items));

            #endregion

            #endregion

            #region CONFIGURATION

            managers.Add(new SvgCompatibilityConfigurator(
                             Path.Combine(
                                 path,
                                 @"PresentationStyles",
                                 "VS2010",
                                 "Configuration",
                                 "BuildAssembler.config")));

            managers.Add(new SvgCompatibilityConfigurator(
                             Path.Combine(
                                 path,
                                 @"PresentationStyles",
                                 "VS2013",
                                 "Configuration",
                                 "BuildAssembler.config")));

            #endregion

            #region NEW FILES

            string fileName, destinationFilePath, baseDestinationPath;

            baseDestinationPath = updateInfo;

            if (!Directory.Exists(baseDestinationPath))
            {
                Directory.CreateDirectory(baseDestinationPath);
            }

            baseDestinationPath = Path.Combine(
                baseDestinationPath,
                "Sandcastle Help File Builder");

            if (!Directory.Exists(baseDestinationPath))
            {
                Directory.CreateDirectory(baseDestinationPath);
            }

            baseDestinationPath = Path.Combine(
                baseDestinationPath,
                "Components and Plug-Ins");

            if (!Directory.Exists(baseDestinationPath))
            {
                Directory.CreateDirectory(baseDestinationPath);
            }

            // LatexPlugIn assembly file

            fileName = "Novacta.Documentation.ShfbLatexPlugIn.dll";

            destinationFilePath = Path.Combine(
                baseDestinationPath, fileName);

            managers.Add(
                new FromByteArrayFileCreator(
                    destinationFilePath,
                    Properties.Resources.Novacta_Documentation_ShfbLatexPlugIn));

            // LatexComponent assembly file

            fileName = "Novacta.Documentation.ShfbLatexComponent.dll";

            destinationFilePath = Path.Combine(
                baseDestinationPath, fileName);

            managers.Add(
                new FromByteArrayFileCreator(
                    destinationFilePath,
                    Properties.Resources.Novacta_Documentation_ShfbLatexComponent));

            // LatexComponent default configuration file

            fileName = "Novacta.Documentation.ShfbLatexComponent.config";

            managers.Add(new XmlFileCreator(
                             Path.Combine(baseDestinationPath, fileName),
                             GetLatexComponentDefaultConfiguration()));

            #endregion

            return(managers);
        }
Ejemplo n.º 7
0
 /// <summary>
 /// Installs the Novacta SHFB Image Tools in the specified path.
 /// </summary>
 /// <param name="path">The path of the SHFB installation to update.
 /// </param>
 /// <returns>
 /// A value equal to <c>0</c> for successful installations; nonzero otherwise.
 /// </returns>
 internal static int Install(string path)
 {
     return(Shfb.Update(ImageTools.Updater, (string)(null), path));
 }
Ejemplo n.º 8
0
        /// <summary>
        /// Enumerates the file managers required to encapsulate the
        /// updating logic of the Novacta SHFB Image Tools
        /// for the specified path.
        /// </summary>
        /// <param name="updateInfo">The update information.</param>
        /// <param name="path">The path of the SHFB installation to update.</param>
        /// <returns>The collection of file managers required for installation.</returns>
        static IEnumerable <FileManager> Updater(string updateInfo, string path)
        {
            #region STYLE SHEET IMPORTATION

            (string Href, XmlDocument Document)styleSheet;

            styleSheet.Href     = "novacta_image_tools.xsl";
            styleSheet.Document = GetImageToolsTransform();

            var styleSheets = new List <(string Href, XmlDocument Document)>
            {
                styleSheet
            };

            List <FileManager> managers = new List <FileManager>();
            foreach (var style in Shfb.PresentationStyles)
            {
                var styleManagers = Shfb.PrepareStyleSheetImportation(
                    path,
                    style,
                    Topics.Sandcastle,
                    styleSheets);
                managers.AddRange(styleManagers);
            }

            #endregion

            #region SHARED CONTENT ITEMS

            List <(string Id, string InnerText)> items;

            #region MARKDOWN

            items = new List <(string Id, string InnerText)>
            {
                ("novacta_image_tools_path", "media/{0}"),
                ("novacta_image_tools_alt", "{0}"),
                ("novacta_image_tools_width", "{0}")
            };

            managers.Add(Shfb.PrepareSharedContentItemsModification(
                             path,
                             "Markdown",
                             "SharedContent.xml",
                             items));

            #endregion

            #region OPENXML

            items = new List <(string Id, string InnerText)>
            {
                ("novacta_image_tools_path", "../media/{0}"),
                ("novacta_image_tools_alt", "{0}"),
                ("novacta_image_tools_width", "{0}")
            };

            managers.Add(Shfb.PrepareSharedContentItemsModification(
                             path,
                             "OpenXml",
                             "SharedContent.xml",
                             items));

            #endregion

            #region VS2010

            // Outputs: Website, HtmlHelp1

            items = new List <(string Id, string InnerText)>
            {
                ("novacta_image_tools_path", "../media/{0}"),
                ("novacta_image_tools_alt", "{0}"),
                ("novacta_image_tools_width", "{0}")
            };

            managers.Add(Shfb.PrepareSharedContentItemsModification(
                             path,
                             "VS2010",
                             "shared_content.xml",
                             items));

            // Output: MsHelpViewer

            items = new List <(string Id, string InnerText)>
            {
                ("novacta_image_tools_path", "media/{0}")
            };

            managers.Add(Shfb.PrepareSharedContentItemsModification(
                             path,
                             "VS2010",
                             "shared_content_mshc.xml",
                             items));

            #endregion

            #region VS2013

            // Outputs: Website, HtmlHelp1

            items = new List <(string Id, string InnerText)>
            {
                ("novacta_image_tools_path", "../media/{0}"),
                ("novacta_image_tools_alt", "{0}"),
                ("novacta_image_tools_width", "{0}")
            };

            managers.Add(Shfb.PrepareSharedContentItemsModification(
                             path,
                             "VS2013",
                             "shared_content.xml",
                             items));

            // Output: MsHelpViewer

            items = new List <(string Id, string InnerText)>
            {
                ("novacta_image_tools_path", "media/{0}")
            };

            managers.Add(Shfb.PrepareSharedContentItemsModification(
                             path,
                             "VS2013",
                             "shared_content_mshc.xml",
                             items));

            #endregion

            #endregion

            return(managers);
        }