Weather updates

This commit is contained in:
LukePulverenti Luke Pulverenti luke pulverenti
2012-09-02 13:34:12 -04:00
parent b6bc22ae63
commit 3c47375229
7 changed files with 47 additions and 13 deletions

View File

@@ -573,9 +573,9 @@ namespace MediaBrowser.ApiInteraction
{
string url = ApiUrl + "/ServerConfiguration";
using (Stream stream = await GetSerializedStreamAsync(url).ConfigureAwait(false))
using (Stream stream = await GetSerializedStreamAsync(url, ApiInteraction.SerializationFormat.Json).ConfigureAwait(false))
{
return DeserializeFromStream<ServerConfiguration>(stream);
return DeserializeFromStream<ServerConfiguration>(stream, ApiInteraction.SerializationFormat.Json);
}
}
@@ -622,19 +622,27 @@ namespace MediaBrowser.ApiInteraction
/// This is a helper around getting a stream from the server that contains serialized data
/// </summary>
private Task<Stream> GetSerializedStreamAsync(string url)
{
return GetSerializedStreamAsync(url, SerializationFormat);
}
/// <summary>
/// This is a helper around getting a stream from the server that contains serialized data
/// </summary>
private Task<Stream> GetSerializedStreamAsync(string url, SerializationFormat serializationFormat)
{
if (url.IndexOf('?') == -1)
{
url += "?dataformat=" + SerializationFormat.ToString().ToLower();
url += "?dataformat=" + serializationFormat.ToString().ToLower();
}
else
{
url += "&dataformat=" + SerializationFormat.ToString().ToLower();
url += "&dataformat=" + serializationFormat.ToString().ToLower();
}
return GetStreamAsync(url);
}
private T DeserializeFromStream<T>(Stream stream)
{
return DeserializeFromStream<T>(stream, SerializationFormat);