Ejemplo n.º 1
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.º 2
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);
        }