Beispiel #1
0
        //=====================================================================

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

            InitializeComponent();
            project = currentProject;

            lnkProjectSite.Links[0].LinkData = "https://GitHub.com/EWSoftware/SHFB";

            items = new BindingRedirectSettingsCollection();

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

            root = navigator.SelectSingleNode("configuration");

            useGac = root.GetAttribute("useGAC", String.Empty);

            if (Boolean.TryParse(useGac, out bool value))
            {
                chkUseGAC.Checked = value;
            }

            if (!root.IsEmptyElement)
            {
                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 (BindingRedirectSettings brs in items)
                {
                    lbRedirects.Items.Add(brs);
                }

                lbRedirects.SelectedIndex = 0;
            }

            foreach (XPathNavigator nav in root.Select("ignoreIfUnresolved/assemblyIdentity/@name"))
            {
                lbIgnoreIfUnresolved.Items.Add(nav.Value);
            }

            if (lbIgnoreIfUnresolved.Items.Count == 0)
            {
                lbIgnoreIfUnresolved.Items.Add("BusinessObjects.Licensing.KeycodeDecoder");
                lbIgnoreIfUnresolved.Items.Add("Microsoft.VisualStudio.TestTools.UITest.Playback");
            }

            lbIgnoreIfUnresolved.SelectedIndex = 0;
        }
Beispiel #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>
        public void Initialize(BuildProcess buildProcess, XPathNavigator configuration)
        {
            XPathNavigator root;

            ignoreIfUnresolved = new List <string>();

            builder = buildProcess;

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

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

            // Transform the configuration elements to handle substitution tags
            string config = buildProcess.SubstitutionTags.TransformText(
                configuration.SelectSingleNode("configuration").OuterXml);

            XmlDocument doc = new XmlDocument();

            doc.LoadXml(config);
            root = doc.CreateNavigator().SelectSingleNode("configuration");

            if (root.IsEmptyElement)
            {
                throw new BuilderException("ABR0001", "The Assembly Binding Redirection Resolver plug-in " +
                                           "has not been configured yet");
            }

            // Load the configuration
            string value = root.GetAttribute("useGAC", String.Empty);

            if (!Boolean.TryParse(value, out useGac))
            {
                useGac = false;
            }

            redirects = new BindingRedirectSettingsCollection();
            redirects.FromXml(builder.CurrentProject, root);

            foreach (XPathNavigator nav in root.Select("ignoreIfUnresolved/assemblyIdentity/@name"))
            {
                ignoreIfUnresolved.Add(nav.Value);
            }
        }
Beispiel #3
0
        //=====================================================================

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

            InitializeComponent();
            project = currentProject;

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

            items = new BindingRedirectSettingsCollection();

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

            root = navigator.SelectSingleNode("configuration");

            if (!root.IsEmptyElement)
            {
                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 (BindingRedirectSettings brs in items)
                {
                    lbRedirects.Items.Add(brs);
                }

                lbRedirects.SelectedIndex = 0;
            }
        }
Beispiel #4
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;

            builder = buildProcess;

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

            root = configuration.SelectSingleNode("configuration");

            if (root.IsEmptyElement)
            {
                throw new BuilderException("ABR0001", "The Assembly Binding " +
                                           "Redirection Resolver plug-in has not been configured yet");
            }

            // Load the configuration
            redirects = new BindingRedirectSettingsCollection();
            redirects.FromXml(builder.CurrentProject, root);
        }