Esempio n. 1
0
 public DownloadImageResult(DownloadImage command, byte[] bytes, HttpStatusCode status)
 {
     Status  = status;
     Bytes   = bytes;
     Command = command;
 }
Esempio n. 2
0
        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);
            });
        }