/// <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>
        /// <exception cref="BuilderException">This is thrown if the plug-in configuration is not valid.</exception>
        public void Initialize(BuildProcess buildProcess, XPathNavigator configuration)
        {
            XPathNavigator root;

            builder    = buildProcess;
            otherLinks = new ReferenceLinkSettingsCollection();

            var metadata = (HelpFileBuilderPlugInExportAttribute)this.GetType().GetCustomAttributes(
                typeof(HelpFileBuilderPlugInExportAttribute), false).First();

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

            root = configuration.SelectSingleNode("configuration");

            if (root.IsEmptyElement)
            {
                throw new BuilderException("ARL0001", "The Additional Reference Links plug-in has not been " +
                                           "configured yet");
            }

            // Load the reference links settings
            otherLinks.FromXml(buildProcess.CurrentProject, root);

            if (otherLinks.Count == 0)
            {
                throw new BuilderException("ARL0002", "At least one target is required for the Additional " +
                                           "Reference Links plug-in.");
            }
        }
Exemplo n.º 2
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>
        /// <exception cref="BuilderException">This is thrown if the plug-in
        /// configuration is not valid.</exception>
        public void Initialize(BuildProcess buildProcess, XPathNavigator configuration)
        {
            XPathNavigator root;

            builder    = buildProcess;
            otherLinks = new ReferenceLinkSettingsCollection();

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

            root = configuration.SelectSingleNode("configuration");

            if (root.IsEmptyElement)
            {
                throw new BuilderException("ARL0001", "The Additional Reference " +
                                           "Links plug-in has not been configured yet");
            }

            // Load the reference links settings
            otherLinks.FromXml(buildProcess.CurrentProject, root);

            if (otherLinks.Count == 0)
            {
                throw new BuilderException("ARL0002", "At least one target is " +
                                           "required for the Additional Reference Links plug-in.");
            }
        }
Exemplo n.º 3
0
        //=====================================================================

        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="currentProject">The current project</param>
        /// <param name="currentConfig">The current XML configuration
        /// XML fragment</param>
        public AdditionalReferenceLinksConfigDlg(SandcastleProject currentProject,
                                                 string currentConfig)
        {
            XPathNavigator navigator, root;

            InitializeComponent();
            project = currentProject;

            lnkCodePlexSHFB.Links[0].LinkData = "http://SHFB.CodePlex.com";
            lbReferences.DisplayMember        = lbReferences.ValueMember =
                "ListDescription";

            items = new ReferenceLinkSettingsCollection();

            // Load the current settings
            config = new XmlDocument();
            config.LoadXml(currentConfig);
            navigator = config.CreateNavigator();

            root = navigator.SelectSingleNode("configuration");

            if (root.IsEmptyElement)
            {
                return;
            }

            items.FromXml(project, root);

            if (items.Count == 0)
            {
                pgProps.Enabled = btnDelete.Enabled = false;
            }
            else
            {
                // Binding the collection to the list box caused some
                // odd problems with the property grid so we'll add the
                // items to the list box directly.
                foreach (ReferenceLinkSettings rl in items)
                {
                    lbReferences.Items.Add(rl);
                }

                lbReferences.SelectedIndex = 0;
            }
        }