/// <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); }
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); } }