예제 #1
0
        public async Task <bool> HasLinkAsync(string text)
        {
            using (performanceHandleFactory.StartMeasuringPerformance())
                return(await Task.Run(
                           async() => {
                    var words = GetWords(text);

                    var suspiciousWords = ExtractSuspiciousWords(words);
                    if (
                        await
                        asyncFilter.HasMatchAsync(
                            suspiciousWords,
                            IsValidLinkAsync))
                    {
                        return true;
                    }

                    var nonSuspiciousWords = ExtractNonSuspiciousWords(words);
                    return
                    await
                    asyncFilter.HasMatchAsync(
                        nonSuspiciousWords,
                        IsValidLinkAsync);
                }));
        }
예제 #2
0
 async Task <bool> HasLinkWithConditionsAsync(string text, Func <string, Task <bool> > validationFunction)
 {
     using (performanceHandleFactory.StartMeasuringPerformance())
     {
         var words = GetWords(text);
         return(await asyncFilter.HasMatchAsync(
                    words,
                    validationFunction));
     }
 }