コード例 #1
0
        public void Capture(string url)
        {
            Check.Argument.IsNotInvalidWebUrl(url, "url");

            _httpForm.GetAsync(new HttpFormGetRequest {
                Url = url
            });
        }
コード例 #2
0
        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);
        }
コード例 #3
0
ファイル: WebSnaprThumbnail.cs プロジェクト: aoki1210/kigg
        public void Capture(string url)
        {
            Check.Argument.IsNotInvalidWebUrl(url, "url");

            _httpForm.GetAsync(new HttpFormGetRequest {
                Url = For(url, ThumbnailSize.Small)
            });
        }
コード例 #4
0
        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);
                        }
                    }
                        );
                }
            }
        }
コード例 #5
0
 public virtual void GetAsync(string url)
 {
     _innerHttpForm.GetAsync(url);
 }
コード例 #6
0
 public virtual void GetAsync(HttpFormGetRequest getRequest)
 {
     _innerHttpForm.GetAsync(getRequest);
 }