Example #1
0
 /// <summary> 添加节点 </summary>
 /// <param name="newChar"></param>
 /// <returns></returns>
 public DirtyNode Add(char newChar)
 {
     if (Nodes.TryGetValue(newChar, out var item))
     {
         return(item);
     }
     item = new DirtyNode
     {
         Value = newChar
     };
     Nodes.Add(newChar, item);
     return(item);
 }
Example #2
0
        private DirtyHelper()
        {
            _root = new DirtyNode();
            var folderPath = "configPath".Config(Directory.GetCurrentDirectory());
            var path       = Path.Combine(folderPath, DirtyWordsFile);

            if (!File.Exists(path))
            {
                return;
            }
            var list = File.ReadAllLines(path);

            foreach (var item in list)
            {
                AddDirty(item);
            }
        }