Browse Source

Merge pull request #2467 from MediaBrowser/dev

Dev
Luke 8 years ago
parent
commit
252debd281
27 changed files with 256 additions and 547 deletions
  1. 3 4
      Emby.Server.Implementations/Emby.Server.Implementations.csproj
  2. 22 19
      Emby.Server.Implementations/HttpServer/HttpListenerHost.cs
  3. 1 2
      Emby.Server.Implementations/HttpServer/HttpResultFactory.cs
  4. 0 1
      Emby.Server.Implementations/Services/HttpResult.cs
  5. 7 7
      Emby.Server.Implementations/Services/RequestHelper.cs
  6. 2 1
      Emby.Server.Implementations/Services/ResponseHelper.cs
  7. 40 11
      Emby.Server.Implementations/Services/ServiceController.cs
  8. 2 3
      Emby.Server.Implementations/Services/ServiceExec.cs
  9. 12 13
      Emby.Server.Implementations/Services/ServiceHandler.cs
  10. 95 18
      Emby.Server.Implementations/Services/ServicePath.cs
  11. 10 7
      Emby.Server.Implementations/Services/StringMapTypeDeserializer.cs
  12. 2 2
      Emby.Server.Implementations/Services/UrlExtensions.cs
  13. 0 18
      MediaBrowser.Mono.sln
  14. 48 7
      MediaBrowser.Providers/Music/MusicBrainzAlbumProvider.cs
  15. 2 3
      MediaBrowser.Providers/Omdb/OmdbItemProvider.cs
  16. 9 2
      MediaBrowser.Providers/Omdb/OmdbProvider.cs
  17. 0 4
      MediaBrowser.Server.Mono/MediaBrowser.Server.Mono.csproj
  18. 0 4
      MediaBrowser.ServerApplication/MediaBrowser.ServerApplication.csproj
  19. 0 42
      MediaBrowser.sln
  20. 0 25
      ServiceStack/Properties/AssemblyInfo.cs
  21. 0 168
      ServiceStack/ReflectionExtensions.cs
  22. 0 117
      ServiceStack/ServiceStack.csproj
  23. 0 6
      ServiceStack/ServiceStack.nuget.targets
  24. 0 42
      ServiceStack/ServiceStackHost.cs
  25. 0 3
      ServiceStack/packages.config
  26. 0 17
      ServiceStack/project.json
  27. 1 1
      SharedVersion.cs

+ 3 - 4
Emby.Server.Implementations/Emby.Server.Implementations.csproj

@@ -215,6 +215,7 @@
     <Compile Include="Security\RegRecord.cs" />
     <Compile Include="Security\RegRecord.cs" />
     <Compile Include="ServerManager\ServerManager.cs" />
     <Compile Include="ServerManager\ServerManager.cs" />
     <Compile Include="ServerManager\WebSocketConnection.cs" />
     <Compile Include="ServerManager\WebSocketConnection.cs" />
+    <Compile Include="Services\ServicePath.cs" />
     <Compile Include="Services\ServiceMethod.cs" />
     <Compile Include="Services\ServiceMethod.cs" />
     <Compile Include="Services\ResponseHelper.cs" />
     <Compile Include="Services\ResponseHelper.cs" />
     <Compile Include="Services\HttpResult.cs" />
     <Compile Include="Services\HttpResult.cs" />
@@ -222,6 +223,8 @@
     <Compile Include="Services\ServiceHandler.cs" />
     <Compile Include="Services\ServiceHandler.cs" />
     <Compile Include="Services\ServiceController.cs" />
     <Compile Include="Services\ServiceController.cs" />
     <Compile Include="Services\ServiceExec.cs" />
     <Compile Include="Services\ServiceExec.cs" />
+    <Compile Include="Services\StringMapTypeDeserializer.cs" />
+    <Compile Include="Services\UrlExtensions.cs" />
     <Compile Include="Session\HttpSessionController.cs" />
     <Compile Include="Session\HttpSessionController.cs" />
     <Compile Include="Session\SessionManager.cs" />
     <Compile Include="Session\SessionManager.cs" />
     <Compile Include="Session\SessionWebSocketListener.cs" />
     <Compile Include="Session\SessionWebSocketListener.cs" />
@@ -308,10 +311,6 @@
       <Project>{2e781478-814d-4a48-9d80-bff206441a65}</Project>
       <Project>{2e781478-814d-4a48-9d80-bff206441a65}</Project>
       <Name>MediaBrowser.Server.Implementations</Name>
       <Name>MediaBrowser.Server.Implementations</Name>
     </ProjectReference>
     </ProjectReference>
-    <ProjectReference Include="..\ServiceStack\ServiceStack.csproj">
-      <Project>{680a1709-25eb-4d52-a87f-ee03ffd94baa}</Project>
-      <Name>ServiceStack</Name>
-    </ProjectReference>
     <ProjectReference Include="..\SocketHttpListener.Portable\SocketHttpListener.Portable.csproj">
     <ProjectReference Include="..\SocketHttpListener.Portable\SocketHttpListener.Portable.csproj">
       <Project>{4f26d5d8-a7b0-42b3-ba42-7cb7d245934e}</Project>
       <Project>{4f26d5d8-a7b0-42b3-ba42-7cb7d245934e}</Project>
       <Name>SocketHttpListener.Portable</Name>
       <Name>SocketHttpListener.Portable</Name>

+ 22 - 19
Emby.Server.Implementations/HttpServer/HttpListenerHost.cs

@@ -2,7 +2,6 @@
 using MediaBrowser.Controller.Configuration;
 using MediaBrowser.Controller.Configuration;
 using MediaBrowser.Controller.Net;
 using MediaBrowser.Controller.Net;
 using MediaBrowser.Model.Logging;
 using MediaBrowser.Model.Logging;
-using ServiceStack;
 using System;
 using System;
 using System.Collections.Generic;
 using System.Collections.Generic;
 using System.IO;
 using System.IO;
@@ -29,7 +28,7 @@ using SocketHttpListener.Primitives;
 
 
 namespace Emby.Server.Implementations.HttpServer
 namespace Emby.Server.Implementations.HttpServer
 {
 {
-    public class HttpListenerHost : ServiceStackHost, IHttpServer
+    public class HttpListenerHost : IHttpServer, IDisposable
     {
     {
         private string DefaultRedirectPath { get; set; }
         private string DefaultRedirectPath { get; set; }
 
 
@@ -62,7 +61,10 @@ namespace Emby.Server.Implementations.HttpServer
         private readonly bool _enableDualModeSockets;
         private readonly bool _enableDualModeSockets;
 
 
         public List<Action<IRequest, IResponse, object>> RequestFilters { get; set; }
         public List<Action<IRequest, IResponse, object>> RequestFilters { get; set; }
-        private Dictionary<Type, Type> ServiceOperationsMap = new Dictionary<Type, Type>();
+        public List<Action<IRequest, IResponse, object>> ResponseFilters { get; set; }
+
+        private readonly Dictionary<Type, Type> ServiceOperationsMap = new Dictionary<Type, Type>();
+        public static HttpListenerHost Instance { get; protected set; }
 
 
         public HttpListenerHost(IServerApplicationHost applicationHost,
         public HttpListenerHost(IServerApplicationHost applicationHost,
             ILogger logger,
             ILogger logger,
@@ -71,6 +73,8 @@ namespace Emby.Server.Implementations.HttpServer
             string defaultRedirectPath, INetworkManager networkManager, IMemoryStreamFactory memoryStreamProvider, ITextEncoding textEncoding, ISocketFactory socketFactory, ICryptoProvider cryptoProvider, IJsonSerializer jsonSerializer, IXmlSerializer xmlSerializer, IEnvironmentInfo environment, ICertificate certificate, IStreamFactory streamFactory, Func<Type, Func<string, object>> funcParseFn, bool enableDualModeSockets)
             string defaultRedirectPath, INetworkManager networkManager, IMemoryStreamFactory memoryStreamProvider, ITextEncoding textEncoding, ISocketFactory socketFactory, ICryptoProvider cryptoProvider, IJsonSerializer jsonSerializer, IXmlSerializer xmlSerializer, IEnvironmentInfo environment, ICertificate certificate, IStreamFactory streamFactory, Func<Type, Func<string, object>> funcParseFn, bool enableDualModeSockets)
             : base()
             : base()
         {
         {
+            Instance = this;
+
             _appHost = applicationHost;
             _appHost = applicationHost;
             DefaultRedirectPath = defaultRedirectPath;
             DefaultRedirectPath = defaultRedirectPath;
             _networkManager = networkManager;
             _networkManager = networkManager;
@@ -90,6 +94,7 @@ namespace Emby.Server.Implementations.HttpServer
             _logger = logger;
             _logger = logger;
 
 
             RequestFilters = new List<Action<IRequest, IResponse, object>>();
             RequestFilters = new List<Action<IRequest, IResponse, object>>();
+            ResponseFilters = new List<Action<IRequest, IResponse, object>>();
         }
         }
 
 
         public string GlobalResponse { get; set; }
         public string GlobalResponse { get; set; }
@@ -112,7 +117,7 @@ namespace Emby.Server.Implementations.HttpServer
             }
             }
         }
         }
 
 
-        public override object CreateInstance(Type type)
+        public object CreateInstance(Type type)
         {
         {
             return _appHost.CreateInstance(type);
             return _appHost.CreateInstance(type);
         }
         }
@@ -168,12 +173,12 @@ namespace Emby.Server.Implementations.HttpServer
 
 
         private IHasRequestFilter[] GetRequestFilterAttributes(Type requestDtoType)
         private IHasRequestFilter[] GetRequestFilterAttributes(Type requestDtoType)
         {
         {
-            var attributes = requestDtoType.AllAttributes().OfType<IHasRequestFilter>().ToList();
+            var attributes = requestDtoType.GetTypeInfo().GetCustomAttributes(true).OfType<IHasRequestFilter>().ToList();
 
 
             var serviceType = GetServiceTypeByRequest(requestDtoType);
             var serviceType = GetServiceTypeByRequest(requestDtoType);
             if (serviceType != null)
             if (serviceType != null)
             {
             {
-                attributes.AddRange(serviceType.AllAttributes().OfType<IHasRequestFilter>());
+                attributes.AddRange(serviceType.GetTypeInfo().GetCustomAttributes(true).OfType<IHasRequestFilter>());
             }
             }
 
 
             attributes.Sort((x, y) => x.Priority - y.Priority);
             attributes.Sort((x, y) => x.Priority - y.Priority);
@@ -611,7 +616,7 @@ namespace Emby.Server.Implementations.HttpServer
                 _logger.Error("Path parts empty for PathInfo: {0}, Url: {1}", pathInfo, httpReq.RawUrl);
                 _logger.Error("Path parts empty for PathInfo: {0}, Url: {1}", pathInfo, httpReq.RawUrl);
                 return null;
                 return null;
             }
             }
-            
+
             string contentType;
             string contentType;
             var restPath = ServiceHandler.FindMatchingRestPath(httpReq.HttpMethod, pathInfo, _logger, out contentType);
             var restPath = ServiceHandler.FindMatchingRestPath(httpReq.HttpMethod, pathInfo, _logger, out contentType);
 
 
@@ -658,8 +663,6 @@ namespace Emby.Server.Implementations.HttpServer
 
 
             _logger.Info("Calling ServiceStack AppHost.Init");
             _logger.Info("Calling ServiceStack AppHost.Init");
 
 
-            Instance = this;
-
             ServiceController.Init(this);
             ServiceController.Init(this);
 
 
             var requestFilters = _appHost.GetExports<IRequestFilter>().ToList();
             var requestFilters = _appHost.GetExports<IRequestFilter>().ToList();
@@ -668,12 +671,12 @@ namespace Emby.Server.Implementations.HttpServer
                 RequestFilters.Add(filter.Filter);
                 RequestFilters.Add(filter.Filter);
             }
             }
 
 
-            GlobalResponseFilters.Add(new ResponseFilter(_logger).FilterResponse);
+            ResponseFilters.Add(new ResponseFilter(_logger).FilterResponse);
         }
         }
 
 
-        public override RouteAttribute[] GetRouteAttributes(Type requestType)
+        public RouteAttribute[] GetRouteAttributes(Type requestType)
         {
         {
-            var routes = requestType.AllAttributes<RouteAttribute>();
+            var routes = requestType.GetTypeInfo().GetCustomAttributes<RouteAttribute>(true).ToList();
             var clone = routes.ToList();
             var clone = routes.ToList();
 
 
             foreach (var route in clone)
             foreach (var route in clone)
@@ -703,27 +706,27 @@ namespace Emby.Server.Implementations.HttpServer
             return routes.ToArray();
             return routes.ToArray();
         }
         }
 
 
-        public override Func<string, object> GetParseFn(Type propertyType)
+        public Func<string, object> GetParseFn(Type propertyType)
         {
         {
             return _funcParseFn(propertyType);
             return _funcParseFn(propertyType);
         }
         }
 
 
-        public override void SerializeToJson(object o, Stream stream)
+        public void SerializeToJson(object o, Stream stream)
         {
         {
             _jsonSerializer.SerializeToStream(o, stream);
             _jsonSerializer.SerializeToStream(o, stream);
         }
         }
 
 
-        public override void SerializeToXml(object o, Stream stream)
+        public void SerializeToXml(object o, Stream stream)
         {
         {
             _xmlSerializer.SerializeToStream(o, stream);
             _xmlSerializer.SerializeToStream(o, stream);
         }
         }
 
 
-        public override object DeserializeXml(Type type, Stream stream)
+        public object DeserializeXml(Type type, Stream stream)
         {
         {
             return _xmlSerializer.DeserializeFromStream(type, stream);
             return _xmlSerializer.DeserializeFromStream(type, stream);
         }
         }
 
 
-        public override object DeserializeJson(Type type, Stream stream)
+        public object DeserializeJson(Type type, Stream stream)
         {
         {
             return _jsonSerializer.DeserializeFromStream(stream, type);
             return _jsonSerializer.DeserializeFromStream(stream, type);
         }
         }
@@ -764,7 +767,7 @@ namespace Emby.Server.Implementations.HttpServer
         {
         {
             if (_disposed) return;
             if (_disposed) return;
 
 
-            base.Dispose();
+            Dispose();
 
 
             lock (_disposeLock)
             lock (_disposeLock)
             {
             {
@@ -779,7 +782,7 @@ namespace Emby.Server.Implementations.HttpServer
             }
             }
         }
         }
 
 
-        public override void Dispose()
+        public void Dispose()
         {
         {
             Dispose(true);
             Dispose(true);
             GC.SuppressFinalize(this);
             GC.SuppressFinalize(this);

+ 1 - 2
Emby.Server.Implementations/HttpServer/HttpResultFactory.cs

@@ -16,7 +16,6 @@ using Emby.Server.Implementations.HttpServer;
 using Emby.Server.Implementations.Services;
 using Emby.Server.Implementations.Services;
 using MediaBrowser.Model.IO;
 using MediaBrowser.Model.IO;
 using MediaBrowser.Model.Services;
 using MediaBrowser.Model.Services;
-using ServiceStack;
 using IRequest = MediaBrowser.Model.Services.IRequest;
 using IRequest = MediaBrowser.Model.Services.IRequest;
 using MimeTypes = MediaBrowser.Model.Net.MimeTypes;
 using MimeTypes = MediaBrowser.Model.Net.MimeTypes;
 using StreamWriter = Emby.Server.Implementations.HttpServer.StreamWriter;
 using StreamWriter = Emby.Server.Implementations.HttpServer.StreamWriter;
@@ -204,7 +203,7 @@ namespace Emby.Server.Implementations.HttpServer
             using (var ms = new MemoryStream())
             using (var ms = new MemoryStream())
             {
             {
                 var contentType = request.ResponseContentType;
                 var contentType = request.ResponseContentType;
-                var writerFn = RequestHelper.GetResponseWriter(contentType);
+                var writerFn = RequestHelper.GetResponseWriter(HttpListenerHost.Instance, contentType);
 
 
                 writerFn(dto, ms);
                 writerFn(dto, ms);
 
 

+ 0 - 1
Emby.Server.Implementations/Services/HttpResult.cs

@@ -4,7 +4,6 @@ using System.Net;
 using System.Threading;
 using System.Threading;
 using System.Threading.Tasks;
 using System.Threading.Tasks;
 using MediaBrowser.Model.Services;
 using MediaBrowser.Model.Services;
-using ServiceStack;
 
 
 namespace Emby.Server.Implementations.Services
 namespace Emby.Server.Implementations.Services
 {
 {

+ 7 - 7
Emby.Server.Implementations/Services/RequestHelper.cs

@@ -1,40 +1,40 @@
 using System;
 using System;
 using System.IO;
 using System.IO;
-using ServiceStack;
+using Emby.Server.Implementations.HttpServer;
 
 
 namespace Emby.Server.Implementations.Services
 namespace Emby.Server.Implementations.Services
 {
 {
     public class RequestHelper
     public class RequestHelper
     {
     {
-        public static Func<Type, Stream, object> GetRequestReader(string contentType)
+        public static Func<Type, Stream, object> GetRequestReader(HttpListenerHost host, string contentType)
         {
         {
             switch (GetContentTypeWithoutEncoding(contentType))
             switch (GetContentTypeWithoutEncoding(contentType))
             {
             {
                 case "application/xml":
                 case "application/xml":
                 case "text/xml":
                 case "text/xml":
                 case "text/xml; charset=utf-8": //"text/xml; charset=utf-8" also matches xml
                 case "text/xml; charset=utf-8": //"text/xml; charset=utf-8" also matches xml
-                    return ServiceStackHost.Instance.DeserializeXml;
+                    return host.DeserializeXml;
 
 
                 case "application/json":
                 case "application/json":
                 case "text/json":
                 case "text/json":
-                    return ServiceStackHost.Instance.DeserializeJson;
+                    return host.DeserializeJson;
             }
             }
 
 
             return null;
             return null;
         }
         }
 
 
-        public static Action<object, Stream> GetResponseWriter(string contentType)
+        public static Action<object, Stream> GetResponseWriter(HttpListenerHost host, string contentType)
         {
         {
             switch (GetContentTypeWithoutEncoding(contentType))
             switch (GetContentTypeWithoutEncoding(contentType))
             {
             {
                 case "application/xml":
                 case "application/xml":
                 case "text/xml":
                 case "text/xml":
                 case "text/xml; charset=utf-8": //"text/xml; charset=utf-8" also matches xml
                 case "text/xml; charset=utf-8": //"text/xml; charset=utf-8" also matches xml
-                    return (o, s) => ServiceStackHost.Instance.SerializeToXml(o, s);
+                    return host.SerializeToXml;
 
 
                 case "application/json":
                 case "application/json":
                 case "text/json":
                 case "text/json":
-                    return (o, s) => ServiceStackHost.Instance.SerializeToJson(o, s);
+                    return host.SerializeToJson;
             }
             }
 
 
             return null;
             return null;

+ 2 - 1
Emby.Server.Implementations/Services/ResponseHelper.cs

@@ -5,6 +5,7 @@ using System.Net;
 using System.Text;
 using System.Text;
 using System.Threading;
 using System.Threading;
 using System.Threading.Tasks;
 using System.Threading.Tasks;
+using Emby.Server.Implementations.HttpServer;
 using MediaBrowser.Model.Services;
 using MediaBrowser.Model.Services;
 
 
 namespace Emby.Server.Implementations.Services
 namespace Emby.Server.Implementations.Services
@@ -161,7 +162,7 @@ namespace Emby.Server.Implementations.Services
         public static async Task WriteObject(IRequest request, object result, IResponse response)
         public static async Task WriteObject(IRequest request, object result, IResponse response)
         {
         {
             var contentType = request.ResponseContentType;
             var contentType = request.ResponseContentType;
-            var serializer = RequestHelper.GetResponseWriter(contentType);
+            var serializer = RequestHelper.GetResponseWriter(HttpListenerHost.Instance, contentType);
             
             
             using (var ms = new MemoryStream())
             using (var ms = new MemoryStream())
             {
             {

+ 40 - 11
Emby.Server.Implementations/Services/ServiceController.cs

@@ -5,7 +5,6 @@ using System.Threading.Tasks;
 using Emby.Server.Implementations.HttpServer;
 using Emby.Server.Implementations.HttpServer;
 using MediaBrowser.Model.Logging;
 using MediaBrowser.Model.Logging;
 using MediaBrowser.Model.Services;
 using MediaBrowser.Model.Services;
-using ServiceStack;
 
 
 namespace Emby.Server.Implementations.Services
 namespace Emby.Server.Implementations.Services
 {
 {
@@ -53,32 +52,62 @@ namespace Emby.Server.Implementations.Services
 
 
                 ServiceExecGeneral.CreateServiceRunnersFor(requestType, actions);
                 ServiceExecGeneral.CreateServiceRunnersFor(requestType, actions);
 
 
-                var returnMarker = requestType.GetTypeWithGenericTypeDefinitionOf(typeof(IReturn<>));
+                var returnMarker = GetTypeWithGenericTypeDefinitionOf(requestType, typeof(IReturn<>));
                 var responseType = returnMarker != null ?
                 var responseType = returnMarker != null ?
                       GetGenericArguments(returnMarker)[0]
                       GetGenericArguments(returnMarker)[0]
                     : mi.ReturnType != typeof(object) && mi.ReturnType != typeof(void) ?
                     : mi.ReturnType != typeof(object) && mi.ReturnType != typeof(void) ?
                       mi.ReturnType
                       mi.ReturnType
                     : Type.GetType(requestType.FullName + "Response");
                     : Type.GetType(requestType.FullName + "Response");
 
 
-                RegisterRestPaths(requestType);
+                RegisterRestPaths(appHost, requestType);
 
 
                 appHost.AddServiceInfo(serviceType, requestType, responseType);
                 appHost.AddServiceInfo(serviceType, requestType, responseType);
             }
             }
         }
         }
 
 
+        private static Type GetTypeWithGenericTypeDefinitionOf(Type type, Type genericTypeDefinition)
+        {
+            foreach (var t in type.GetTypeInfo().ImplementedInterfaces)
+            {
+                if (t.GetTypeInfo().IsGenericType && t.GetGenericTypeDefinition() == genericTypeDefinition)
+                {
+                    return t;
+                }
+            }
+
+            var genericType = FirstGenericType(type);
+            if (genericType != null && genericType.GetGenericTypeDefinition() == genericTypeDefinition)
+            {
+                return genericType;
+            }
+
+            return null;
+        }
+
+        public static Type FirstGenericType(Type type)
+        {
+            while (type != null)
+            {
+                if (type.GetTypeInfo().IsGenericType)
+                    return type;
+
+                type = type.GetTypeInfo().BaseType;
+            }
+            return null;
+        }
+
         public readonly Dictionary<string, List<RestPath>> RestPathMap = new Dictionary<string, List<RestPath>>(StringComparer.OrdinalIgnoreCase);
         public readonly Dictionary<string, List<RestPath>> RestPathMap = new Dictionary<string, List<RestPath>>(StringComparer.OrdinalIgnoreCase);
 
 
-        public void RegisterRestPaths(Type requestType)
+        public void RegisterRestPaths(HttpListenerHost appHost, Type requestType)
         {
         {
-            var appHost = ServiceStackHost.Instance;
             var attrs = appHost.GetRouteAttributes(requestType);
             var attrs = appHost.GetRouteAttributes(requestType);
-            foreach (MediaBrowser.Model.Services.RouteAttribute attr in attrs)
+            foreach (RouteAttribute attr in attrs)
             {
             {
-                var restPath = new RestPath(requestType, attr.Path, attr.Verbs, attr.Summary, attr.Notes);
+                var restPath = new RestPath(appHost.CreateInstance, appHost.GetParseFn, requestType, attr.Path, attr.Verbs, attr.Summary, attr.Notes);
 
 
                 if (!restPath.IsValid)
                 if (!restPath.IsValid)
                     throw new NotSupportedException(string.Format(
                     throw new NotSupportedException(string.Format(
-                        "RestPath '{0}' on Type '{1}' is not Valid", attr.Path, requestType.GetOperationName()));
+                        "RestPath '{0}' on Type '{1}' is not Valid", attr.Path, requestType.GetMethodName()));
 
 
                 RegisterRestPath(restPath);
                 RegisterRestPath(restPath);
             }
             }
@@ -89,10 +118,10 @@ namespace Emby.Server.Implementations.Services
         public void RegisterRestPath(RestPath restPath)
         public void RegisterRestPath(RestPath restPath)
         {
         {
             if (!restPath.Path.StartsWith("/"))
             if (!restPath.Path.StartsWith("/"))
-                throw new ArgumentException(string.Format("Route '{0}' on '{1}' must start with a '/'", restPath.Path, restPath.RequestType.GetOperationName()));
+                throw new ArgumentException(string.Format("Route '{0}' on '{1}' must start with a '/'", restPath.Path, restPath.RequestType.GetMethodName()));
             if (restPath.Path.IndexOfAny(InvalidRouteChars) != -1)
             if (restPath.Path.IndexOfAny(InvalidRouteChars) != -1)
                 throw new ArgumentException(string.Format("Route '{0}' on '{1}' contains invalid chars. " +
                 throw new ArgumentException(string.Format("Route '{0}' on '{1}' contains invalid chars. " +
-                                            "See https://github.com/ServiceStack/ServiceStack/wiki/Routing for info on valid routes.", restPath.Path, restPath.RequestType.GetOperationName()));
+                                            "See https://github.com/ServiceStack/ServiceStack/wiki/Routing for info on valid routes.", restPath.Path, restPath.RequestType.GetMethodName()));
 
 
             List<RestPath> pathsAtFirstMatch;
             List<RestPath> pathsAtFirstMatch;
             if (!RestPathMap.TryGetValue(restPath.FirstMatchHashKey, out pathsAtFirstMatch))
             if (!RestPathMap.TryGetValue(restPath.FirstMatchHashKey, out pathsAtFirstMatch))
@@ -180,7 +209,7 @@ namespace Emby.Server.Implementations.Services
                 req.Dto = requestDto;
                 req.Dto = requestDto;
 
 
             //Executes the service and returns the result
             //Executes the service and returns the result
-            var response = await ServiceExecGeneral.Execute(serviceType, req, service, requestDto, requestType.GetOperationName()).ConfigureAwait(false);
+            var response = await ServiceExecGeneral.Execute(serviceType, req, service, requestDto, requestType.GetMethodName()).ConfigureAwait(false);
 
 
             return response;
             return response;
         }
         }

+ 2 - 3
Emby.Server.Implementations/Services/ServiceExec.cs

@@ -5,7 +5,6 @@ using System.Linq.Expressions;
 using System.Reflection;
 using System.Reflection;
 using System.Threading.Tasks;
 using System.Threading.Tasks;
 using MediaBrowser.Model.Services;
 using MediaBrowser.Model.Services;
-using ServiceStack;
 
 
 namespace Emby.Server.Implementations.Services
 namespace Emby.Server.Implementations.Services
 {
 {
@@ -84,7 +83,7 @@ namespace Emby.Server.Implementations.Services
             }
             }
 
 
             var expectedMethodName = actionName.Substring(0, 1) + actionName.Substring(1).ToLower();
             var expectedMethodName = actionName.Substring(0, 1) + actionName.Substring(1).ToLower();
-            throw new NotImplementedException(string.Format("Could not find method named {1}({0}) or Any({0}) on Service {2}", requestDto.GetType().GetOperationName(), expectedMethodName, serviceType.GetOperationName()));
+            throw new NotImplementedException(string.Format("Could not find method named {1}({0}) or Any({0}) on Service {2}", requestDto.GetType().GetMethodName(), expectedMethodName, serviceType.GetMethodName()));
         }
         }
 
 
         public static List<ServiceMethod> Reset(Type serviceType)
         public static List<ServiceMethod> Reset(Type serviceType)
@@ -99,7 +98,7 @@ namespace Emby.Server.Implementations.Services
                 var requestType = args[0].ParameterType;
                 var requestType = args[0].ParameterType;
                 var actionCtx = new ServiceMethod
                 var actionCtx = new ServiceMethod
                 {
                 {
-                    Id = ServiceMethod.Key(serviceType, actionName, requestType.GetOperationName())
+                    Id = ServiceMethod.Key(serviceType, actionName, requestType.GetMethodName())
                 };
                 };
 
 
                 try
                 try

+ 12 - 13
Emby.Server.Implementations/Services/ServiceHandler.cs

@@ -5,7 +5,6 @@ using System.Threading.Tasks;
 using Emby.Server.Implementations.HttpServer;
 using Emby.Server.Implementations.HttpServer;
 using MediaBrowser.Model.Logging;
 using MediaBrowser.Model.Logging;
 using MediaBrowser.Model.Services;
 using MediaBrowser.Model.Services;
-using ServiceStack;
 
 
 namespace Emby.Server.Implementations.Services
 namespace Emby.Server.Implementations.Services
 {
 {
@@ -59,17 +58,17 @@ namespace Emby.Server.Implementations.Services
             }
             }
         }
         }
 
 
-        protected static object CreateContentTypeRequest(IRequest httpReq, Type requestType, string contentType)
+        protected static object CreateContentTypeRequest(HttpListenerHost host, IRequest httpReq, Type requestType, string contentType)
         {
         {
             if (!string.IsNullOrEmpty(contentType) && httpReq.ContentLength > 0)
             if (!string.IsNullOrEmpty(contentType) && httpReq.ContentLength > 0)
             {
             {
-                var deserializer = RequestHelper.GetRequestReader(contentType);
+                var deserializer = RequestHelper.GetRequestReader(host, contentType);
                 if (deserializer != null)
                 if (deserializer != null)
                 {
                 {
                     return deserializer(requestType, httpReq.InputStream);
                     return deserializer(requestType, httpReq.InputStream);
                 }
                 }
             }
             }
-            return ServiceStackHost.Instance.CreateInstance(requestType); //Return an empty DTO, even for empty request bodies
+            return host.CreateInstance(requestType); 
         }
         }
 
 
         public static RestPath FindMatchingRestPath(string httpMethod, string pathInfo, ILogger logger, out string contentType)
         public static RestPath FindMatchingRestPath(string httpMethod, string pathInfo, ILogger logger, out string contentType)
@@ -137,7 +136,7 @@ namespace Emby.Server.Implementations.Services
             if (ResponseContentType != null)
             if (ResponseContentType != null)
                 httpReq.ResponseContentType = ResponseContentType;
                 httpReq.ResponseContentType = ResponseContentType;
 
 
-            var request = httpReq.Dto = CreateRequest(httpReq, restPath, logger);
+            var request = httpReq.Dto = CreateRequest(appHost, httpReq, restPath, logger);
 
 
             appHost.ApplyRequestFilters(httpReq, httpRes, request);
             appHost.ApplyRequestFilters(httpReq, httpRes, request);
 
 
@@ -146,7 +145,7 @@ namespace Emby.Server.Implementations.Services
             var response = await HandleResponseAsync(rawResponse).ConfigureAwait(false);
             var response = await HandleResponseAsync(rawResponse).ConfigureAwait(false);
 
 
             // Apply response filters
             // Apply response filters
-            foreach (var responseFilter in appHost.GlobalResponseFilters)
+            foreach (var responseFilter in appHost.ResponseFilters)
             {
             {
                 responseFilter(httpReq, httpRes, response);
                 responseFilter(httpReq, httpRes, response);
             }
             }
@@ -154,18 +153,18 @@ namespace Emby.Server.Implementations.Services
             await ResponseHelper.WriteToResponse(httpRes, httpReq, response).ConfigureAwait(false);
             await ResponseHelper.WriteToResponse(httpRes, httpReq, response).ConfigureAwait(false);
         }
         }
 
 
-        public static object CreateRequest(IRequest httpReq, RestPath restPath, ILogger logger)
+        public static object CreateRequest(HttpListenerHost host, IRequest httpReq, RestPath restPath, ILogger logger)
         {
         {
             var requestType = restPath.RequestType;
             var requestType = restPath.RequestType;
 
 
             if (RequireqRequestStream(requestType))
             if (RequireqRequestStream(requestType))
             {
             {
                 // Used by IRequiresRequestStream
                 // Used by IRequiresRequestStream
-                return CreateRequiresRequestStreamRequest(httpReq, requestType);
+                return CreateRequiresRequestStreamRequest(host, httpReq, requestType);
             }
             }
 
 
             var requestParams = GetFlattenedRequestParams(httpReq);
             var requestParams = GetFlattenedRequestParams(httpReq);
-            return CreateRequest(httpReq, restPath, requestParams);
+            return CreateRequest(host, httpReq, restPath, requestParams);
         }
         }
 
 
         private static bool RequireqRequestStream(Type requestType)
         private static bool RequireqRequestStream(Type requestType)
@@ -175,19 +174,19 @@ namespace Emby.Server.Implementations.Services
             return requiresRequestStreamTypeInfo.IsAssignableFrom(requestType.GetTypeInfo());
             return requiresRequestStreamTypeInfo.IsAssignableFrom(requestType.GetTypeInfo());
         }
         }
 
 
-        private static IRequiresRequestStream CreateRequiresRequestStreamRequest(IRequest req, Type requestType)
+        private static IRequiresRequestStream CreateRequiresRequestStreamRequest(HttpListenerHost host, IRequest req, Type requestType)
         {
         {
             var restPath = GetRoute(req);
             var restPath = GetRoute(req);
-            var request = ServiceHandler.CreateRequest(req, restPath, GetRequestParams(req), ServiceStackHost.Instance.CreateInstance(requestType));
+            var request = ServiceHandler.CreateRequest(req, restPath, GetRequestParams(req), host.CreateInstance(requestType));
 
 
             var rawReq = (IRequiresRequestStream)request;
             var rawReq = (IRequiresRequestStream)request;
             rawReq.RequestStream = req.InputStream;
             rawReq.RequestStream = req.InputStream;
             return rawReq;
             return rawReq;
         }
         }
 
 
-        public static object CreateRequest(IRequest httpReq, RestPath restPath, Dictionary<string, string> requestParams)
+        public static object CreateRequest(HttpListenerHost host, IRequest httpReq, RestPath restPath, Dictionary<string, string> requestParams)
         {
         {
-            var requestDto = CreateContentTypeRequest(httpReq, restPath.RequestType, httpReq.ContentType);
+            var requestDto = CreateContentTypeRequest(host, httpReq, restPath.RequestType, httpReq.ContentType);
 
 
             return CreateRequest(httpReq, restPath, requestParams, requestDto);
             return CreateRequest(httpReq, restPath, requestParams, requestDto);
         }
         }

+ 95 - 18
ServiceStack/RestPath.cs → Emby.Server.Implementations/Services/ServicePath.cs

@@ -1,11 +1,12 @@
 using System;
 using System;
 using System.Collections.Generic;
 using System.Collections.Generic;
+using System.IO;
 using System.Linq;
 using System.Linq;
+using System.Reflection;
 using System.Text;
 using System.Text;
 using MediaBrowser.Model.Logging;
 using MediaBrowser.Model.Logging;
-using ServiceStack.Serialization;
 
 
-namespace ServiceStack
+namespace Emby.Server.Implementations.Services
 {
 {
     public class RestPath
     public class RestPath
     {
     {
@@ -71,7 +72,7 @@ namespace ServiceStack
         public static string[] GetPathPartsForMatching(string pathInfo)
         public static string[] GetPathPartsForMatching(string pathInfo)
         {
         {
             var parts = pathInfo.ToLower().Split(PathSeperatorChar)
             var parts = pathInfo.ToLower().Split(PathSeperatorChar)
-                .Where(x => !string.IsNullOrEmpty(x)).ToArray();
+                .Where(x => !String.IsNullOrEmpty(x)).ToArray();
             return parts;
             return parts;
         }
         }
 
 
@@ -107,14 +108,14 @@ namespace ServiceStack
             return list;
             return list;
         }
         }
 
 
-        public RestPath(Type requestType, string path, string verbs, string summary = null, string notes = null)
+        public RestPath(Func<Type, object> createInstanceFn, Func<Type, Func<string, object>> getParseFn, Type requestType, string path, string verbs, string summary = null, string notes = null)
         {
         {
             this.RequestType = requestType;
             this.RequestType = requestType;
             this.Summary = summary;
             this.Summary = summary;
             this.Notes = notes;
             this.Notes = notes;
             this.restPath = path;
             this.restPath = path;
 
 
-            this.allowsAllVerbs = verbs == null || string.Equals(verbs, WildCard, StringComparison.OrdinalIgnoreCase);
+            this.allowsAllVerbs = verbs == null || String.Equals(verbs, WildCard, StringComparison.OrdinalIgnoreCase);
             if (!this.allowsAllVerbs)
             if (!this.allowsAllVerbs)
             {
             {
                 this.allowedVerbs = verbs.ToUpper();
                 this.allowedVerbs = verbs.ToUpper();
@@ -126,7 +127,7 @@ namespace ServiceStack
             var hasSeparators = new List<bool>();
             var hasSeparators = new List<bool>();
             foreach (var component in this.restPath.Split(PathSeperatorChar))
             foreach (var component in this.restPath.Split(PathSeperatorChar))
             {
             {
-                if (string.IsNullOrEmpty(component)) continue;
+                if (String.IsNullOrEmpty(component)) continue;
 
 
                 if (StringContains(component, VariablePrefix)
                 if (StringContains(component, VariablePrefix)
                     && component.IndexOf(ComponentSeperator) != -1)
                     && component.IndexOf(ComponentSeperator) != -1)
@@ -199,19 +200,95 @@ namespace ServiceStack
             this.IsValid = sbHashKey.Length > 0;
             this.IsValid = sbHashKey.Length > 0;
             this.UniqueMatchHashKey = sbHashKey.ToString();
             this.UniqueMatchHashKey = sbHashKey.ToString();
 
 
-            this.typeDeserializer = new StringMapTypeDeserializer(this.RequestType);
+            this.typeDeserializer = new StringMapTypeDeserializer(createInstanceFn, getParseFn, this.RequestType);
             RegisterCaseInsenstivePropertyNameMappings();
             RegisterCaseInsenstivePropertyNameMappings();
         }
         }
 
 
         private void RegisterCaseInsenstivePropertyNameMappings()
         private void RegisterCaseInsenstivePropertyNameMappings()
         {
         {
-            foreach (var propertyInfo in RequestType.GetSerializableProperties())
+            foreach (var propertyInfo in GetSerializableProperties(RequestType))
             {
             {
                 var propertyName = propertyInfo.Name;
                 var propertyName = propertyInfo.Name;
                 propertyNamesMap.Add(propertyName.ToLower(), propertyName);
                 propertyNamesMap.Add(propertyName.ToLower(), propertyName);
             }
             }
         }
         }
 
 
+        internal static string[] IgnoreAttributesNamed = new[] {
+            "IgnoreDataMemberAttribute",
+            "JsonIgnoreAttribute"
+        };
+
+
+        private static List<Type> _excludeTypes = new List<Type> { typeof(Stream) };
+
+        internal static PropertyInfo[] GetSerializableProperties(Type type)
+        {
+            var properties = GetPublicProperties(type);
+            var readableProperties = properties.Where(x => x.GetMethod != null);
+
+            // else return those properties that are not decorated with IgnoreDataMember
+            return readableProperties
+                .Where(prop => prop.GetCustomAttributes(true)
+                    .All(attr =>
+                    {
+                        var name = attr.GetType().Name;
+                        return !IgnoreAttributesNamed.Contains(name);
+                    }))
+                .Where(prop => !_excludeTypes.Contains(prop.PropertyType))
+                .ToArray();
+        }
+
+        private static PropertyInfo[] GetPublicProperties(Type type)
+        {
+            if (type.GetTypeInfo().IsInterface)
+            {
+                var propertyInfos = new List<PropertyInfo>();
+
+                var considered = new List<Type>();
+                var queue = new Queue<Type>();
+                considered.Add(type);
+                queue.Enqueue(type);
+
+                while (queue.Count > 0)
+                {
+                    var subType = queue.Dequeue();
+                    foreach (var subInterface in subType.GetTypeInfo().ImplementedInterfaces)
+                    {
+                        if (considered.Contains(subInterface)) continue;
+
+                        considered.Add(subInterface);
+                        queue.Enqueue(subInterface);
+                    }
+
+                    var typeProperties = GetTypesPublicProperties(subType);
+
+                    var newPropertyInfos = typeProperties
+                        .Where(x => !propertyInfos.Contains(x));
+
+                    propertyInfos.InsertRange(0, newPropertyInfos);
+                }
+
+                return propertyInfos.ToArray();
+            }
+
+            return GetTypesPublicProperties(type)
+                .Where(t => t.GetIndexParameters().Length == 0) // ignore indexed properties
+                .ToArray();
+        }
+
+        private static PropertyInfo[] GetTypesPublicProperties(Type subType)
+        {
+            var pis = new List<PropertyInfo>();
+            foreach (var pi in subType.GetRuntimeProperties())
+            {
+                var mi = pi.GetMethod ?? pi.SetMethod;
+                if (mi != null && mi.IsStatic) continue;
+                pis.Add(pi);
+            }
+            return pis.ToArray();
+        }
+
+
         public bool IsValid { get; set; }
         public bool IsValid { get; set; }
 
 
         /// <summary>
         /// <summary>
@@ -243,7 +320,7 @@ namespace ServiceStack
             score += Math.Max((10 - VariableArgsCount), 1) * 100;
             score += Math.Max((10 - VariableArgsCount), 1) * 100;
 
 
             //Exact verb match is better than ANY
             //Exact verb match is better than ANY
-            var exactVerb = string.Equals(httpMethod, AllowedVerbs, StringComparison.OrdinalIgnoreCase);
+            var exactVerb = String.Equals(httpMethod, AllowedVerbs, StringComparison.OrdinalIgnoreCase);
             score += exactVerb ? 10 : 1;
             score += exactVerb ? 10 : 1;
 
 
             return score;
             return score;
@@ -339,7 +416,7 @@ namespace ServiceStack
         private bool LiteralsEqual(string str1, string str2)
         private bool LiteralsEqual(string str1, string str2)
         {
         {
             // Most cases
             // Most cases
-            if (string.Equals(str1, str2, StringComparison.OrdinalIgnoreCase))
+            if (String.Equals(str1, str2, StringComparison.OrdinalIgnoreCase))
             {
             {
                 return true;
                 return true;
             }
             }
@@ -349,7 +426,7 @@ namespace ServiceStack
             str2 = str2.ToUpperInvariant();
             str2 = str2.ToUpperInvariant();
 
 
             // Invariant IgnoreCase would probably be better but it's not available in PCL
             // Invariant IgnoreCase would probably be better but it's not available in PCL
-            return string.Equals(str1, str2, StringComparison.CurrentCultureIgnoreCase);
+            return String.Equals(str1, str2, StringComparison.CurrentCultureIgnoreCase);
         }
         }
 
 
         private bool ExplodeComponents(ref string[] withPathInfoParts)
         private bool ExplodeComponents(ref string[] withPathInfoParts)
@@ -358,7 +435,7 @@ namespace ServiceStack
             for (var i = 0; i < withPathInfoParts.Length; i++)
             for (var i = 0; i < withPathInfoParts.Length; i++)
             {
             {
                 var component = withPathInfoParts[i];
                 var component = withPathInfoParts[i];
-                if (string.IsNullOrEmpty(component)) continue;
+                if (String.IsNullOrEmpty(component)) continue;
 
 
                 if (this.PathComponentsCount != this.TotalComponentsCount
                 if (this.PathComponentsCount != this.TotalComponentsCount
                     && this.componentsWithSeparators[i])
                     && this.componentsWithSeparators[i])
@@ -380,7 +457,7 @@ namespace ServiceStack
         public object CreateRequest(string pathInfo, Dictionary<string, string> queryStringAndFormData, object fromInstance)
         public object CreateRequest(string pathInfo, Dictionary<string, string> queryStringAndFormData, object fromInstance)
         {
         {
             var requestComponents = pathInfo.Split(PathSeperatorChar)
             var requestComponents = pathInfo.Split(PathSeperatorChar)
-                .Where(x => !string.IsNullOrEmpty(x)).ToArray();
+                .Where(x => !String.IsNullOrEmpty(x)).ToArray();
 
 
             ExplodeComponents(ref requestComponents);
             ExplodeComponents(ref requestComponents);
 
 
@@ -390,7 +467,7 @@ namespace ServiceStack
                     && requestComponents.Length >= this.TotalComponentsCount - this.wildcardCount;
                     && requestComponents.Length >= this.TotalComponentsCount - this.wildcardCount;
 
 
                 if (!isValidWildCardPath)
                 if (!isValidWildCardPath)
-                    throw new ArgumentException(string.Format(
+                    throw new ArgumentException(String.Format(
                         "Path Mismatch: Request Path '{0}' has invalid number of components compared to: '{1}'",
                         "Path Mismatch: Request Path '{0}' has invalid number of components compared to: '{1}'",
                         pathInfo, this.restPath));
                         pathInfo, this.restPath));
             }
             }
@@ -409,14 +486,14 @@ namespace ServiceStack
                 string propertyNameOnRequest;
                 string propertyNameOnRequest;
                 if (!this.propertyNamesMap.TryGetValue(variableName.ToLower(), out propertyNameOnRequest))
                 if (!this.propertyNamesMap.TryGetValue(variableName.ToLower(), out propertyNameOnRequest))
                 {
                 {
-                    if (string.Equals("ignore", variableName, StringComparison.OrdinalIgnoreCase))
+                    if (String.Equals("ignore", variableName, StringComparison.OrdinalIgnoreCase))
                     {
                     {
                         pathIx++;
                         pathIx++;
                         continue;
                         continue;
                     }
                     }
 
 
                     throw new ArgumentException("Could not find property "
                     throw new ArgumentException("Could not find property "
-                        + variableName + " on " + RequestType.GetOperationName());
+                        + variableName + " on " + RequestType.GetMethodName());
                 }
                 }
 
 
                 var value = requestComponents.Length > pathIx ? requestComponents[pathIx] : null; //wildcard has arg mismatch
                 var value = requestComponents.Length > pathIx ? requestComponents[pathIx] : null; //wildcard has arg mismatch
@@ -439,12 +516,12 @@ namespace ServiceStack
                         // hits a match for the next element in the definition (which must be a literal)
                         // hits a match for the next element in the definition (which must be a literal)
                         // It may consume 0 or more path parts
                         // It may consume 0 or more path parts
                         var stopLiteral = i == this.TotalComponentsCount - 1 ? null : this.literalsToMatch[i + 1];
                         var stopLiteral = i == this.TotalComponentsCount - 1 ? null : this.literalsToMatch[i + 1];
-                        if (!string.Equals(requestComponents[pathIx], stopLiteral, StringComparison.OrdinalIgnoreCase))
+                        if (!String.Equals(requestComponents[pathIx], stopLiteral, StringComparison.OrdinalIgnoreCase))
                         {
                         {
                             var sb = new StringBuilder();
                             var sb = new StringBuilder();
                             sb.Append(value);
                             sb.Append(value);
                             pathIx++;
                             pathIx++;
-                            while (!string.Equals(requestComponents[pathIx], stopLiteral, StringComparison.OrdinalIgnoreCase))
+                            while (!String.Equals(requestComponents[pathIx], stopLiteral, StringComparison.OrdinalIgnoreCase))
                             {
                             {
                                 sb.Append(PathSeperatorChar + requestComponents[pathIx++]);
                                 sb.Append(PathSeperatorChar + requestComponents[pathIx++]);
                             }
                             }

+ 10 - 7
ServiceStack/StringMapTypeDeserializer.cs → Emby.Server.Implementations/Services/StringMapTypeDeserializer.cs

@@ -1,10 +1,9 @@
 using System;
 using System;
 using System.Collections.Generic;
 using System.Collections.Generic;
-using System.Runtime.Serialization;
 using System.Linq;
 using System.Linq;
 using System.Reflection;
 using System.Reflection;
 
 
-namespace ServiceStack.Serialization
+namespace Emby.Server.Implementations.Services
 {
 {
     /// <summary>
     /// <summary>
     /// Serializer cache of delegates required to create a type from a string map (e.g. for REST urls)
     /// Serializer cache of delegates required to create a type from a string map (e.g. for REST urls)
@@ -30,18 +29,22 @@ namespace ServiceStack.Serialization
 
 
         public Func<string, object> GetParseFn(Type propertyType)
         public Func<string, object> GetParseFn(Type propertyType)
         {
         {
-            //Don't JSV-decode string values for string properties
             if (propertyType == typeof(string))
             if (propertyType == typeof(string))
                 return s => s;
                 return s => s;
 
 
-            return ServiceStackHost.Instance.GetParseFn(propertyType);
+            return _GetParseFn(propertyType);
         }
         }
 
 
-        public StringMapTypeDeserializer(Type type)
+        private readonly Func<Type, object> _CreateInstanceFn;
+        private readonly Func<Type, Func<string, object>> _GetParseFn;
+
+        public StringMapTypeDeserializer(Func<Type, object> createInstanceFn, Func<Type, Func<string, object>> getParseFn, Type type)
         {
         {
+            _CreateInstanceFn = createInstanceFn;
+            _GetParseFn = getParseFn;
             this.type = type;
             this.type = type;
 
 
-            foreach (var propertyInfo in type.GetSerializableProperties())
+            foreach (var propertyInfo in RestPath.GetSerializableProperties(type))
             {
             {
                 var propertySetFn = TypeAccessor.GetSetPropertyMethod(type, propertyInfo);
                 var propertySetFn = TypeAccessor.GetSetPropertyMethod(type, propertyInfo);
                 var propertyType = propertyInfo.PropertyType;
                 var propertyType = propertyInfo.PropertyType;
@@ -59,7 +62,7 @@ namespace ServiceStack.Serialization
             PropertySerializerEntry propertySerializerEntry = null;
             PropertySerializerEntry propertySerializerEntry = null;
 
 
             if (instance == null)
             if (instance == null)
-                instance = ServiceStackHost.Instance.CreateInstance(type);
+                instance = _CreateInstanceFn(type);
 
 
             foreach (var pair in keyValuePairs.Where(x => !string.IsNullOrEmpty(x.Value)))
             foreach (var pair in keyValuePairs.Where(x => !string.IsNullOrEmpty(x.Value)))
             {
             {

+ 2 - 2
ServiceStack/UrlExtensions.cs → Emby.Server.Implementations/Services/UrlExtensions.cs

@@ -1,6 +1,6 @@
 using System;
 using System;
 
 
-namespace ServiceStack
+namespace Emby.Server.Implementations.Services
 {
 {
     /// <summary>
     /// <summary>
     /// Donated by Ivan Korneliuk from his post:
     /// Donated by Ivan Korneliuk from his post:
@@ -10,7 +10,7 @@ namespace ServiceStack
     /// </summary>
     /// </summary>
     public static class UrlExtensions
     public static class UrlExtensions
     {
     {
-        public static string GetOperationName(this Type type)
+        public static string GetMethodName(this Type type)
         {
         {
             var typeName = type.FullName != null //can be null, e.g. generic types
             var typeName = type.FullName != null //can be null, e.g. generic types
                 ? LeftPart(type.FullName, "[[")   //Generic Fullname
                 ? LeftPart(type.FullName, "[[")   //Generic Fullname

+ 0 - 18
MediaBrowser.Mono.sln

@@ -47,8 +47,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Emby.Drawing.ImageMagick",
 EndProject
 EndProject
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Emby.Drawing.Net", "Emby.Drawing.Net\Emby.Drawing.Net.csproj", "{C97A239E-A96C-4D64-A844-CCF8CC30AECB}"
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Emby.Drawing.Net", "Emby.Drawing.Net\Emby.Drawing.Net.csproj", "{C97A239E-A96C-4D64-A844-CCF8CC30AECB}"
 EndProject
 EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ServiceStack", "ServiceStack\ServiceStack.csproj", "{680A1709-25EB-4D52-A87F-EE03FFD94BAA}"
-EndProject
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SocketHttpListener.Portable", "SocketHttpListener.Portable\SocketHttpListener.Portable.csproj", "{4F26D5D8-A7B0-42B3-BA42-7CB7D245934E}"
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SocketHttpListener.Portable", "SocketHttpListener.Portable\SocketHttpListener.Portable.csproj", "{4F26D5D8-A7B0-42B3-BA42-7CB7D245934E}"
 EndProject
 EndProject
 Global
 Global
@@ -386,22 +384,6 @@ Global
 		{C97A239E-A96C-4D64-A844-CCF8CC30AECB}.Signed|Any CPU.Build.0 = Release|Any CPU
 		{C97A239E-A96C-4D64-A844-CCF8CC30AECB}.Signed|Any CPU.Build.0 = Release|Any CPU
 		{C97A239E-A96C-4D64-A844-CCF8CC30AECB}.Signed|x86.ActiveCfg = Release|Any CPU
 		{C97A239E-A96C-4D64-A844-CCF8CC30AECB}.Signed|x86.ActiveCfg = Release|Any CPU
 		{C97A239E-A96C-4D64-A844-CCF8CC30AECB}.Signed|x86.Build.0 = Release|Any CPU
 		{C97A239E-A96C-4D64-A844-CCF8CC30AECB}.Signed|x86.Build.0 = Release|Any CPU
-		{680A1709-25EB-4D52-A87F-EE03FFD94BAA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
-		{680A1709-25EB-4D52-A87F-EE03FFD94BAA}.Debug|Any CPU.Build.0 = Debug|Any CPU
-		{680A1709-25EB-4D52-A87F-EE03FFD94BAA}.Debug|x86.ActiveCfg = Debug|Any CPU
-		{680A1709-25EB-4D52-A87F-EE03FFD94BAA}.Debug|x86.Build.0 = Debug|Any CPU
-		{680A1709-25EB-4D52-A87F-EE03FFD94BAA}.Release Mono|Any CPU.ActiveCfg = Release|Any CPU
-		{680A1709-25EB-4D52-A87F-EE03FFD94BAA}.Release Mono|Any CPU.Build.0 = Release|Any CPU
-		{680A1709-25EB-4D52-A87F-EE03FFD94BAA}.Release Mono|x86.ActiveCfg = Release|Any CPU
-		{680A1709-25EB-4D52-A87F-EE03FFD94BAA}.Release Mono|x86.Build.0 = Release|Any CPU
-		{680A1709-25EB-4D52-A87F-EE03FFD94BAA}.Release|Any CPU.ActiveCfg = Release|Any CPU
-		{680A1709-25EB-4D52-A87F-EE03FFD94BAA}.Release|Any CPU.Build.0 = Release|Any CPU
-		{680A1709-25EB-4D52-A87F-EE03FFD94BAA}.Release|x86.ActiveCfg = Release|Any CPU
-		{680A1709-25EB-4D52-A87F-EE03FFD94BAA}.Release|x86.Build.0 = Release|Any CPU
-		{680A1709-25EB-4D52-A87F-EE03FFD94BAA}.Signed|Any CPU.ActiveCfg = Signed|Any CPU
-		{680A1709-25EB-4D52-A87F-EE03FFD94BAA}.Signed|Any CPU.Build.0 = Signed|Any CPU
-		{680A1709-25EB-4D52-A87F-EE03FFD94BAA}.Signed|x86.ActiveCfg = Signed|Any CPU
-		{680A1709-25EB-4D52-A87F-EE03FFD94BAA}.Signed|x86.Build.0 = Signed|Any CPU
 		{4F26D5D8-A7B0-42B3-BA42-7CB7D245934E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
 		{4F26D5D8-A7B0-42B3-BA42-7CB7D245934E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
 		{4F26D5D8-A7B0-42B3-BA42-7CB7D245934E}.Debug|Any CPU.Build.0 = Debug|Any CPU
 		{4F26D5D8-A7B0-42B3-BA42-7CB7D245934E}.Debug|Any CPU.Build.0 = Debug|Any CPU
 		{4F26D5D8-A7B0-42B3-BA42-7CB7D245934E}.Debug|x86.ActiveCfg = Debug|Any CPU
 		{4F26D5D8-A7B0-42B3-BA42-7CB7D245934E}.Debug|x86.ActiveCfg = Debug|Any CPU

+ 48 - 7
MediaBrowser.Providers/Music/MusicBrainzAlbumProvider.cs

@@ -45,6 +45,7 @@ namespace MediaBrowser.Providers.Music
         public async Task<IEnumerable<RemoteSearchResult>> GetSearchResults(AlbumInfo searchInfo, CancellationToken cancellationToken)
         public async Task<IEnumerable<RemoteSearchResult>> GetSearchResults(AlbumInfo searchInfo, CancellationToken cancellationToken)
         {
         {
             var releaseId = searchInfo.GetReleaseId();
             var releaseId = searchInfo.GetReleaseId();
+            var releaseGroupId = searchInfo.GetReleaseGroupId();
 
 
             string url = null;
             string url = null;
             var isNameSearch = false;
             var isNameSearch = false;
@@ -53,6 +54,10 @@ namespace MediaBrowser.Providers.Music
             {
             {
                 url = string.Format("/ws/2/release/?query=reid:{0}", releaseId);
                 url = string.Format("/ws/2/release/?query=reid:{0}", releaseId);
             }
             }
+            else if (!string.IsNullOrEmpty(releaseGroupId))
+            {
+                url = string.Format("/ws/2/release?release-group={0}", releaseGroupId);
+            }
             else
             else
             {
             {
                 var artistMusicBrainzId = searchInfo.GetMusicBrainzArtistId();
                 var artistMusicBrainzId = searchInfo.GetMusicBrainzArtistId();
@@ -131,7 +136,14 @@ namespace MediaBrowser.Providers.Music
                 Item = new MusicAlbum()
                 Item = new MusicAlbum()
             };
             };
 
 
-            if (string.IsNullOrEmpty(releaseId))
+            // If we have a release group Id but not a release Id...
+            if (string.IsNullOrWhiteSpace(releaseId) && !string.IsNullOrWhiteSpace(releaseGroupId))
+            {
+                releaseId = await GetReleaseIdFromReleaseGroupId(releaseGroupId, cancellationToken).ConfigureAwait(false);
+                result.HasMetadata = true;
+            }
+
+            if (string.IsNullOrWhiteSpace(releaseId))
             {
             {
                 var artistMusicBrainzId = id.GetMusicBrainzArtistId();
                 var artistMusicBrainzId = id.GetMusicBrainzArtistId();
 
 
@@ -139,13 +151,13 @@ namespace MediaBrowser.Providers.Music
 
 
                 if (releaseResult != null)
                 if (releaseResult != null)
                 {
                 {
-                    if (!string.IsNullOrEmpty(releaseResult.ReleaseId))
+                    if (!string.IsNullOrWhiteSpace(releaseResult.ReleaseId))
                     {
                     {
                         releaseId = releaseResult.ReleaseId;
                         releaseId = releaseResult.ReleaseId;
                         result.HasMetadata = true;
                         result.HasMetadata = true;
                     }
                     }
 
 
-                    if (!string.IsNullOrEmpty(releaseResult.ReleaseGroupId))
+                    if (!string.IsNullOrWhiteSpace(releaseResult.ReleaseGroupId))
                     {
                     {
                         releaseGroupId = releaseResult.ReleaseGroupId;
                         releaseGroupId = releaseResult.ReleaseGroupId;
                         result.HasMetadata = true;
                         result.HasMetadata = true;
@@ -157,13 +169,13 @@ namespace MediaBrowser.Providers.Music
             }
             }
 
 
             // If we have a release Id but not a release group Id...
             // If we have a release Id but not a release group Id...
-            if (!string.IsNullOrEmpty(releaseId) && string.IsNullOrEmpty(releaseGroupId))
+            if (!string.IsNullOrWhiteSpace(releaseId) && string.IsNullOrWhiteSpace(releaseGroupId))
             {
             {
-                releaseGroupId = await GetReleaseGroupId(releaseId, cancellationToken).ConfigureAwait(false);
+                releaseGroupId = await GetReleaseGroupFromReleaseId(releaseId, cancellationToken).ConfigureAwait(false);
                 result.HasMetadata = true;
                 result.HasMetadata = true;
             }
             }
 
 
-            if (!string.IsNullOrEmpty(releaseId) || !string.IsNullOrEmpty(releaseGroupId))
+            if (!string.IsNullOrWhiteSpace(releaseId) || !string.IsNullOrWhiteSpace(releaseGroupId))
             {
             {
                 result.HasMetadata = true;
                 result.HasMetadata = true;
             }
             }
@@ -411,13 +423,42 @@ namespace MediaBrowser.Providers.Music
             }
             }
         }
         }
 
 
+        private async Task<string> GetReleaseIdFromReleaseGroupId(string releaseGroupId, CancellationToken cancellationToken)
+        {
+            var url = string.Format("/ws/2/release?release-group={0}", releaseGroupId);
+
+            using (var stream = await GetMusicBrainzResponse(url, true, cancellationToken).ConfigureAwait(false))
+            {
+                using (var oReader = new StreamReader(stream, Encoding.UTF8))
+                {
+                    var settings = _xmlSettings.Create(false);
+
+                    settings.CheckCharacters = false;
+                    settings.IgnoreProcessingInstructions = true;
+                    settings.IgnoreComments = true;
+
+                    using (var reader = XmlReader.Create(oReader, settings))
+                    {
+                        var result = ReleaseResult.Parse(reader).FirstOrDefault();
+
+                        if (result != null)
+                        {
+                            return result.ReleaseId;
+                        }
+                    }
+                }
+            }
+
+            return null;
+        }
+
         /// <summary>
         /// <summary>
         /// Gets the release group id internal.
         /// Gets the release group id internal.
         /// </summary>
         /// </summary>
         /// <param name="releaseEntryId">The release entry id.</param>
         /// <param name="releaseEntryId">The release entry id.</param>
         /// <param name="cancellationToken">The cancellation token.</param>
         /// <param name="cancellationToken">The cancellation token.</param>
         /// <returns>Task{System.String}.</returns>
         /// <returns>Task{System.String}.</returns>
-        private async Task<string> GetReleaseGroupId(string releaseEntryId, CancellationToken cancellationToken)
+        private async Task<string> GetReleaseGroupFromReleaseId(string releaseEntryId, CancellationToken cancellationToken)
         {
         {
             var url = string.Format("/ws/2/release-group/?query=reid:{0}", releaseEntryId);
             var url = string.Format("/ws/2/release-group/?query=reid:{0}", releaseEntryId);
 
 

+ 2 - 3
MediaBrowser.Providers/Omdb/OmdbItemProvider.cs

@@ -18,8 +18,6 @@ using System.Linq;
 using System.Net;
 using System.Net;
 using System.Threading;
 using System.Threading;
 using System.Threading.Tasks;
 using System.Threading.Tasks;
-using MediaBrowser.Common.IO;
-using MediaBrowser.Controller.IO;
 
 
 namespace MediaBrowser.Providers.Omdb
 namespace MediaBrowser.Providers.Omdb
 {
 {
@@ -74,7 +72,8 @@ namespace MediaBrowser.Providers.Omdb
 
 
             var imdbId = searchInfo.GetProviderId(MetadataProviders.Imdb);
             var imdbId = searchInfo.GetProviderId(MetadataProviders.Imdb);
 
 
-            var url = "https://www.omdbapi.com/?plot=full&r=json";
+            var baseUrl = await OmdbProvider.GetOmdbBaseUrl(cancellationToken).ConfigureAwait(false);
+            var url = baseUrl + "/?plot=full&r=json";
             if (type == "episode" && episodeSearchInfo != null)
             if (type == "episode" && episodeSearchInfo != null)
             {
             {
                 episodeSearchInfo.SeriesProviderIds.TryGetValue(MetadataProviders.Imdb.ToString(), out imdbId);
                 episodeSearchInfo.SeriesProviderIds.TryGetValue(MetadataProviders.Imdb.ToString(), out imdbId);

+ 9 - 2
MediaBrowser.Providers/Omdb/OmdbProvider.cs

@@ -272,6 +272,11 @@ namespace MediaBrowser.Providers.Omdb
             return false;
             return false;
         }
         }
 
 
+        public static async Task<string> GetOmdbBaseUrl(CancellationToken cancellationToken)
+        {
+            return "https://www.omdbapi.com";
+        }
+
         private async Task<string> EnsureItemInfo(string imdbId, CancellationToken cancellationToken)
         private async Task<string> EnsureItemInfo(string imdbId, CancellationToken cancellationToken)
         {
         {
             if (string.IsNullOrWhiteSpace(imdbId))
             if (string.IsNullOrWhiteSpace(imdbId))
@@ -294,7 +299,8 @@ namespace MediaBrowser.Providers.Omdb
                 }
                 }
             }
             }
 
 
-            var url = string.Format("https://www.omdbapi.com/?i={0}&plot=full&tomatoes=true&r=json", imdbParam);
+            var baseUrl = await GetOmdbBaseUrl(cancellationToken).ConfigureAwait(false);
+            var url = string.Format(baseUrl + "/?i={0}&plot=full&tomatoes=true&r=json", imdbParam);
 
 
             using (var stream = await GetOmdbResponse(_httpClient, url, cancellationToken).ConfigureAwait(false))
             using (var stream = await GetOmdbResponse(_httpClient, url, cancellationToken).ConfigureAwait(false))
             {
             {
@@ -328,7 +334,8 @@ namespace MediaBrowser.Providers.Omdb
                 }
                 }
             }
             }
 
 
-            var url = string.Format("https://www.omdbapi.com/?i={0}&season={1}&detail=full", imdbParam, seasonId);
+            var baseUrl = await GetOmdbBaseUrl(cancellationToken).ConfigureAwait(false);
+            var url = string.Format(baseUrl + "/?i={0}&season={1}&detail=full", imdbParam, seasonId);
 
 
             using (var stream = await GetOmdbResponse(_httpClient, url, cancellationToken).ConfigureAwait(false))
             using (var stream = await GetOmdbResponse(_httpClient, url, cancellationToken).ConfigureAwait(false))
             {
             {

+ 0 - 4
MediaBrowser.Server.Mono/MediaBrowser.Server.Mono.csproj

@@ -200,10 +200,6 @@
       <Project>{21002819-c39a-4d3e-be83-2a276a77fb1f}</Project>
       <Project>{21002819-c39a-4d3e-be83-2a276a77fb1f}</Project>
       <Name>RSSDP</Name>
       <Name>RSSDP</Name>
     </ProjectReference>
     </ProjectReference>
-    <ProjectReference Include="..\ServiceStack\ServiceStack.csproj">
-      <Project>{680a1709-25eb-4d52-a87f-ee03ffd94baa}</Project>
-      <Name>ServiceStack</Name>
-    </ProjectReference>
     <ProjectReference Include="..\SocketHttpListener.Portable\SocketHttpListener.Portable.csproj">
     <ProjectReference Include="..\SocketHttpListener.Portable\SocketHttpListener.Portable.csproj">
       <Project>{4f26d5d8-a7b0-42b3-ba42-7cb7d245934e}</Project>
       <Project>{4f26d5d8-a7b0-42b3-ba42-7cb7d245934e}</Project>
       <Name>SocketHttpListener.Portable</Name>
       <Name>SocketHttpListener.Portable</Name>

+ 0 - 4
MediaBrowser.ServerApplication/MediaBrowser.ServerApplication.csproj

@@ -1155,10 +1155,6 @@
       <Project>{21002819-c39a-4d3e-be83-2a276a77fb1f}</Project>
       <Project>{21002819-c39a-4d3e-be83-2a276a77fb1f}</Project>
       <Name>RSSDP</Name>
       <Name>RSSDP</Name>
     </ProjectReference>
     </ProjectReference>
-    <ProjectReference Include="..\ServiceStack\ServiceStack.csproj">
-      <Project>{680a1709-25eb-4d52-a87f-ee03ffd94baa}</Project>
-      <Name>ServiceStack</Name>
-    </ProjectReference>
     <ProjectReference Include="..\SocketHttpListener.Portable\SocketHttpListener.Portable.csproj">
     <ProjectReference Include="..\SocketHttpListener.Portable\SocketHttpListener.Portable.csproj">
       <Project>{4f26d5d8-a7b0-42b3-ba42-7cb7d245934e}</Project>
       <Project>{4f26d5d8-a7b0-42b3-ba42-7cb7d245934e}</Project>
       <Name>SocketHttpListener.Portable</Name>
       <Name>SocketHttpListener.Portable</Name>

+ 0 - 42
MediaBrowser.sln

@@ -78,8 +78,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Emby.Drawing.ImageMagick",
 EndProject
 EndProject
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Emby.Drawing.Net", "Emby.Drawing.Net\Emby.Drawing.Net.csproj", "{C97A239E-A96C-4D64-A844-CCF8CC30AECB}"
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Emby.Drawing.Net", "Emby.Drawing.Net\Emby.Drawing.Net.csproj", "{C97A239E-A96C-4D64-A844-CCF8CC30AECB}"
 EndProject
 EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ServiceStack", "ServiceStack\ServiceStack.csproj", "{680A1709-25EB-4D52-A87F-EE03FFD94BAA}"
-EndProject
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SocketHttpListener.Portable", "SocketHttpListener.Portable\SocketHttpListener.Portable.csproj", "{4F26D5D8-A7B0-42B3-BA42-7CB7D245934E}"
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SocketHttpListener.Portable", "SocketHttpListener.Portable\SocketHttpListener.Portable.csproj", "{4F26D5D8-A7B0-42B3-BA42-7CB7D245934E}"
 EndProject
 EndProject
 Global
 Global
@@ -1061,46 +1059,6 @@ Global
 		{C97A239E-A96C-4D64-A844-CCF8CC30AECB}.Signed|x64.Build.0 = Release|Any CPU
 		{C97A239E-A96C-4D64-A844-CCF8CC30AECB}.Signed|x64.Build.0 = Release|Any CPU
 		{C97A239E-A96C-4D64-A844-CCF8CC30AECB}.Signed|x86.ActiveCfg = Release|Any CPU
 		{C97A239E-A96C-4D64-A844-CCF8CC30AECB}.Signed|x86.ActiveCfg = Release|Any CPU
 		{C97A239E-A96C-4D64-A844-CCF8CC30AECB}.Signed|x86.Build.0 = Release|Any CPU
 		{C97A239E-A96C-4D64-A844-CCF8CC30AECB}.Signed|x86.Build.0 = Release|Any CPU
-		{680A1709-25EB-4D52-A87F-EE03FFD94BAA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
-		{680A1709-25EB-4D52-A87F-EE03FFD94BAA}.Debug|Any CPU.Build.0 = Debug|Any CPU
-		{680A1709-25EB-4D52-A87F-EE03FFD94BAA}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
-		{680A1709-25EB-4D52-A87F-EE03FFD94BAA}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
-		{680A1709-25EB-4D52-A87F-EE03FFD94BAA}.Debug|Win32.ActiveCfg = Debug|Any CPU
-		{680A1709-25EB-4D52-A87F-EE03FFD94BAA}.Debug|Win32.Build.0 = Debug|Any CPU
-		{680A1709-25EB-4D52-A87F-EE03FFD94BAA}.Debug|x64.ActiveCfg = Debug|Any CPU
-		{680A1709-25EB-4D52-A87F-EE03FFD94BAA}.Debug|x64.Build.0 = Debug|Any CPU
-		{680A1709-25EB-4D52-A87F-EE03FFD94BAA}.Debug|x86.ActiveCfg = Debug|Any CPU
-		{680A1709-25EB-4D52-A87F-EE03FFD94BAA}.Debug|x86.Build.0 = Debug|Any CPU
-		{680A1709-25EB-4D52-A87F-EE03FFD94BAA}.Release Mono|Any CPU.ActiveCfg = Release|Any CPU
-		{680A1709-25EB-4D52-A87F-EE03FFD94BAA}.Release Mono|Any CPU.Build.0 = Release|Any CPU
-		{680A1709-25EB-4D52-A87F-EE03FFD94BAA}.Release Mono|Mixed Platforms.ActiveCfg = Release|Any CPU
-		{680A1709-25EB-4D52-A87F-EE03FFD94BAA}.Release Mono|Mixed Platforms.Build.0 = Release|Any CPU
-		{680A1709-25EB-4D52-A87F-EE03FFD94BAA}.Release Mono|Win32.ActiveCfg = Release|Any CPU
-		{680A1709-25EB-4D52-A87F-EE03FFD94BAA}.Release Mono|Win32.Build.0 = Release|Any CPU
-		{680A1709-25EB-4D52-A87F-EE03FFD94BAA}.Release Mono|x64.ActiveCfg = Release|Any CPU
-		{680A1709-25EB-4D52-A87F-EE03FFD94BAA}.Release Mono|x64.Build.0 = Release|Any CPU
-		{680A1709-25EB-4D52-A87F-EE03FFD94BAA}.Release Mono|x86.ActiveCfg = Release|Any CPU
-		{680A1709-25EB-4D52-A87F-EE03FFD94BAA}.Release Mono|x86.Build.0 = Release|Any CPU
-		{680A1709-25EB-4D52-A87F-EE03FFD94BAA}.Release|Any CPU.ActiveCfg = Release|Any CPU
-		{680A1709-25EB-4D52-A87F-EE03FFD94BAA}.Release|Any CPU.Build.0 = Release|Any CPU
-		{680A1709-25EB-4D52-A87F-EE03FFD94BAA}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
-		{680A1709-25EB-4D52-A87F-EE03FFD94BAA}.Release|Mixed Platforms.Build.0 = Release|Any CPU
-		{680A1709-25EB-4D52-A87F-EE03FFD94BAA}.Release|Win32.ActiveCfg = Release|Any CPU
-		{680A1709-25EB-4D52-A87F-EE03FFD94BAA}.Release|Win32.Build.0 = Release|Any CPU
-		{680A1709-25EB-4D52-A87F-EE03FFD94BAA}.Release|x64.ActiveCfg = Release|Any CPU
-		{680A1709-25EB-4D52-A87F-EE03FFD94BAA}.Release|x64.Build.0 = Release|Any CPU
-		{680A1709-25EB-4D52-A87F-EE03FFD94BAA}.Release|x86.ActiveCfg = Release|Any CPU
-		{680A1709-25EB-4D52-A87F-EE03FFD94BAA}.Release|x86.Build.0 = Release|Any CPU
-		{680A1709-25EB-4D52-A87F-EE03FFD94BAA}.Signed|Any CPU.ActiveCfg = Signed|Any CPU
-		{680A1709-25EB-4D52-A87F-EE03FFD94BAA}.Signed|Any CPU.Build.0 = Signed|Any CPU
-		{680A1709-25EB-4D52-A87F-EE03FFD94BAA}.Signed|Mixed Platforms.ActiveCfg = Signed|Any CPU
-		{680A1709-25EB-4D52-A87F-EE03FFD94BAA}.Signed|Mixed Platforms.Build.0 = Signed|Any CPU
-		{680A1709-25EB-4D52-A87F-EE03FFD94BAA}.Signed|Win32.ActiveCfg = Signed|Any CPU
-		{680A1709-25EB-4D52-A87F-EE03FFD94BAA}.Signed|Win32.Build.0 = Signed|Any CPU
-		{680A1709-25EB-4D52-A87F-EE03FFD94BAA}.Signed|x64.ActiveCfg = Signed|Any CPU
-		{680A1709-25EB-4D52-A87F-EE03FFD94BAA}.Signed|x64.Build.0 = Signed|Any CPU
-		{680A1709-25EB-4D52-A87F-EE03FFD94BAA}.Signed|x86.ActiveCfg = Signed|Any CPU
-		{680A1709-25EB-4D52-A87F-EE03FFD94BAA}.Signed|x86.Build.0 = Signed|Any CPU
 		{4F26D5D8-A7B0-42B3-BA42-7CB7D245934E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
 		{4F26D5D8-A7B0-42B3-BA42-7CB7D245934E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
 		{4F26D5D8-A7B0-42B3-BA42-7CB7D245934E}.Debug|Any CPU.Build.0 = Debug|Any CPU
 		{4F26D5D8-A7B0-42B3-BA42-7CB7D245934E}.Debug|Any CPU.Build.0 = Debug|Any CPU
 		{4F26D5D8-A7B0-42B3-BA42-7CB7D245934E}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
 		{4F26D5D8-A7B0-42B3-BA42-7CB7D245934E}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU

+ 0 - 25
ServiceStack/Properties/AssemblyInfo.cs

@@ -1,25 +0,0 @@
-using System.Reflection;
-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("ServiceStack")]
-[assembly: AssemblyDescription("")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("Service Stack LLC")]
-[assembly: AssemblyProduct("ServiceStack")]
-[assembly: AssemblyCopyright("Copyright (c) ServiceStack 2016")]
-[assembly: AssemblyTrademark("Service Stack")]
-[assembly: AssemblyCulture("")]
-
-// Setting ComVisible to false makes the types in this assembly not visible 
-// to COM components.  If you need to access a type in this assembly from 
-// COM, set the ComVisible attribute to true on that type.
-[assembly: ComVisible(false)]
-
-// The following GUID is for the ID of the typelib if this project is exposed to COM
-[assembly: Guid("06704d66-af8e-411f-8260-8d05de5ce6ad")]
-
-[assembly: AssemblyVersion("4.0.0.0")]
-[assembly: AssemblyFileVersion("4.0.0.0")]

+ 0 - 168
ServiceStack/ReflectionExtensions.cs

@@ -1,168 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.IO;
-using System.Linq;
-using System.Reflection;
-
-namespace ServiceStack
-{
-    public static class ReflectionExtensions
-    {
-        public static Type FirstGenericType(this Type type)
-        {
-            while (type != null)
-            {
-                if (type.IsGeneric())
-                    return type;
-
-                type = type.BaseType();
-            }
-            return null;
-        }
-
-        public static Type GetTypeWithGenericTypeDefinitionOf(this Type type, Type genericTypeDefinition)
-        {
-            foreach (var t in type.GetTypeInterfaces())
-            {
-                if (t.IsGeneric() && t.GetGenericTypeDefinition() == genericTypeDefinition)
-                {
-                    return t;
-                }
-            }
-
-            var genericType = type.FirstGenericType();
-            if (genericType != null && genericType.GetGenericTypeDefinition() == genericTypeDefinition)
-            {
-                return genericType;
-            }
-
-            return null;
-        }
-
-        public static PropertyInfo[] GetPublicProperties(this Type type)
-        {
-            if (type.IsInterface())
-            {
-                var propertyInfos = new List<PropertyInfo>();
-
-                var considered = new List<Type>();
-                var queue = new Queue<Type>();
-                considered.Add(type);
-                queue.Enqueue(type);
-
-                while (queue.Count > 0)
-                {
-                    var subType = queue.Dequeue();
-                    foreach (var subInterface in subType.GetTypeInterfaces())
-                    {
-                        if (considered.Contains(subInterface)) continue;
-
-                        considered.Add(subInterface);
-                        queue.Enqueue(subInterface);
-                    }
-
-                    var typeProperties = subType.GetTypesPublicProperties();
-
-                    var newPropertyInfos = typeProperties
-                        .Where(x => !propertyInfos.Contains(x));
-
-                    propertyInfos.InsertRange(0, newPropertyInfos);
-                }
-
-                return propertyInfos.ToArray();
-            }
-
-            return type.GetTypesPublicProperties()
-                .Where(t => t.GetIndexParameters().Length == 0) // ignore indexed properties
-                .ToArray();
-        }
-
-        public const string DataMember = "DataMemberAttribute";
-
-        internal static string[] IgnoreAttributesNamed = new[] {
-            "IgnoreDataMemberAttribute",
-            "JsonIgnoreAttribute"
-        };
-
-        public static PropertyInfo[] GetSerializableProperties(this Type type)
-        {
-            var properties = type.GetPublicProperties();
-            return properties.OnlySerializableProperties(type);
-        }
-
-
-        private static List<Type> _excludeTypes = new List<Type> { typeof(Stream) };
-
-        public static PropertyInfo[] OnlySerializableProperties(this PropertyInfo[] properties, Type type = null)
-        {
-            var readableProperties = properties.Where(x => x.PropertyGetMethod(nonPublic: false) != null);
-
-            // else return those properties that are not decorated with IgnoreDataMember
-            return readableProperties
-                .Where(prop => prop.AllAttributes()
-                    .All(attr =>
-                    {
-                        var name = attr.GetType().Name;
-                        return !IgnoreAttributesNamed.Contains(name);
-                    }))
-                .Where(prop => !_excludeTypes.Contains(prop.PropertyType))
-                .ToArray();
-        }
-    }
-
-    public static class PlatformExtensions //Because WinRT is a POS
-    {
-        public static bool IsInterface(this Type type)
-        {
-            return type.GetTypeInfo().IsInterface;
-        }
-
-        public static bool IsGeneric(this Type type)
-        {
-            return type.GetTypeInfo().IsGenericType;
-        }
-
-        public static Type BaseType(this Type type)
-        {
-            return type.GetTypeInfo().BaseType;
-        }
-
-        public static Type[] GetTypeInterfaces(this Type type)
-        {
-            return type.GetTypeInfo().ImplementedInterfaces.ToArray();
-        }
-
-        internal static PropertyInfo[] GetTypesPublicProperties(this Type subType)
-        {
-            var pis = new List<PropertyInfo>();
-            foreach (var pi in subType.GetRuntimeProperties())
-            {
-                var mi = pi.GetMethod ?? pi.SetMethod;
-                if (mi != null && mi.IsStatic) continue;
-                pis.Add(pi);
-            }
-            return pis.ToArray();
-        }
-
-        public static MethodInfo PropertyGetMethod(this PropertyInfo pi, bool nonPublic = false)
-        {
-            return pi.GetMethod;
-        }
-
-        public static object[] AllAttributes(this PropertyInfo propertyInfo)
-        {
-            return propertyInfo.GetCustomAttributes(true).ToArray();
-        }
-
-        public static object[] AllAttributes(this Type type)
-        {
-            return type.GetTypeInfo().GetCustomAttributes(true).ToArray();
-        }
-
-        public static List<TAttr> AllAttributes<TAttr>(this Type type)
-            where TAttr : Attribute
-        {
-            return type.GetTypeInfo().GetCustomAttributes<TAttr>(true).ToList();
-        }
-    }
-}

+ 0 - 117
ServiceStack/ServiceStack.csproj

@@ -1,117 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
-  <PropertyGroup>
-    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
-    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
-    <ProductVersion>9.0.30729</ProductVersion>
-    <SchemaVersion>2.0</SchemaVersion>
-    <ProjectGuid>{680A1709-25EB-4D52-A87F-EE03FFD94BAA}</ProjectGuid>
-    <OutputType>Library</OutputType>
-    <AppDesignerFolder>Properties</AppDesignerFolder>
-    <RootNamespace>ServiceStack</RootNamespace>
-    <AssemblyName>ServiceStack</AssemblyName>
-    <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
-    <TargetFrameworkProfile>Profile7</TargetFrameworkProfile>
-    <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
-    <FileAlignment>512</FileAlignment>
-    <FileUpgradeFlags>
-    </FileUpgradeFlags>
-    <OldToolsVersion>3.5</OldToolsVersion>
-    <UpgradeBackupLocation />
-    <PublishUrl>publish\</PublishUrl>
-    <Install>true</Install>
-    <InstallFrom>Disk</InstallFrom>
-    <UpdateEnabled>false</UpdateEnabled>
-    <UpdateMode>Foreground</UpdateMode>
-    <UpdateInterval>7</UpdateInterval>
-    <UpdateIntervalUnits>Days</UpdateIntervalUnits>
-    <UpdatePeriodically>false</UpdatePeriodically>
-    <UpdateRequired>false</UpdateRequired>
-    <MapFileExtensions>true</MapFileExtensions>
-    <ApplicationRevision>0</ApplicationRevision>
-    <ApplicationVersion>1.0.0.%2a</ApplicationVersion>
-    <IsWebBootstrapper>false</IsWebBootstrapper>
-    <UseApplicationTrust>false</UseApplicationTrust>
-    <BootstrapperEnabled>true</BootstrapperEnabled>
-  </PropertyGroup>
-  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
-    <DebugSymbols>True</DebugSymbols>
-    <DebugType>full</DebugType>
-    <Optimize>False</Optimize>
-    <OutputPath>bin\Debug\</OutputPath>
-    <DefineConstants>TRACE;DEBUG;MONO</DefineConstants>
-    <ErrorReport>prompt</ErrorReport>
-    <WarningLevel>4</WarningLevel>
-    <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
-    <Prefer32Bit>false</Prefer32Bit>
-  </PropertyGroup>
-  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
-    <DebugType>pdbonly</DebugType>
-    <Optimize>True</Optimize>
-    <OutputPath>bin\Release\</OutputPath>
-    <DefineConstants>TRACE</DefineConstants>
-    <ErrorReport>prompt</ErrorReport>
-    <WarningLevel>4</WarningLevel>
-    <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
-    <DocumentationFile>
-    </DocumentationFile>
-    <Prefer32Bit>false</Prefer32Bit>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Signed|AnyCPU'">
-    <OutputPath>bin\Signed\</OutputPath>
-    <DefineConstants>TRACE</DefineConstants>
-    <DocumentationFile>bin\Release\ServiceStack.XML</DocumentationFile>
-    <Optimize>true</Optimize>
-    <DebugType>pdbonly</DebugType>
-    <PlatformTarget>AnyCPU</PlatformTarget>
-    <ErrorReport>prompt</ErrorReport>
-    <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
-    <Prefer32Bit>false</Prefer32Bit>
-  </PropertyGroup>
-  <ItemGroup>
-    <Compile Include="ReflectionExtensions.cs" />
-    <Compile Include="StringMapTypeDeserializer.cs" />
-    <Compile Include="ServiceStackHost.cs" />
-    <Compile Include="UrlExtensions.cs" />
-    <Compile Include="RestPath.cs" />
-    <Compile Include="Properties\AssemblyInfo.cs" />
-  </ItemGroup>
-  <ItemGroup>
-    <None Include="packages.config" />
-  </ItemGroup>
-  <ItemGroup>
-    <BootstrapperPackage Include="Microsoft.Net.Client.3.5">
-      <Visible>False</Visible>
-      <ProductName>.NET Framework 3.5 SP1 Client Profile</ProductName>
-      <Install>false</Install>
-    </BootstrapperPackage>
-    <BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
-      <Visible>False</Visible>
-      <ProductName>.NET Framework 3.5 SP1</ProductName>
-      <Install>true</Install>
-    </BootstrapperPackage>
-    <BootstrapperPackage Include="Microsoft.Windows.Installer.3.1">
-      <Visible>False</Visible>
-      <ProductName>Windows Installer 3.1</ProductName>
-      <Install>true</Install>
-    </BootstrapperPackage>
-  </ItemGroup>
-  <Import Project="$(MSBuildExtensionsPath32)\Microsoft\Portable\$(TargetFrameworkVersion)\Microsoft.Portable.CSharp.targets" />
-  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
-       Other similar extension points exist, see Microsoft.Common.targets.
-  <Target Name="BeforeBuild">
-  </Target>
-  <Target Name="AfterBuild">
-  </Target>
-  -->
-  <ItemGroup>
-    <ProjectReference Include="..\MediaBrowser.Common\MediaBrowser.Common.csproj">
-      <Project>{9142eefa-7570-41e1-bfcc-468bb571af2f}</Project>
-      <Name>MediaBrowser.Common</Name>
-    </ProjectReference>
-    <ProjectReference Include="..\MediaBrowser.Model\MediaBrowser.Model.csproj">
-      <Project>{7eeeb4bb-f3e8-48fc-b4c5-70f0fff8329b}</Project>
-      <Name>MediaBrowser.Model</Name>
-    </ProjectReference>
-  </ItemGroup>
-</Project>

+ 0 - 6
ServiceStack/ServiceStack.nuget.targets

@@ -1,6 +0,0 @@
-<?xml version="1.0" encoding="utf-8" standalone="no"?>
-<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-  <Target Name="EmitMSBuildWarning" BeforeTargets="Build">
-    <Warning Text="Packages containing MSBuild targets and props files cannot be fully installed in projects targeting multiple frameworks. The MSBuild targets and props files have been ignored." />
-  </Target>
-</Project>

+ 0 - 42
ServiceStack/ServiceStackHost.cs

@@ -1,42 +0,0 @@
-// Copyright (c) Service Stack LLC. All Rights Reserved.
-// License: https://raw.github.com/ServiceStack/ServiceStack/master/license.txt
-
-
-using System;
-using System.Collections.Generic;
-using System.IO;
-using System.Threading.Tasks;
-using MediaBrowser.Model.Services;
-
-namespace ServiceStack
-{
-    public abstract class ServiceStackHost : IDisposable
-    {
-        public static ServiceStackHost Instance { get; protected set; }
-
-        protected ServiceStackHost()
-        {
-            GlobalResponseFilters = new List<Action<IRequest, IResponse, object>>();
-        }
-
-        public abstract object CreateInstance(Type type);
-
-        public List<Action<IRequest, IResponse, object>> GlobalResponseFilters { get; set; }
-
-        public abstract RouteAttribute[] GetRouteAttributes(Type requestType);
-
-        public abstract Func<string, object> GetParseFn(Type propertyType);
-
-        public abstract void SerializeToJson(object o, Stream stream);
-        public abstract void SerializeToXml(object o, Stream stream);
-        public abstract object DeserializeXml(Type type, Stream stream);
-        public abstract object DeserializeJson(Type type, Stream stream);
-
-        public virtual void Dispose()
-        {
-            //JsConfig.Reset(); //Clears Runtime Attributes
-
-            Instance = null;
-        }
-    }
-}

+ 0 - 3
ServiceStack/packages.config

@@ -1,3 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<packages>
-</packages>

+ 0 - 17
ServiceStack/project.json

@@ -1,17 +0,0 @@
-{
-    "frameworks":{
-        "netstandard1.6":{
-           "dependencies":{
-                "NETStandard.Library":"1.6.0",
-            }
-        },
-        ".NETPortable,Version=v4.5,Profile=Profile7":{
-            "buildOptions": {
-                "define": [  ]
-            },
-            "frameworkAssemblies":{
-                
-            }
-        }
-    }
-}

+ 1 - 1
SharedVersion.cs

@@ -1,3 +1,3 @@
 using System.Reflection;
 using System.Reflection;
 
 
-[assembly: AssemblyVersion("3.2.1.104")]
+[assembly: AssemblyVersion("3.2.1.105")]