示例#1
0
 public DownloadHtmlResult(DownloadHtmlDocument command, string content, HttpStatusCode status)
 {
     Status  = status;
     Content = content;
     Command = command;
 }
示例#2
0
        private static Func <Task <string>, DownloadHtmlResult> HtmlContinuationFunction(DownloadHtmlDocument html)
        {
            return(tr =>
            {
                // bad request, server error, or timeout
                if (tr.IsFaulted || tr.IsCanceled)
                {
                    return new DownloadHtmlResult(html, string.Empty, HttpStatusCode.BadRequest);
                }

                // 404
                if (string.IsNullOrEmpty(tr.Result))
                {
                    return new DownloadHtmlResult(html, string.Empty, HttpStatusCode.NotFound);
                }

                return new DownloadHtmlResult(html, tr.Result, HttpStatusCode.OK);
            });
        }