diff options
| author | Erwin de Haan <EraYaN@users.noreply.github.com> | 2019-01-13 21:46:33 +0100 |
|---|---|---|
| committer | Erwin de Haan <EraYaN@users.noreply.github.com> | 2019-01-13 21:46:33 +0100 |
| commit | e8674464373c3635243953cded42fcd2aa87d196 (patch) | |
| tree | 8087e1c5d47a525b04f3ae7e99183f68391bb410 /Emby.Server.Implementations/HttpServer | |
| parent | 65bd052f3e8682d177520af57db1c8ef5cb33262 (diff) | |
ReSharper format: conform inline 'out' parameters.
Diffstat (limited to 'Emby.Server.Implementations/HttpServer')
6 files changed, 13 insertions, 28 deletions
diff --git a/Emby.Server.Implementations/HttpServer/HttpListenerHost.cs b/Emby.Server.Implementations/HttpServer/HttpListenerHost.cs index 784b39735..6ae56c2ad 100644 --- a/Emby.Server.Implementations/HttpServer/HttpListenerHost.cs +++ b/Emby.Server.Implementations/HttpServer/HttpListenerHost.cs @@ -124,8 +124,7 @@ namespace Emby.Server.Implementations.HttpServer public Type GetServiceTypeByRequest(Type requestType) { - Type serviceType; - ServiceOperationsMap.TryGetValue(requestType, out serviceType); + ServiceOperationsMap.TryGetValue(requestType, out var serviceType); return serviceType; } @@ -215,8 +214,7 @@ namespace Emby.Server.Implementations.HttpServer var exceptionType = ex.GetType(); - int statusCode; - if (!_mapExceptionToStatusCode.TryGetValue(exceptionType, out statusCode)) + if (!_mapExceptionToStatusCode.TryGetValue(exceptionType, out var statusCode)) { if (ex is DirectoryNotFoundException) { @@ -704,8 +702,7 @@ namespace Emby.Server.Implementations.HttpServer return null; } - string contentType; - var restPath = ServiceHandler.FindMatchingRestPath(httpReq.HttpMethod, pathInfo, out contentType); + var restPath = ServiceHandler.FindMatchingRestPath(httpReq.HttpMethod, pathInfo, out var contentType); if (restPath != null) { @@ -731,8 +728,7 @@ namespace Emby.Server.Implementations.HttpServer private void RedirectToSecureUrl(IHttpRequest httpReq, IResponse httpRes, string url) { int currentPort; - Uri uri; - if (Uri.TryCreate(url, UriKind.Absolute, out uri)) + if (Uri.TryCreate(url, UriKind.Absolute, out var uri)) { currentPort = uri.Port; var builder = new UriBuilder(uri); diff --git a/Emby.Server.Implementations/HttpServer/HttpResultFactory.cs b/Emby.Server.Implementations/HttpServer/HttpResultFactory.cs index ce9dc9ad9..3cfa2bc75 100644 --- a/Emby.Server.Implementations/HttpServer/HttpResultFactory.cs +++ b/Emby.Server.Implementations/HttpServer/HttpResultFactory.cs @@ -96,8 +96,7 @@ namespace Emby.Server.Implementations.HttpServer responseHeaders = new Dictionary<string, string>(); } - string expires; - if (addCachePrevention && !responseHeaders.TryGetValue("Expires", out expires)) + if (addCachePrevention && !responseHeaders.TryGetValue("Expires", out var expires)) { responseHeaders["Expires"] = "-1"; } @@ -143,8 +142,7 @@ namespace Emby.Server.Implementations.HttpServer responseHeaders = new Dictionary<string, string>(); } - string expires; - if (addCachePrevention && !responseHeaders.TryGetValue("Expires", out expires)) + if (addCachePrevention && !responseHeaders.TryGetValue("Expires", out var expires)) { responseHeaders["Expires"] = "-1"; } @@ -188,8 +186,7 @@ namespace Emby.Server.Implementations.HttpServer responseHeaders = new Dictionary<string, string>(); } - string expires; - if (addCachePrevention && !responseHeaders.TryGetValue("Expires", out expires)) + if (addCachePrevention && !responseHeaders.TryGetValue("Expires", out var expires)) { responseHeaders["Expires"] = "-1"; } @@ -702,9 +699,7 @@ namespace Emby.Server.Implementations.HttpServer if (!string.IsNullOrEmpty(ifModifiedSinceHeader)) { - DateTime ifModifiedSince; - - if (DateTime.TryParse(ifModifiedSinceHeader, out ifModifiedSince)) + if (DateTime.TryParse(ifModifiedSinceHeader, out var ifModifiedSince)) { if (IsNotModified(ifModifiedSince.ToUniversalTime(), cacheDuration, lastDateModified)) { @@ -720,11 +715,9 @@ namespace Emby.Server.Implementations.HttpServer // Validate If-None-Match if ((hasCacheKey || !string.IsNullOrEmpty(ifNoneMatchHeader))) { - Guid ifNoneMatch; - ifNoneMatchHeader = (ifNoneMatchHeader ?? string.Empty).Trim('\"'); - if (Guid.TryParse(ifNoneMatchHeader, out ifNoneMatch)) + if (Guid.TryParse(ifNoneMatchHeader, out var ifNoneMatch)) { if (hasCacheKey && cacheKey.Equals(ifNoneMatch)) { diff --git a/Emby.Server.Implementations/HttpServer/ResponseFilter.cs b/Emby.Server.Implementations/HttpServer/ResponseFilter.cs index edd2a394b..ed8644e33 100644 --- a/Emby.Server.Implementations/HttpServer/ResponseFilter.cs +++ b/Emby.Server.Implementations/HttpServer/ResponseFilter.cs @@ -56,9 +56,8 @@ namespace Emby.Server.Implementations.HttpServer } // Content length has to be explicitly set on on HttpListenerResponse or it won't be happy - string contentLength; - if (hasHeaders.Headers.TryGetValue("Content-Length", out contentLength) && !string.IsNullOrEmpty(contentLength)) + if (hasHeaders.Headers.TryGetValue("Content-Length", out var contentLength) && !string.IsNullOrEmpty(contentLength)) { var length = long.Parse(contentLength, UsCulture); diff --git a/Emby.Server.Implementations/HttpServer/Security/AuthService.cs b/Emby.Server.Implementations/HttpServer/Security/AuthService.cs index c037292ff..499a334fc 100644 --- a/Emby.Server.Implementations/HttpServer/Security/AuthService.cs +++ b/Emby.Server.Implementations/HttpServer/Security/AuthService.cs @@ -207,8 +207,7 @@ namespace Emby.Server.Implementations.HttpServer.Security private static AuthenticationInfo GetTokenInfo(IRequest request) { - object info; - request.Items.TryGetValue("OriginalAuthenticationInfo", out info); + request.Items.TryGetValue("OriginalAuthenticationInfo", out var info); return info as AuthenticationInfo; } diff --git a/Emby.Server.Implementations/HttpServer/Security/AuthorizationContext.cs b/Emby.Server.Implementations/HttpServer/Security/AuthorizationContext.cs index ae4adda7c..cab41e65b 100644 --- a/Emby.Server.Implementations/HttpServer/Security/AuthorizationContext.cs +++ b/Emby.Server.Implementations/HttpServer/Security/AuthorizationContext.cs @@ -26,8 +26,7 @@ namespace Emby.Server.Implementations.HttpServer.Security public AuthorizationInfo GetAuthorizationInfo(IRequest requestContext) { - object cached; - if (requestContext.Items.TryGetValue("AuthorizationInfo", out cached)) + if (requestContext.Items.TryGetValue("AuthorizationInfo", out var cached)) { return (AuthorizationInfo)cached; } diff --git a/Emby.Server.Implementations/HttpServer/Security/SessionContext.cs b/Emby.Server.Implementations/HttpServer/Security/SessionContext.cs index 2c7057222..81e11d312 100644 --- a/Emby.Server.Implementations/HttpServer/Security/SessionContext.cs +++ b/Emby.Server.Implementations/HttpServer/Security/SessionContext.cs @@ -31,8 +31,7 @@ namespace Emby.Server.Implementations.HttpServer.Security private AuthenticationInfo GetTokenInfo(IRequest request) { - object info; - request.Items.TryGetValue("OriginalAuthenticationInfo", out info); + request.Items.TryGetValue("OriginalAuthenticationInfo", out var info); return info as AuthenticationInfo; } |
