Beispiel #1
0
 /// <summary>
 /// 添加一个脏话管理器
 /// </summary>
 /// <param name="dwm"></param>
 public static void AddManager(DirtyWordsManager dwm)
 {
     if (_instance.ContainsKey(dwm.Name))
     {
         _instance[dwm.Name] = dwm;
     }
     else
     {
         _instance.Add(dwm.Name, dwm);
     }
 }
Beispiel #2
0
        /// <summary>
        /// 用指定名称的脏话管理器来过滤脏字
        /// </summary>
        /// <param name="name">脏话管理器名</param>
        /// <param name="data">要过滤的字符串</param>
        /// <returns>返回过滤后的字符串</returns>
        public static string FilterDirtyWord(string name, string data)
        {
            DirtyWordsManager dwman = DirtyWordsManager.GetManager(name);

            if (dwman != null)
            {
                return(dwman.FilterDirtyWord(data));
            }
            else
            {
                return(data);
            }
        }
Beispiel #3
0
        /// <summary>
        /// 用指定名称的脏话管理器来检查字符串中是否有脏字
        /// </summary>
        /// <param name="name">脏话管理器名</param>
        /// <param name="data">要检查的字符串</param>
        /// <returns>返回值 true有脏字,false没有脏字</returns>
        public static bool CheckDirtyWord(string name, string data, bool checksymbol)
        {
            DirtyWordsManager dwman = DirtyWordsManager.GetManager(name);

            if (dwman != null)
            {
                return(dwman.CheckDirtyWord(data, checksymbol));
            }
            else
            {
                return(false);
            }
        }