aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLukePulverenti Luke Pulverenti luke pulverenti <LukePulverenti Luke Pulverenti luke.pulverenti@gmail.com>2012-09-08 16:25:56 -0400
committerLukePulverenti Luke Pulverenti luke pulverenti <LukePulverenti Luke Pulverenti luke.pulverenti@gmail.com>2012-09-08 16:25:56 -0400
commit50f88997bab58f4cfcbd3f420521776a54eb372d (patch)
treefcd5355dbba6b19f43a451a0a886791a5d86779c
parent8b39ed2f63a08597e1faf368c3c0506dbe960127 (diff)
Added protobuf support for serializing ServerConfiguration
-rw-r--r--MediaBrowser.ApiInteraction.Portable/ApiClient.cs5
-rw-r--r--MediaBrowser.ApiInteraction/BaseHttpApiClient.cs7
-rw-r--r--MediaBrowser.Model/Configuration/BaseApplicationConfiguration.cs9
-rw-r--r--MediaBrowser.Model/Configuration/ServerConfiguration.cs11
4 files changed, 22 insertions, 10 deletions
diff --git a/MediaBrowser.ApiInteraction.Portable/ApiClient.cs b/MediaBrowser.ApiInteraction.Portable/ApiClient.cs
index cbd179b02..eef73dd87 100644
--- a/MediaBrowser.ApiInteraction.Portable/ApiClient.cs
+++ b/MediaBrowser.ApiInteraction.Portable/ApiClient.cs
@@ -269,10 +269,7 @@ namespace MediaBrowser.ApiInteraction.Portable
{
string url = ApiUrl + "/ServerConfiguration";
- // At the moment this can't be retrieved in protobuf format
- SerializationFormats format = DataSerializer.CanDeSerializeJsv ? SerializationFormats.Jsv : SerializationFormats.Json;
-
- GetDataAsync(url, callback, format);
+ GetDataAsync(url, callback);
}
/// <summary>
diff --git a/MediaBrowser.ApiInteraction/BaseHttpApiClient.cs b/MediaBrowser.ApiInteraction/BaseHttpApiClient.cs
index f298e1f7e..c3871514e 100644
--- a/MediaBrowser.ApiInteraction/BaseHttpApiClient.cs
+++ b/MediaBrowser.ApiInteraction/BaseHttpApiClient.cs
@@ -313,12 +313,9 @@ namespace MediaBrowser.ApiInteraction
{
string url = ApiUrl + "/ServerConfiguration";
- // At the moment this can't be retrieved in protobuf format
- SerializationFormats format = DataSerializer.CanDeSerializeJsv ? SerializationFormats.Jsv : SerializationFormats.Json;
-
- using (Stream stream = await GetSerializedStreamAsync(url, format).ConfigureAwait(false))
+ using (Stream stream = await GetSerializedStreamAsync(url).ConfigureAwait(false))
{
- return DataSerializer.DeserializeFromStream<ServerConfiguration>(stream, format);
+ return DeserializeFromStream<ServerConfiguration>(stream);
}
}
diff --git a/MediaBrowser.Model/Configuration/BaseApplicationConfiguration.cs b/MediaBrowser.Model/Configuration/BaseApplicationConfiguration.cs
index 17be9eaef..41eb1da2c 100644
--- a/MediaBrowser.Model/Configuration/BaseApplicationConfiguration.cs
+++ b/MediaBrowser.Model/Configuration/BaseApplicationConfiguration.cs
@@ -1,12 +1,19 @@
-
+using ProtoBuf;
+
namespace MediaBrowser.Model.Configuration
{
/// <summary>
/// Serves as a common base class for the Server and UI application Configurations
+ /// ProtoInclude tells Protobuf about subclasses,
+ /// The number 50 can be any number, so long as it doesn't clash with any of the ProtoMember numbers either here or in subclasses.
/// </summary>
+ [ProtoContract, ProtoInclude(50, typeof(ServerConfiguration))]
public class BaseApplicationConfiguration
{
+ [ProtoMember(1)]
public bool EnableDebugLevelLogging { get; set; }
+
+ [ProtoMember(2)]
public int HttpServerPortNumber { get; set; }
public BaseApplicationConfiguration()
diff --git a/MediaBrowser.Model/Configuration/ServerConfiguration.cs b/MediaBrowser.Model/Configuration/ServerConfiguration.cs
index c229ca556..5bcd09ef0 100644
--- a/MediaBrowser.Model/Configuration/ServerConfiguration.cs
+++ b/MediaBrowser.Model/Configuration/ServerConfiguration.cs
@@ -1,13 +1,24 @@
using MediaBrowser.Model.Weather;
+using ProtoBuf;
namespace MediaBrowser.Model.Configuration
{
+ /// <summary>
+ /// Represents the server configuration.
+ /// </summary>
+ [ProtoContract]
public class ServerConfiguration : BaseApplicationConfiguration
{
+ [ProtoMember(3)]
public bool EnableInternetProviders { get; set; }
+
+ [ProtoMember(4)]
public bool EnableUserProfiles { get; set; }
+ [ProtoMember(5)]
public string WeatherZipCode { get; set; }
+
+ [ProtoMember(6)]
public WeatherUnits WeatherUnit { get; set; }
public ServerConfiguration()