From 1ad990ad720931309afadd9f7912d66595dcc04e Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Sat, 19 Aug 2017 15:43:35 -0400 Subject: update live tv data transfer --- .../Services/ServiceController.cs | 40 ++++------------------ 1 file changed, 7 insertions(+), 33 deletions(-) (limited to 'Emby.Server.Implementations/Services/ServiceController.cs') diff --git a/Emby.Server.Implementations/Services/ServiceController.cs b/Emby.Server.Implementations/Services/ServiceController.cs index 4ad56411a..c3970b22f 100644 --- a/Emby.Server.Implementations/Services/ServiceController.cs +++ b/Emby.Server.Implementations/Services/ServiceController.cs @@ -29,13 +29,6 @@ namespace Emby.Server.Implementations.Services } } - private Type[] GetGenericArguments(Type type) - { - return type.GetTypeInfo().IsGenericTypeDefinition - ? type.GetTypeInfo().GenericTypeParameters - : type.GetTypeInfo().GenericTypeArguments; - } - public void RegisterService(HttpListenerHost appHost, Type serviceType) { var processedReqs = new HashSet(); @@ -50,38 +43,19 @@ namespace Emby.Server.Implementations.Services ServiceExecGeneral.CreateServiceRunnersFor(requestType, actions); - var returnMarker = GetTypeWithGenericTypeDefinitionOf(requestType, typeof(IReturn<>)); - var responseType = returnMarker != null ? - GetGenericArguments(returnMarker)[0] - : mi.ReturnType != typeof(object) && mi.ReturnType != typeof(void) ? - mi.ReturnType - : Type.GetType(requestType.FullName + "Response"); + //var returnMarker = GetTypeWithGenericTypeDefinitionOf(requestType, typeof(IReturn<>)); + //var responseType = returnMarker != null ? + // GetGenericArguments(returnMarker)[0] + // : mi.ReturnType != typeof(object) && mi.ReturnType != typeof(void) ? + // mi.ReturnType + // : Type.GetType(requestType.FullName + "Response"); RegisterRestPaths(appHost, requestType); - appHost.AddServiceInfo(serviceType, requestType, responseType); + appHost.AddServiceInfo(serviceType, requestType); } } - 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) -- cgit v1.2.3