Exemplo n.º 1
0
        /// <summary> 添加节点 </summary>
        /// <param name="newChar"></param>
        /// <returns></returns>
        public DirtyNode Add(char newChar)
        {
            DirtyNode item;

            if (Nodes.TryGetValue(newChar, out item))
            {
                return(item);
            }
            item = new DirtyNode
            {
                Value = newChar
            };
            Nodes.Add(newChar, item);
            return(item);
        }
Exemplo n.º 2
0
        private DirtyHelper()
        {
            _root = new DirtyNode();
            var path = Path.Combine("configPath".Config(string.Empty), "dirty_words.txt");

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

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