예제 #1
0
        /// <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));
        }
예제 #2
0
파일: BlackWords.cs 프로젝트: BjkGkh/Azure2
        /// <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);
        }