//=====================================================================

        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="currentConfig">The current XML configuration XML fragment</param>
        public MemberIdFixUpPlugInConfigDlg(string currentConfig)
        {
            InitializeComponent();

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

            // Load the current settings
            config = XElement.Parse(currentConfig);

            if(!config.IsEmpty)
                foreach(var expr in config.Descendants("expression"))
                {
                    var matchExpr = new MemberIdMatchExpression
                    {
                        MatchExpression = expr.Attribute("matchExpression").Value,
                        ReplacementValue = expr.Attribute("replacementValue").Value,
                        MatchAsRegEx = (bool)expr.Attribute("matchAsRegEx")
                    };

                    tvExpressions.Nodes.Add(new TreeNode
                    {
                        Text = matchExpr.MatchExpression,
                        Tag = matchExpr
                    });
                }

            if(tvExpressions.Nodes.Count != 0)
                btnDelete.Enabled = txtMatchExpression.Enabled = txtReplacementValue.Enabled =
                    chkMatchAsRegEx.Enabled = true;
        }
Пример #2
0
        //=====================================================================

        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="currentConfig">The current XML configuration XML fragment</param>
        public MemberIdFixUpPlugInConfigDlg(string currentConfig)
        {
            InitializeComponent();

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

            // Load the current settings
            config = XElement.Parse(currentConfig);

            if (!config.IsEmpty)
            {
                foreach (var expr in config.Descendants("expression"))
                {
                    var matchExpr = new MemberIdMatchExpression
                    {
                        MatchExpression  = expr.Attribute("matchExpression").Value,
                        ReplacementValue = expr.Attribute("replacementValue").Value,
                        MatchAsRegEx     = (bool)expr.Attribute("matchAsRegEx")
                    };

                    tvExpressions.Nodes.Add(new TreeNode
                    {
                        Text = matchExpr.MatchExpression,
                        Tag  = matchExpr
                    });
                }
            }

            if (tvExpressions.Nodes.Count != 0)
            {
                btnDelete.Enabled           = txtMatchExpression.Enabled = txtReplacementValue.Enabled =
                    chkMatchAsRegEx.Enabled = true;
            }
        }