From a885b48f56576707c5018f830a59e7b5c829b711 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 2 Jul 2024 00:04:06 +0000 Subject: [PATCH] Automated dotnet-format update --- .../Models/NexusModsArticleId.cs | 2 +- .../Models/NexusModsModId.cs | 2 +- .../Models/NexusModsUserId.cs | 2 +- .../Controllers/ApiControllerBase.cs | 8 ++++---- src/BUTR.Site.NexusMods.Shared/Helpers/NexusModsUtils.cs | 4 ++-- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/BUTR.Site.NexusMods.Server.ValueObjects.Vogen/Models/NexusModsArticleId.cs b/src/BUTR.Site.NexusMods.Server.ValueObjects.Vogen/Models/NexusModsArticleId.cs index ced41489..e0ee8b26 100644 --- a/src/BUTR.Site.NexusMods.Server.ValueObjects.Vogen/Models/NexusModsArticleId.cs +++ b/src/BUTR.Site.NexusMods.Server.ValueObjects.Vogen/Models/NexusModsArticleId.cs @@ -22,7 +22,7 @@ public static bool TryParseUrl(string urlRaw, out TType articleId) if (url.LocalPath.Split('/', StringSplitOptions.RemoveEmptyEntries | StringSplitOptions.TrimEntries) is not [_, var articles, var articleIdRaw, ..]) return false; - + if (!string.Equals(articles, "articles", StringComparison.OrdinalIgnoreCase)) return false; diff --git a/src/BUTR.Site.NexusMods.Server.ValueObjects.Vogen/Models/NexusModsModId.cs b/src/BUTR.Site.NexusMods.Server.ValueObjects.Vogen/Models/NexusModsModId.cs index 3fe63989..1beafa18 100644 --- a/src/BUTR.Site.NexusMods.Server.ValueObjects.Vogen/Models/NexusModsModId.cs +++ b/src/BUTR.Site.NexusMods.Server.ValueObjects.Vogen/Models/NexusModsModId.cs @@ -22,7 +22,7 @@ public static bool TryParseUrl(string? urlRaw, out TType modId) if (url.LocalPath.Split('/', StringSplitOptions.RemoveEmptyEntries | StringSplitOptions.TrimEntries) is not [_, var mods, var modIdRaw, ..]) return false; - + if (!string.Equals(mods, "mods", StringComparison.OrdinalIgnoreCase)) return false; diff --git a/src/BUTR.Site.NexusMods.Server.ValueObjects.Vogen/Models/NexusModsUserId.cs b/src/BUTR.Site.NexusMods.Server.ValueObjects.Vogen/Models/NexusModsUserId.cs index e51c7ec5..565de7d6 100644 --- a/src/BUTR.Site.NexusMods.Server.ValueObjects.Vogen/Models/NexusModsUserId.cs +++ b/src/BUTR.Site.NexusMods.Server.ValueObjects.Vogen/Models/NexusModsUserId.cs @@ -25,7 +25,7 @@ public static bool TryParseUrl(string urlRaw, out TType userId) if (!string.Equals(users, "users", StringComparison.OrdinalIgnoreCase)) return false; - + return TryParse(userIdRaw, out userId); } diff --git a/src/BUTR.Site.NexusMods.Server/Controllers/ApiControllerBase.cs b/src/BUTR.Site.NexusMods.Server/Controllers/ApiControllerBase.cs index 7727762c..eee6db32 100644 --- a/src/BUTR.Site.NexusMods.Server/Controllers/ApiControllerBase.cs +++ b/src/BUTR.Site.NexusMods.Server/Controllers/ApiControllerBase.cs @@ -6,7 +6,9 @@ using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.Infrastructure; +using Microsoft.AspNetCore.Mvc.Routing; using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options; using System; @@ -17,8 +19,6 @@ using System.Text.Json; using System.Threading; using System.Threading.Tasks; -using Microsoft.AspNetCore.Mvc.Routing; -using Microsoft.Extensions.Logging; namespace BUTR.Site.NexusMods.Server.Controllers; @@ -112,11 +112,11 @@ protected ApiResult ApiResultError(string error, int statusCode) { var routeAttribute = Url.ActionContext.ActionDescriptor.EndpointMetadata.OfType().First(); var routeTemplate = routeAttribute.Template; - + var loggerFactory = HttpContext.RequestServices.GetRequiredService(); var logger = loggerFactory.CreateLogger(GetType()); logger.LogError("Route: {Route}, API Error: {Error}", routeTemplate, error); - + if (statusCode is < 400 or >= 600) throw new ArgumentOutOfRangeException(nameof(statusCode)); diff --git a/src/BUTR.Site.NexusMods.Shared/Helpers/NexusModsUtils.cs b/src/BUTR.Site.NexusMods.Shared/Helpers/NexusModsUtils.cs index 610615ad..79f4211f 100644 --- a/src/BUTR.Site.NexusMods.Shared/Helpers/NexusModsUtils.cs +++ b/src/BUTR.Site.NexusMods.Shared/Helpers/NexusModsUtils.cs @@ -23,7 +23,7 @@ public static bool TryParseModUrl(string? url, [NotNullWhen(true)] out string? g var split = str1[1].Split('/', StringSplitOptions.RemoveEmptyEntries | StringSplitOptions.TrimEntries); if (split.Length != 3) return false; - + if (!string.Equals(split[1], "mods", StringComparison.OrdinalIgnoreCase)) return false; @@ -56,7 +56,7 @@ public static bool TryParseUserId(string? url, [NotNullWhen(true)] out string? g if (!string.Equals(split[1], "users", StringComparison.OrdinalIgnoreCase)) return false; - + if (!uint.TryParse(split[2], out var userIdNumber)) return false;