From 0fb0d52a4c5732eb254e1f778835a28efddccf5f Mon Sep 17 00:00:00 2001 From: LukePulverenti Luke Pulverenti luke pulverenti Date: Wed, 5 Sep 2012 19:40:44 -0400 Subject: [PATCH] Made a separate ApiInteraction solution with platform-specific builds --- .../MediaBrowser.ApiInteraction.Metro.csproj | 66 +++ .../Properties/AssemblyInfo.cs | 30 + MediaBrowser.ApiInteraction.sln | 37 ++ MediaBrowser.ApiInteraction/ApiClient.cs | 30 +- MediaBrowser.ApiInteraction/DataSerializer.cs | 49 ++ .../IDataSerializer.cs | 22 - .../MediaBrowser.ApiInteraction.csproj | 32 +- .../Properties/AssemblyInfo.cs | 12 +- MediaBrowser.ApiInteraction/packages.config | 4 + .../MediaBrowser.Common.csproj | 5 +- MediaBrowser.Common/packages.config | 1 - .../MediaBrowser.Controller.csproj | 5 +- MediaBrowser.Controller/packages.config | 1 - MediaBrowser.Model/MediaBrowser.Model.csproj | 2 +- MediaBrowser.sln | 9 - UpgradeLog.XML | Bin 0 -> 1660 bytes UpgradeLog.htm | Bin 0 -> 13778 bytes _UpgradeReport_Files/UpgradeReport.css | 118 ++++ _UpgradeReport_Files/UpgradeReport.xslt | 538 ++++++++++++++++++ _UpgradeReport_Files/UpgradeReport_Error.png | Bin 0 -> 338 bytes .../UpgradeReport_Information.png | Bin 0 -> 306 bytes .../UpgradeReport_Success.png | Bin 0 -> 381 bytes .../UpgradeReport_Warning.png | Bin 0 -> 292 bytes 23 files changed, 886 insertions(+), 75 deletions(-) create mode 100644 MediaBrowser.ApiInteraction.Metro/MediaBrowser.ApiInteraction.Metro.csproj create mode 100644 MediaBrowser.ApiInteraction.Metro/Properties/AssemblyInfo.cs create mode 100644 MediaBrowser.ApiInteraction.sln create mode 100644 MediaBrowser.ApiInteraction/DataSerializer.cs delete mode 100644 MediaBrowser.ApiInteraction/IDataSerializer.cs create mode 100644 MediaBrowser.ApiInteraction/packages.config create mode 100644 UpgradeLog.XML create mode 100644 UpgradeLog.htm create mode 100644 _UpgradeReport_Files/UpgradeReport.css create mode 100644 _UpgradeReport_Files/UpgradeReport.xslt create mode 100644 _UpgradeReport_Files/UpgradeReport_Error.png create mode 100644 _UpgradeReport_Files/UpgradeReport_Information.png create mode 100644 _UpgradeReport_Files/UpgradeReport_Success.png create mode 100644 _UpgradeReport_Files/UpgradeReport_Warning.png 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 0000000000000000000000000000000000000000..2ecbdf3c953d3b42344f23ca2642ac52ec75bcee GIT binary patch literal 338 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`jKx9jP7LeL$-D$|SkfJR9T^xl z_H+M9WCijiOI#yLg7ec#$`gxH85~pclTsBta}(23gHjVyDhp4h+5i<@_jGX#vGCtI z`84k#1D-Zx7G?t{_XI|@2IqAicV_l-%PIyJXijaic+%GN|HL|(F@j2Ja z&dr%JN&ThgCczhbzRrJ_a%WP@^|!Oy58K^0Unle;p_#u%TY&xe@s~GPqApZeG7D*Q ztS~rGd85>I7SEJIi*DUmtxKa%CB7>)^pUXO@geCxM%7T9Y literal 0 HcmV?d00001 diff --git a/_UpgradeReport_Files/UpgradeReport_Information.png b/_UpgradeReport_Files/UpgradeReport_Information.png new file mode 100644 index 0000000000000000000000000000000000000000..adefdc716e59dc47f47e27c7867807046c72a129 GIT binary patch literal 306 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`jKx9jP7LeL$-D$|SkfJR9T^xl z_H+M9WCijiOI#yLg7ec#$`gxH85~pclTsBta}(23gHjVyDhp4h+5i=8_jGX#vG7k$ zaA3Z_uhyI4(O-u@^1RJQgf3h?{L{gcRl#om|A)u_f2@xCGd=DH2W#^Yhav@2g{>NF zj;8z1+y3BkR^H`!^>|z}Pi21+$BB>$EV~~44`?_%;d4TG!yncnsa;9}^3xd=ELW5Z zIk3Gs{w#gMq6u^L4@%5_s9>wGSAn_Um-KvYhqk6Ke8S8HY)bnK9Qa&LEfSn1b}rew z)kRfh1>=I64|362Dq5P#l1_1HPUj+*q@^?Hl`dhuk$>wE&-&@60ojc~?F7 b_jmpQHYJ(sAt^vU00000NkvXXu0mjf`*5Fz literal 0 HcmV?d00001 diff --git a/_UpgradeReport_Files/UpgradeReport_Warning.png b/_UpgradeReport_Files/UpgradeReport_Warning.png new file mode 100644 index 0000000000000000000000000000000000000000..7197e0304d299e27ec06052057d4518076248914 GIT binary patch literal 292 zcmV+<0o(qGP)uo03i;pQ#VLkU+xo=10JRlrjNOn&~ErqFe}jIl)a9KIYJA zNWo*pCay?5fh??}7jv qZ-W*3V)h)mODq8-=*KRO