diff options
| author | David <davidullmer@outlook.de> | 2020-08-03 20:22:21 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-08-03 20:22:21 +0200 |
| commit | a28d00eebaec733d0c3b4e85da95c1e466189883 (patch) | |
| tree | 3a1149b8f71b6ca940e0ca9acf52c0fb8b23e7e7 /Emby.Server.Implementations/Services/ServiceController.cs | |
| parent | 6a42a48c09b8125e96daa057f755bc67ce7bac37 (diff) | |
| parent | dbeeb7cf4a715580432232c7098e4d86afccb37c (diff) | |
Merge pull request #3808 from crobibero/api-migration-merge
Merge master into api-migration
Diffstat (limited to 'Emby.Server.Implementations/Services/ServiceController.cs')
| -rw-r--r-- | Emby.Server.Implementations/Services/ServiceController.cs | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/Emby.Server.Implementations/Services/ServiceController.cs b/Emby.Server.Implementations/Services/ServiceController.cs index 857df591a..47e7261e8 100644 --- a/Emby.Server.Implementations/Services/ServiceController.cs +++ b/Emby.Server.Implementations/Services/ServiceController.cs @@ -2,6 +2,7 @@ using System; using System.Collections.Generic; +using System.Globalization; using System.Threading.Tasks; using Emby.Server.Implementations.HttpServer; using MediaBrowser.Model.Services; @@ -91,12 +92,22 @@ namespace Emby.Server.Implementations.Services { if (restPath.Path[0] != '/') { - throw new ArgumentException(string.Format("Route '{0}' on '{1}' must start with a '/'", restPath.Path, restPath.RequestType.GetMethodName())); + throw new ArgumentException( + string.Format( + CultureInfo.InvariantCulture, + "Route '{0}' on '{1}' must start with a '/'", + restPath.Path, + restPath.RequestType.GetMethodName())); } if (restPath.Path.IndexOfAny(InvalidRouteChars) != -1) { - throw new ArgumentException(string.Format("Route '{0}' on '{1}' contains invalid chars. ", restPath.Path, restPath.RequestType.GetMethodName())); + throw new ArgumentException( + string.Format( + CultureInfo.InvariantCulture, + "Route '{0}' on '{1}' contains invalid chars. ", + restPath.Path, + restPath.RequestType.GetMethodName())); } if (RestPathMap.TryGetValue(restPath.FirstMatchHashKey, out List<RestPath> pathsAtFirstMatch)) @@ -179,8 +190,7 @@ namespace Emby.Server.Implementations.Services var service = httpHost.CreateInstance(serviceType); - var serviceRequiresContext = service as IRequiresRequest; - if (serviceRequiresContext != null) + if (service is IRequiresRequest serviceRequiresContext) { serviceRequiresContext.Request = req; } @@ -189,5 +199,4 @@ namespace Emby.Server.Implementations.Services return ServiceExecGeneral.Execute(serviceType, req, service, requestDto, requestType.GetMethodName()); } } - } |
