Exemplo n.º 1
0
 public void DeletePattern(RegexItem regexItem)
 {
     if (regexItem.RegexType == "TextMatch")
     {
         TextMatchRegexList.Remove(regexItem);
     }
     else if (regexItem.RegexType == "TextReplace")
     {
         TextReplaceRegexList.Remove(regexItem);
     }
     else if (regexItem.RegexType == "FileMatch")
     {
         FileMatchRegexList.Remove(regexItem);
     }
     else if (regexItem.RegexType == "FileReplace")
     {
         FileReplaceRegexList.Remove(regexItem);
     }
     LogController.Log($"删除表达式完成--{regexItem.RegexText}");
 }
Exemplo n.º 2
0
        public void LoadManageList()
        {
            if (!File.Exists(ManageFileName))
            {
                File.WriteAllText(ManageFileName, "<Regexes>\n</Regexes>");
            }

            XDocument aXDocument = XDocument.Load(ManageFileName);

            TextMatchRegexList.Clear();
            TextReplaceRegexList.Clear();
            FileMatchRegexList.Clear();
            FileReplaceRegexList.Clear();
            foreach (XElement element in from el in aXDocument.Root.Elements("RegexItem") where (string)el.FirstAttribute == "TextMatch" select el)
            {
                TextMatchRegexList.Add(new RegexItem(element));
            }
            foreach (XElement element in from el in aXDocument.Root.Elements("RegexItem") where (string)el.FirstAttribute == "TextReplace" select el)
            {
                TextReplaceRegexList.Add(new RegexItem(element));
            }
        }