private void ProcessResponse(IHttpWebResponseAdapter response, CancellationToken cancellationToken)
        {
            DebugLogger.Log("Processing response");

            using (var responseStream = response.GetResponseStream())
            {
                if (responseStream == null)
                {
                    throw new DownloaderException("Resource response stream is null - " + _url,
                                                  DownloaderExceptionStatus.EmptyStream);
                }

                ProcessStream(responseStream, cancellationToken);
            }
        }
        public HttpResponse Create(IHttpWebResponseAdapter response)
        {
            if (response == null) return null;

            string content = string.Empty;

            using (StreamReader stream = new StreamReader(response.GetResponseStream()))
            {
                content = stream.ReadToEnd();
            }

            return new HttpResponse
            {
                Content = content,
                ContentType = response.ContentType,
                StatusCode = response.StatusCode,
                ContentEncoding = response.ContentEncoding
            };
        }
Esempio n. 3
0
        public HttpResponse Create(IHttpWebResponseAdapter response)
        {
            if (response == null)
            {
                return(null);
            }

            string content = string.Empty;

            using (StreamReader stream = new StreamReader(response.GetResponseStream()))
            {
                content = stream.ReadToEnd();
            }

            return(new HttpResponse
            {
                Content = content,
                ContentType = response.ContentType,
                StatusCode = response.StatusCode,
                ContentEncoding = response.ContentEncoding
            });
        }