/// <summary> /// Checks the specified string. /// </summary> /// <param name="str">The string.</param> /// <param name="type">The type.</param> /// <param name="word">The word.</param> /// <returns><c>true</c> if XXXX, <c>false</c> otherwise.</returns> public static bool Check(string str, BlackWordType type, out BlackWord word) { word = Empty; if (!Replaces.ContainsKey(type)) { return(false); } var data = Replaces[type]; str = Filter.Replace(data.Filter, str); var wordFirst = Words.FirstOrDefault(wordStruct => wordStruct.Type == type && str.Contains(wordStruct.Word)); word = wordFirst; return(!string.IsNullOrEmpty(wordFirst.Word)); }
/// <summary> /// Checks the specified string. /// </summary> /// <param name="str">The string.</param> /// <param name="type">The type.</param> /// <param name="word">The word.</param> /// <returns><c>true</c> if XXXX, <c>false</c> otherwise.</returns> public static bool Check(string str, BlackWordType type, out BlackWord word) { word = Empty; if (!Replaces.ContainsKey(type)) return false; var data = Replaces[type]; str = Filter.Replace(data.Filter, str); var wordFirst = Words.FirstOrDefault(wordStruct => wordStruct.Type == type && str.Contains(wordStruct.Word)); word = wordFirst; return !string.IsNullOrEmpty(wordFirst.Word); }