Migrate to file-scoped namespaces

This commit is contained in:
Shadowghost
2023-01-31 12:18:10 +01:00
parent 58b3945805
commit f5f890e685
163 changed files with 23939 additions and 24102 deletions

View File

@@ -2,39 +2,38 @@ using System.Threading.Tasks;
using MediaBrowser.Controller.Net;
using Microsoft.AspNetCore.Http;
namespace Jellyfin.Api.Middleware
namespace Jellyfin.Api.Middleware;
/// <summary>
/// Handles WebSocket requests.
/// </summary>
public class WebSocketHandlerMiddleware
{
private readonly RequestDelegate _next;
/// <summary>
/// Handles WebSocket requests.
/// Initializes a new instance of the <see cref="WebSocketHandlerMiddleware"/> class.
/// </summary>
public class WebSocketHandlerMiddleware
/// <param name="next">The next delegate in the pipeline.</param>
public WebSocketHandlerMiddleware(RequestDelegate next)
{
private readonly RequestDelegate _next;
_next = next;
}
/// <summary>
/// Initializes a new instance of the <see cref="WebSocketHandlerMiddleware"/> class.
/// </summary>
/// <param name="next">The next delegate in the pipeline.</param>
public WebSocketHandlerMiddleware(RequestDelegate next)
/// <summary>
/// Executes the middleware action.
/// </summary>
/// <param name="httpContext">The current HTTP context.</param>
/// <param name="webSocketManager">The WebSocket connection manager.</param>
/// <returns>The async task.</returns>
public async Task Invoke(HttpContext httpContext, IWebSocketManager webSocketManager)
{
if (!httpContext.WebSockets.IsWebSocketRequest)
{
_next = next;
await _next(httpContext).ConfigureAwait(false);
return;
}
/// <summary>
/// Executes the middleware action.
/// </summary>
/// <param name="httpContext">The current HTTP context.</param>
/// <param name="webSocketManager">The WebSocket connection manager.</param>
/// <returns>The async task.</returns>
public async Task Invoke(HttpContext httpContext, IWebSocketManager webSocketManager)
{
if (!httpContext.WebSockets.IsWebSocketRequest)
{
await _next(httpContext).ConfigureAwait(false);
return;
}
await webSocketManager.WebSocketRequestHandler(httpContext).ConfigureAwait(false);
}
await webSocketManager.WebSocketRequestHandler(httpContext).ConfigureAwait(false);
}
}