Пример #1
0
        public override void ReadXml(XmlReader reader)
        {
            string overrideString = (reader.GetAttribute("override") ?? "true");

            if (overrideString == "1")
            {
                overrideString = "true";
            }
            Override = overrideString.ToLower().Equals("true");

            XmlReader childReader = reader.ReadSubtree();

            BackingList = new List <BaseSubstitution>();
            while (childReader.Read())
            {
                if (childReader.NodeType == XmlNodeType.Element)
                {
                    BaseSubstitution baseSubstitution = null;
                    switch (childReader.Name)
                    {
                    case "SubstituteAny": baseSubstitution = new AnySubstitution(); break;

                    case "SubstituteWhole": baseSubstitution = new WholeSubstitution(); break;
                    }
                    if (baseSubstitution != null)
                    {
                        baseSubstitution.CaseSensitive = Convert.ToBoolean(reader.GetAttribute("caseSensitive"));
                        baseSubstitution.Replace       = reader.GetAttribute("replace");
                        baseSubstitution.With          = reader.GetAttribute("with");
                        this.Add(baseSubstitution);
                    }
                }
            }
            reader.ReadEndElement();
        }
Пример #2
0
        private void WriteSubstitution()
        {
            BaseSubstitution substitution;

            if (((ListItem)ddoMethod.SelectedItem).Value == 1)
            {
                substitution = new AnySubstitution();
            }
            else
            {
                substitution = new WholeSubstitution();
            }

            substitution.Replace       = txtReplace.Text;
            substitution.With          = txtWith.Text;
            substitution.CaseSensitive = ckCaseSensitive.Checked;

            Substitution = substitution;
        }