diff --git a/MediaBrowser.ApiInteraction.Metro/MediaBrowser.ApiInteraction.Metro.csproj b/MediaBrowser.ApiInteraction.Metro/MediaBrowser.ApiInteraction.Metro.csproj new file mode 100644 index 0000000000..216ba19ab3 --- /dev/null +++ b/MediaBrowser.ApiInteraction.Metro/MediaBrowser.ApiInteraction.Metro.csproj @@ -0,0 +1,66 @@ + + + + + Debug + AnyCPU + {94CEA07A-307C-4663-AA43-7BD852808574} + Library + Properties + MediaBrowser.ApiInteraction.Metro + MediaBrowser.ApiInteraction.Metro + v4.5 + Profile7 + 512 + {786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + {7eeeb4bb-f3e8-48fc-b4c5-70f0fff8329b} + MediaBrowser.Model + + + + + ApiClient.cs + + + DataSerializer.cs + + + + + + ..\protobuf-net\Full\netcore45\protobuf-net.dll + + + ..\packages\ServiceStack.Text.3.9.5\lib\sl5\ServiceStack.Text.dll + + + + + \ No newline at end of file diff --git a/MediaBrowser.ApiInteraction.Metro/Properties/AssemblyInfo.cs b/MediaBrowser.ApiInteraction.Metro/Properties/AssemblyInfo.cs new file mode 100644 index 0000000000..c9c876bc88 --- /dev/null +++ b/MediaBrowser.ApiInteraction.Metro/Properties/AssemblyInfo.cs @@ -0,0 +1,30 @@ +using System.Resources; +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("MediaBrowser.ApiInteraction.Metro")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("MediaBrowser.ApiInteraction.Metro")] +[assembly: AssemblyCopyright("Copyright © 2012")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] +[assembly: NeutralResourcesLanguage("en")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/MediaBrowser.ApiInteraction.sln b/MediaBrowser.ApiInteraction.sln new file mode 100644 index 0000000000..4484801a2b --- /dev/null +++ b/MediaBrowser.ApiInteraction.sln @@ -0,0 +1,37 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 2012 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MediaBrowser.Model", "MediaBrowser.Model\MediaBrowser.Model.csproj", "{7EEEB4BB-F3E8-48FC-B4C5-70F0FFF8329B}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MediaBrowser.ApiInteraction", "MediaBrowser.ApiInteraction\MediaBrowser.ApiInteraction.csproj", "{921C0F64-FDA7-4E9F-9E73-0CB0EEDB2422}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".nuget", ".nuget", "{F0E0E64C-2A6F-4E35-9533-D53AC07C2CD1}" + ProjectSection(SolutionItems) = preProject + .nuget\packages.config = .nuget\packages.config + EndProjectSection +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MediaBrowser.ApiInteraction.Metro", "MediaBrowser.ApiInteraction.Metro\MediaBrowser.ApiInteraction.Metro.csproj", "{94CEA07A-307C-4663-AA43-7BD852808574}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {7EEEB4BB-F3E8-48FC-B4C5-70F0FFF8329B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {7EEEB4BB-F3E8-48FC-B4C5-70F0FFF8329B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {7EEEB4BB-F3E8-48FC-B4C5-70F0FFF8329B}.Release|Any CPU.ActiveCfg = Release|Any CPU + {7EEEB4BB-F3E8-48FC-B4C5-70F0FFF8329B}.Release|Any CPU.Build.0 = Release|Any CPU + {921C0F64-FDA7-4E9F-9E73-0CB0EEDB2422}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {921C0F64-FDA7-4E9F-9E73-0CB0EEDB2422}.Debug|Any CPU.Build.0 = Debug|Any CPU + {921C0F64-FDA7-4E9F-9E73-0CB0EEDB2422}.Release|Any CPU.ActiveCfg = Release|Any CPU + {921C0F64-FDA7-4E9F-9E73-0CB0EEDB2422}.Release|Any CPU.Build.0 = Release|Any CPU + {94CEA07A-307C-4663-AA43-7BD852808574}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {94CEA07A-307C-4663-AA43-7BD852808574}.Debug|Any CPU.Build.0 = Debug|Any CPU + {94CEA07A-307C-4663-AA43-7BD852808574}.Release|Any CPU.ActiveCfg = Release|Any CPU + {94CEA07A-307C-4663-AA43-7BD852808574}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/MediaBrowser.ApiInteraction/ApiClient.cs b/MediaBrowser.ApiInteraction/ApiClient.cs index 18d6ddc210..8e3327f01a 100644 --- a/MediaBrowser.ApiInteraction/ApiClient.cs +++ b/MediaBrowser.ApiInteraction/ApiClient.cs @@ -18,6 +18,8 @@ namespace MediaBrowser.ApiInteraction handler.AutomaticDecompression = DecompressionMethods.Deflate; HttpClient = new HttpClient(handler); + + DataSerializer.Configure(); } /// @@ -48,24 +50,11 @@ namespace MediaBrowser.ApiInteraction { get { - // First try Protobuf since it has the best performance - if (DataSerializer.CanDeserializeProtobuf) - { - return ApiInteraction.SerializationFormat.Protobuf; - } - - // Next best is jsv - if (DataSerializer.CanDeserializeJsv) - { - return ApiInteraction.SerializationFormat.Jsv; - } - - return ApiInteraction.SerializationFormat.Json; + return ApiInteraction.SerializationFormat.Jsv; } } public HttpClient HttpClient { get; private set; } - public IDataSerializer DataSerializer { get; set; } /// /// Gets an image url that can be used to download an image from the api @@ -597,7 +586,7 @@ namespace MediaBrowser.ApiInteraction string url = ApiUrl + "/ServerConfiguration"; // At the moment this can't be retrieved in protobuf format - SerializationFormat format = DataSerializer.CanDeserializeJsv ? SerializationFormat.Jsv : ApiInteraction.SerializationFormat.Json; + SerializationFormat format = SerializationFormat.Jsv; using (Stream stream = await GetSerializedStreamAsync(url, format).ConfigureAwait(false)) { @@ -613,7 +602,7 @@ namespace MediaBrowser.ApiInteraction string url = ApiUrl + "/PluginConfiguration?assemblyfilename=" + plugin.AssemblyFileName; // At the moment this can't be retrieved in protobuf format - SerializationFormat format = DataSerializer.CanDeserializeJsv ? SerializationFormat.Jsv : ApiInteraction.SerializationFormat.Json; + SerializationFormat format = SerializationFormat.Jsv; using (Stream stream = await GetSerializedStreamAsync(url, format).ConfigureAwait(false)) { @@ -708,7 +697,7 @@ namespace MediaBrowser.ApiInteraction { if (format == ApiInteraction.SerializationFormat.Protobuf) { - return DataSerializer.DeserializeProtobufFromStream(stream, type); + throw new NotImplementedException(); } if (format == ApiInteraction.SerializationFormat.Jsv) { @@ -731,11 +720,4 @@ namespace MediaBrowser.ApiInteraction HttpClient.Dispose(); } } - - public enum SerializationFormat - { - Json, - Jsv, - Protobuf - } } diff --git a/MediaBrowser.ApiInteraction/DataSerializer.cs b/MediaBrowser.ApiInteraction/DataSerializer.cs new file mode 100644 index 0000000000..15039cd45a --- /dev/null +++ b/MediaBrowser.ApiInteraction/DataSerializer.cs @@ -0,0 +1,49 @@ +using System; +using System.IO; +using ProtoBuf; +using ServiceStack.Text; + +namespace MediaBrowser.ApiInteraction +{ + public static class DataSerializer + { + public static T DeserializeJsonFromStream(Stream stream) + { + return JsonSerializer.DeserializeFromStream(stream); + } + + public static T DeserializeJsvFromStream(Stream stream) + { + return TypeSerializer.DeserializeFromStream(stream); + } + + public static object DeserializeJsvFromStream(Stream stream, Type type) + { + return TypeSerializer.DeserializeFromStream(type, stream); + } + + public static object DeserializeJsonFromStream(Stream stream, Type type) + { + return JsonSerializer.DeserializeFromStream(type, stream); + } + + public static T DeserializeProtobufFromStream(Stream stream) + { + return Serializer.Deserialize(stream); + } + + public static void Configure() + { + JsConfig.DateHandler = ServiceStack.Text.JsonDateHandler.ISO8601; + JsConfig.ExcludeTypeInfo = true; + JsConfig.IncludeNullValues = false; + } + } + + public enum SerializationFormat + { + Json, + Jsv, + Protobuf + } +} diff --git a/MediaBrowser.ApiInteraction/IDataSerializer.cs b/MediaBrowser.ApiInteraction/IDataSerializer.cs deleted file mode 100644 index 33bac96df8..0000000000 --- a/MediaBrowser.ApiInteraction/IDataSerializer.cs +++ /dev/null @@ -1,22 +0,0 @@ -using System; -using System.IO; - -namespace MediaBrowser.ApiInteraction -{ - /// - /// Since ServiceStack Json is not portable, we need to abstract required json functions into an interface - /// - public interface IDataSerializer - { - T DeserializeJsonFromStream(Stream stream); - T DeserializeJsvFromStream(Stream stream); - T DeserializeProtobufFromStream(Stream stream); - - object DeserializeJsonFromStream(Stream stream, Type type); - object DeserializeJsvFromStream(Stream stream, Type type); - object DeserializeProtobufFromStream(Stream stream, Type type); - - bool CanDeserializeJsv { get; } - bool CanDeserializeProtobuf { get; } - } -} diff --git a/MediaBrowser.ApiInteraction/MediaBrowser.ApiInteraction.csproj b/MediaBrowser.ApiInteraction/MediaBrowser.ApiInteraction.csproj index 93c6acec9e..62a60f86cc 100644 --- a/MediaBrowser.ApiInteraction/MediaBrowser.ApiInteraction.csproj +++ b/MediaBrowser.ApiInteraction/MediaBrowser.ApiInteraction.csproj @@ -4,15 +4,13 @@ Debug AnyCPU - {B1C27231-7017-4C9B-A678-DE891954FA38} + {921C0F64-FDA7-4E9F-9E73-0CB0EEDB2422} Library Properties MediaBrowser.ApiInteraction MediaBrowser.ApiInteraction v4.5 - Profile7 512 - {786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} true @@ -32,18 +30,36 @@ 4 - + + ..\protobuf-net\Full\net30\protobuf-net.dll + + + ..\packages\ServiceStack.Text.3.9.5\lib\net35\ServiceStack.Text.dll + + + + + + + + + + + + + + + + {7eeeb4bb-f3e8-48fc-b4c5-70f0fff8329b} MediaBrowser.Model - - - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ + + + + Solution + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Error + Warning + Success + + + + + + + + + + + + + + + + + + + + + + + + + + + + Message + Warning + Error + Message + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ProjectPathErrorsWarningsMessages
+ + + + _UpgradeReport_Files\UpgradeReport_Error.png + _UpgradeReport_Files\UpgradeReport_Warning.png + _UpgradeReport_Files\UpgradeReport_Success.png + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ' + + + + + + + +
+
+ + + + + + + + + + + + + ' + + + + + + + + + + + Show additional messages + + + + + + + + + + + + + + + + + ' + + + + + + + + + + + Hide additional messages + + + + + + + + + + + + + + display: none + + + + + + + + + + + _UpgradeReport_Files\UpgradeReport_Error.png + _UpgradeReport_Files\UpgradeReport_Warning.png + _UpgradeReport_Files\UpgradeReport_Information.png + + + + + + + + + + : + + + + + + + + + + + + + + + + + + + + + + + +

+ +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Message
+ + + logged no messages. +
+
+
+ + + + + + + +]]> + + + + + + + + Migration Report + + + + + +

+ Migration Report - +

+ +
+

Overview

+ + + + +
+ +
+ +

Solution and projects

+ +
+ +
+
+ + +
+ + \ No newline at end of file diff --git a/_UpgradeReport_Files/UpgradeReport_Error.png b/_UpgradeReport_Files/UpgradeReport_Error.png new file mode 100644 index 0000000000..2ecbdf3c95 Binary files /dev/null and b/_UpgradeReport_Files/UpgradeReport_Error.png differ diff --git a/_UpgradeReport_Files/UpgradeReport_Information.png b/_UpgradeReport_Files/UpgradeReport_Information.png new file mode 100644 index 0000000000..adefdc716e Binary files /dev/null and b/_UpgradeReport_Files/UpgradeReport_Information.png differ diff --git a/_UpgradeReport_Files/UpgradeReport_Success.png b/_UpgradeReport_Files/UpgradeReport_Success.png new file mode 100644 index 0000000000..c8c27bcf09 Binary files /dev/null and b/_UpgradeReport_Files/UpgradeReport_Success.png differ diff --git a/_UpgradeReport_Files/UpgradeReport_Warning.png b/_UpgradeReport_Files/UpgradeReport_Warning.png new file mode 100644 index 0000000000..7197e0304d Binary files /dev/null and b/_UpgradeReport_Files/UpgradeReport_Warning.png differ