Ejemplo n.º 1
0
        /// <summary>
        /// This method is used to initialize the plug-in at the start of the
        /// build process.
        /// </summary>
        /// <param name="buildProcess">A reference to the current build
        /// process.</param>
        /// <param name="configuration">The configuration data that the plug-in
        /// should use to initialize itself.</param>
        public void Initialize(BuildProcess buildProcess, XPathNavigator configuration)
        {
            XPathNavigator root, node;

            builder = buildProcess;

            builder.ReportProgress("{0} Version {1}\r\n{2}", this.Name, this.Version, this.Copyright);

            root = configuration.SelectSingleNode("configuration");

            if (root.IsEmptyElement)
            {
                throw new BuilderException("DFP0001", "The DBCS Fix plug-in " +
                                           "has not been configured yet");
            }

            node = root.SelectSingleNode("sbAppLocale");

            if (node != null)
            {
                sbAppLocalePath = node.GetAttribute("path", String.Empty).Trim();
            }

            if (String.IsNullOrEmpty(sbAppLocalePath))
            {
                throw new BuilderException("DFP0002", "A path to the Steel " +
                                           "Bytes App Locale tool is required");
            }

            // If relative, the path is relative to the project folder
            sbAppLocalePath = FilePath.RelativeToAbsolutePath(
                builder.ProjectFolder, builder.TransformText(sbAppLocalePath));

            if (!File.Exists(sbAppLocalePath))
            {
                throw new BuilderException("DFP0003", "Unable to locate " +
                                           "SBAppLocale tool at " + sbAppLocalePath);
            }

            // If not building HTML Help 1, there's nothing to do
            if ((builder.CurrentProject.HelpFileFormat & HelpFileFormat.HtmlHelp1) == 0)
            {
                executionPoints.Clear();
                builder.ReportWarning("DFP0007", "An HTML Help 1 file is not " +
                                      "being built.  This plug-in will not be ran.");
            }
        }