Example #1
0
        public static void InitXmlSchema(string schemaPath)
        {
            string schema = Xmler.GetAppSettingValue("schema");

            if (string.IsNullOrEmpty(schema))
            {
                throw new XmlException("Missing schema config in App.config.");
            }

            TemplateDataSet.ReadXmlSchema(schemaPath);
        }
Example #2
0
        /// <summary>
        /// Do replace, show the result on replaced textbox.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public void btnReplace_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(txtInput.Text))
            {
                return;
            }
            if (string.IsNullOrEmpty(txtReplaceRule.Text))
            {
                return;
            }

            TemplateDataSet ds = new TemplateDataSet();
            Dictionary <string, ReplaceTemplate> dicTMP = ds.LoadFromXml(txtReplaceRule.Text);

            this.txtResult.Text = txtInput.Text;
            foreach (KeyValuePair <string, ReplaceTemplate> kv in dicTMP)
            {
                this.txtResult.Text = ReplaceFactory.ReplaceGroup(txtResult.Text, kv.Value);
            }
            tabResult.SelectedTab = tpMatch;
        }