public DownloadImageResult(DownloadImage command, byte[] bytes, HttpStatusCode status) { Status = status; Bytes = bytes; Command = command; }
private static Func <Task <byte[]>, DownloadImageResult> DownloadImageContinuationFunction(DownloadImage image) { return(tr => { // bad request, server error, or timeout if (tr.IsFaulted || tr.IsCanceled) { return new DownloadImageResult(image, new byte[0], HttpStatusCode.BadRequest); } // 404 if (tr.Result == null || tr.Result.Length == 0) { return new DownloadImageResult(image, new byte[0], HttpStatusCode.NotFound); } return new DownloadImageResult(image, tr.Result, HttpStatusCode.OK); }); }