Esempio n. 1
0
        /// <summary>
        /// 获取文本中包含的违禁词集合
        /// </summary>
        /// <param name="text"></param>
        /// <returns></returns>
        public static List <WordModel> GetUnChekedWordInfoList(string text)
        {
            List <WordModel> result = new List <WordModel>();

            try
            {
                if (WordModels.Count == 0 && !string.IsNullOrEmpty(SystemVar.UserToken))
                {
                    WordModels = CheckWordHelper.GetAllCheckWordByToken(SystemVar.UserToken);
                }
            }
            catch (Exception ex)
            { }
            try
            {
                foreach (var item in WordModels)
                {
                    if (text.Contains(item.Name))
                    {
                        result.Add(item);
                    }
                }
            }
            catch (Exception ex)
            { }
            return(result);
        }
Esempio n. 2
0
        /// <summary>
        /// 获取text是不是违禁词
        /// </summary>
        /// <param name="text"></param>
        /// <returns></returns>
        public static WordModel GetUnChekedWordInfo(string word)
        {
            WordModel result = null;

            try
            {
                if (WordModels.Count == 0 && !string.IsNullOrEmpty(SystemVar.UserToken))
                {
                    WordModels = CheckWordHelper.GetAllCheckWordByToken(SystemVar.UserToken);
                }
            }
            catch (Exception ex)
            { }
            try
            {
                result = WordModels.FirstOrDefault(x => x.Name == word);
            }
            catch (Exception ex)
            { }
            return(result);
        }