using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace HuanMeng.DotNetCore.TextCensor
{
///
/// 验证字符串是否违规
///
//[Obsolete]
//public static class CheckTextVerification
//{
// static HashSet ShieldStr = new HashSet();
// static List ShieldListStr = new List();
// static string[] ShieldString = new string[0];
// static CheckTextVerification()
// {
// var ckPath = Path.GetFullPath("I:\\test\\PrayForBlessings\\PrayForBlessings\\ciku/");
// var filePath = Directory.EnumerateFiles(ckPath);
// foreach (var item in filePath)
// {
// CheckTextVerification.AddShieldString(item);
// }
// //
// }
// ///
// ///
// ///
// ///
// ///
// public static void AddShieldString(string path)
// {
// if (!File.Exists(path))
// {
// throw new Exception("文件不存在");
// }
// HashSet strings = new HashSet();
// using (StreamReader reader = new StreamReader(path, UnicodeEncoding.UTF8))
// {
// while (reader.Peek() > 0)
// {
// var tempStr = (reader.ReadLine() ?? "");
// //string result = Regex.Replace(tempStr, pattern, "");
// if (!string.IsNullOrEmpty(tempStr))
// {
// var tempStringToLower = tempStr.ToLower().Split(new char[] { '、', ',' });
// string[] filteredArrayToLower = tempStringToLower.Where(s => !string.IsNullOrEmpty(s)).ToArray();
// strings.UnionWith(filteredArrayToLower);
// }
// }
// ShieldStr.UnionWith(strings);
// ShieldListStr.AddRange(ShieldStr);
// ShieldString = ShieldStr.ToArray();
// Console.WriteLine(string.Format($"[{Path.GetFileName(path)}]加载完毕,总共加载屏蔽字行数:{ShieldStr.Count}"));
// }
// }
// ///
// ///
// ///
// ///
// ///
// public static bool VerifyTxt(string sourceTxt)
// {
// if (!string.IsNullOrEmpty(sourceTxt))
// {
// //先去掉空格,特殊字符
// string cleanedText = CleanedTextString(sourceTxt);
// foreach (var item in ShieldStr)
// {
// if (cleanedText.Contains(item))
// {
// return false;
// }
// }
// }
// return true;
// }
// ///
// ///
// ///
// ///
// ///
// public static bool VerifyTxtList(string sourceTxt)
// {
// if (!string.IsNullOrEmpty(sourceTxt))
// {
// //先去掉空格,特殊字符
// string cleanedText = CleanedTextString(sourceTxt);
// foreach (var item in ShieldListStr)
// {
// if (cleanedText.Contains(item))
// {
// return false;//2.56
// }
// }
// }
// return true;
// }
// private static string replaceString = " ,.。,@*12345690_-";
// ///
// ///
// ///
// ///
// ///
// private static string CleanedTextString(string sourceTxt)
// {
// string cleanedText = sourceTxt.ToLower()
// .Replace(" ", "")
// .Replace(",", "")
// .Replace(".", "")
// .Replace("。", "")
// .Replace(",", "")
// .Replace("@", "")
// .Replace("-", "")
// .Replace("*", "")
// .Replace("1", "")
// .Replace("2", "")
// .Replace("3", "")
// .Replace("4", "")
// .Replace("5", "")
// .Replace("6", "")
// .Replace("9", "")
// .Replace("0", "")
// .Replace("_", "");
// return cleanedText;
// }
// public static bool VerifyTxtString(string sourceTxt)
// {
// if (!string.IsNullOrEmpty(sourceTxt))
// {
// //先去掉空格,特殊字符
// string cleanedText = CleanedTextString(sourceTxt);
// foreach (var item in ShieldString)
// {
// if (cleanedText.Contains(item))
// {
// return false;//2.56
// }
// }
// }
// return true;
// }
//}
}