Esempio 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);
        }
Esempio n. 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);
            }
        }