Ejemplo n.º 1
0
 public static bool ContainsModWords(string str)
 {
     string cacheKey = "ContainsModWords-" + str;
     object cache = DataCache.GetCache(cacheKey);
     if (cache == null)
     {
         try
         {
             cache = false;
             List<Maticsoft.Model.Settings.FilterWords> modelList = new Maticsoft.BLL.Settings.FilterWords().GetModelList("ActionType=1");
             if ((modelList != null) && (modelList.Count > 0))
             {
                 foreach (Maticsoft.Model.Settings.FilterWords words2 in modelList)
                 {
                     if (str.Contains(words2.WordPattern.Trim()))
                     {
                         cache = true;
                         break;
                     }
                 }
             }
             int num = Globals.SafeInt(ConfigSystem.GetValueByCache("ModelCache"), 30);
             DataCache.SetCache(cacheKey, cache, DateTime.Now.AddMinutes((double) num), TimeSpan.Zero);
         }
         catch
         {
         }
     }
     return (bool) cache;
 }
Ejemplo n.º 2
0
 public static string ReplaceWords(string str, out bool contains)
 {
     contains = false;
     Maticsoft.BLL.Settings.FilterWords words = new Maticsoft.BLL.Settings.FilterWords();
     string str2 = str;
     List<Maticsoft.Model.Settings.FilterWords> modelList = words.GetModelList("ActionType=2");
     if ((modelList != null) && (modelList.Count > 0))
     {
         foreach (Maticsoft.Model.Settings.FilterWords words2 in modelList)
         {
             if (!contains)
             {
                 contains = str2.Contains(words2.WordPattern);
             }
             str2 = str2.Replace(words2.WordPattern, words2.RepalceWord);
         }
     }
     return str2;
 }