Exemple #1
0
        public void Capture(string url)
        {
            Check.Argument.IsNotInvalidWebUrl(url, "url");

            _httpForm.GetAsync(new HttpFormGetRequest {
                Url = url
            });
        }
        public void Capture(string url)
        {
            Check.Argument.IsNotInvalidWebUrl(url, "url");

            string requestUrl = "{0}/request?devkey={1}&url={2}".FormatWith(_baseUrl, _key, url);

            _httpForm.GetAsync(requestUrl);
        }
Exemple #3
0
        public void Capture(string url)
        {
            Check.Argument.IsNotInvalidWebUrl(url, "url");

            _httpForm.GetAsync(new HttpFormGetRequest {
                Url = For(url, ThumbnailSize.Small)
            });
        }
        public override void IsSpam(SpamCheckContent spamCheckContent, Action <string, bool> callback)
        {
            Check.Argument.IsNotNull(spamCheckContent, "spamCheckContent");
            Check.Argument.IsNotNull(callback, "callback");

            if (IsComment(spamCheckContent))
            {
                if (IsSpamComment(spamCheckContent))
                {
                    callback(Source, true);
                }
                else if (NextHandler != null)
                {
                    NextHandler.IsSpam(spamCheckContent, callback);
                }
                else
                {
                    callback(Source, false);
                }
            }
            else
            {
                //First run it over the story description
                int total = CalculateTotal(spamCheckContent.Content, _storyLocalCalculators);

                if (total > _storyThreshold)
                {
                    callback(Source, true);
                }
                else
                {
                    _httpForm.GetAsync(
                        new HttpFormGetRequest {
                        Url = spamCheckContent.Url
                    },
                        httpResponse =>
                    {
                        if (!string.IsNullOrEmpty(httpResponse.Response))
                        {
                            total += CalculateTotal(httpResponse.Response, _storyRemoteCalculators);
                        }

                        if (total > _storyThreshold)
                        {
                            callback(Source, true);
                        }
                        else if (NextHandler != null)
                        {
                            NextHandler.IsSpam(spamCheckContent, callback);
                        }
                        else
                        {
                            callback(Source, false);
                        }
                    },
                        e =>
                    {
                        // When exception occurs try next handler
                        if (NextHandler != null)
                        {
                            NextHandler.IsSpam(spamCheckContent, callback);
                        }
                        else
                        {
                            callback(Source, false);
                        }
                    }
                        );
                }
            }
        }
Exemple #5
0
 public virtual void GetAsync(string url)
 {
     _innerHttpForm.GetAsync(url);
 }
Exemple #6
0
 public virtual void GetAsync(HttpFormGetRequest getRequest)
 {
     _innerHttpForm.GetAsync(getRequest);
 }