Removed more manual decompression

This commit is contained in:
LukePulverenti Luke Pulverenti luke pulverenti 2012-08-01 05:25:13 -04:00
parent 32f7ecf4d0
commit a7bead51b2

View File

@ -1,7 +1,6 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.IO.Compression;
using System.Net.Http; using System.Net.Http;
using System.Threading.Tasks; using System.Threading.Tasks;
using MediaBrowser.Model.Configuration; using MediaBrowser.Model.Configuration;
@ -76,11 +75,6 @@ namespace MediaBrowser.ApiInteraction
public async Task<Stream> GetImageStreamAsync(string url) public async Task<Stream> GetImageStreamAsync(string url)
{ {
return await HttpClient.GetStreamAsync(url); return await HttpClient.GetStreamAsync(url);
/*byte[] bytes = await HttpClient.GetByteArrayAsync(url);
MemoryStream stream = new MemoryStream(bytes);
return stream;*/
} }
/// <summary> /// <summary>
@ -123,10 +117,7 @@ namespace MediaBrowser.ApiInteraction
using (Stream stream = await HttpClient.GetStreamAsync(url)) using (Stream stream = await HttpClient.GetStreamAsync(url))
{ {
using (GZipStream gzipStream = new GZipStream(stream, CompressionMode.Decompress, false)) return JsonSerializer.DeserializeFromStream<IEnumerable<CategoryInfo<Genre>>>(stream);
{
return JsonSerializer.DeserializeFromStream<IEnumerable<CategoryInfo<Genre>>>(gzipStream);
}
} }
} }
@ -139,10 +130,7 @@ namespace MediaBrowser.ApiInteraction
using (Stream stream = await HttpClient.GetStreamAsync(url)) using (Stream stream = await HttpClient.GetStreamAsync(url))
{ {
using (GZipStream gzipStream = new GZipStream(stream, CompressionMode.Decompress, false)) return JsonSerializer.DeserializeFromStream<CategoryInfo<Genre>>(stream);
{
return JsonSerializer.DeserializeFromStream<CategoryInfo<Genre>>(gzipStream);
}
} }
} }
@ -155,10 +143,7 @@ namespace MediaBrowser.ApiInteraction
using (Stream stream = await HttpClient.GetStreamAsync(url)) using (Stream stream = await HttpClient.GetStreamAsync(url))
{ {
using (GZipStream gzipStream = new GZipStream(stream, CompressionMode.Decompress, false)) return JsonSerializer.DeserializeFromStream<IEnumerable<CategoryInfo<Studio>>>(stream);
{
return JsonSerializer.DeserializeFromStream<IEnumerable<CategoryInfo<Studio>>>(gzipStream);
}
} }
} }
@ -171,10 +156,7 @@ namespace MediaBrowser.ApiInteraction
using (Stream stream = await HttpClient.GetStreamAsync(url)) using (Stream stream = await HttpClient.GetStreamAsync(url))
{ {
using (GZipStream gzipStream = new GZipStream(stream, CompressionMode.Decompress, false)) return JsonSerializer.DeserializeFromStream<UserConfiguration>(stream);
{
return JsonSerializer.DeserializeFromStream<UserConfiguration>(gzipStream);
}
} }
} }
@ -187,10 +169,7 @@ namespace MediaBrowser.ApiInteraction
using (Stream stream = await HttpClient.GetStreamAsync(url)) using (Stream stream = await HttpClient.GetStreamAsync(url))
{ {
using (GZipStream gzipStream = new GZipStream(stream, CompressionMode.Decompress, false)) return JsonSerializer.DeserializeFromStream<CategoryInfo<Studio>>(stream);
{
return JsonSerializer.DeserializeFromStream<CategoryInfo<Studio>>(gzipStream);
}
} }
} }
} }