diff options
| author | LukePulverenti Luke Pulverenti luke pulverenti <LukePulverenti Luke Pulverenti luke.pulverenti@gmail.com> | 2012-09-02 13:34:12 -0400 |
|---|---|---|
| committer | LukePulverenti Luke Pulverenti luke pulverenti <LukePulverenti Luke Pulverenti luke.pulverenti@gmail.com> | 2012-09-02 13:34:12 -0400 |
| commit | 3c473752298e2bc91d3cb10a13c236cfaa2bc11e (patch) | |
| tree | 5cc0efbfacd5927687246377408d4f4d9dd8bc04 /MediaBrowser.ApiInteraction/ApiClient.cs | |
| parent | b6bc22ae638f8a8ad54609547ceb82253b4386d2 (diff) | |
Weather updates
Diffstat (limited to 'MediaBrowser.ApiInteraction/ApiClient.cs')
| -rw-r--r-- | MediaBrowser.ApiInteraction/ApiClient.cs | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/MediaBrowser.ApiInteraction/ApiClient.cs b/MediaBrowser.ApiInteraction/ApiClient.cs index bc06aa9a2..3de40f6a8 100644 --- a/MediaBrowser.ApiInteraction/ApiClient.cs +++ b/MediaBrowser.ApiInteraction/ApiClient.cs @@ -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);
}
}
@@ -623,18 +623,26 @@ namespace MediaBrowser.ApiInteraction /// </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);
|
