From f79a97804dc49dd2b7c450f5f8dd80caa7e9356a Mon Sep 17 00:00:00 2001 From: Noah Stolk <31079637+NoahStolk@users.noreply.github.com> Date: Sun, 3 Mar 2024 17:29:00 +0100 Subject: [PATCH] Fix more warnings --- src/DevilDaggersInfo.Web.ApiSpec.Tools/Page.cs | 8 -------- .../Components/Spawnsets/Spawn.razor | 8 ++++++-- .../Pages/Leaderboard/WorldRecordProgressionPage.cs | 4 +++- .../Pages/Wiki/DaggersPage.razor | 2 +- src/DevilDaggersInfo.Web.Client/Utils/FormatUtils.cs | 8 ++++++-- src/DevilDaggersInfo.Web.Client/Utils/MarkupUtils.cs | 12 ++++++------ .../LeaderboardHistoryBackgroundService.cs | 2 +- 7 files changed, 23 insertions(+), 21 deletions(-) delete mode 100644 src/DevilDaggersInfo.Web.ApiSpec.Tools/Page.cs diff --git a/src/DevilDaggersInfo.Web.ApiSpec.Tools/Page.cs b/src/DevilDaggersInfo.Web.ApiSpec.Tools/Page.cs deleted file mode 100644 index 2a13ff24d..000000000 --- a/src/DevilDaggersInfo.Web.ApiSpec.Tools/Page.cs +++ /dev/null @@ -1,8 +0,0 @@ -namespace DevilDaggersInfo.Web.ApiSpec.Tools; - -public record Page -{ - public required List Results { get; init; } - - public required int TotalResults { get; init; } -} diff --git a/src/DevilDaggersInfo.Web.Client/Components/Spawnsets/Spawn.razor b/src/DevilDaggersInfo.Web.Client/Components/Spawnsets/Spawn.razor index 8af213fc3..281b21b4f 100644 --- a/src/DevilDaggersInfo.Web.Client/Components/Spawnsets/Spawn.razor +++ b/src/DevilDaggersInfo.Web.Client/Components/Spawnsets/Spawn.razor @@ -13,9 +13,13 @@ @code { - [Parameter, EditorRequired] public SpawnView SpawnView { get; set; } + [Parameter] + [EditorRequired] + public SpawnView SpawnView { get; set; } - [Parameter, EditorRequired] public GameVersion GameVersion { get; set; } + [Parameter] + [EditorRequired] + public GameVersion GameVersion { get; set; } private string GetHandLevelHexColor(HandLevel handLevel) { diff --git a/src/DevilDaggersInfo.Web.Client/Pages/Leaderboard/WorldRecordProgressionPage.cs b/src/DevilDaggersInfo.Web.Client/Pages/Leaderboard/WorldRecordProgressionPage.cs index 3d2bcdace..9817b2d96 100644 --- a/src/DevilDaggersInfo.Web.Client/Pages/Leaderboard/WorldRecordProgressionPage.cs +++ b/src/DevilDaggersInfo.Web.Client/Pages/Leaderboard/WorldRecordProgressionPage.cs @@ -97,7 +97,9 @@ private static string GetHistoryDateString(DateTime dateTime) } private static string S(int value) - => value == 1 ? string.Empty : "s"; + { + return value == 1 ? string.Empty : "s"; + } private static void Sort(ref List source, Dictionary sortings, Func sorting, [CallerArgumentExpression("sorting")] string sortingExpression = "") { diff --git a/src/DevilDaggersInfo.Web.Client/Pages/Wiki/DaggersPage.razor b/src/DevilDaggersInfo.Web.Client/Pages/Wiki/DaggersPage.razor index 206881cf7..a74f34717 100644 --- a/src/DevilDaggersInfo.Web.Client/Pages/Wiki/DaggersPage.razor +++ b/src/DevilDaggersInfo.Web.Client/Pages/Wiki/DaggersPage.razor @@ -19,7 +19,7 @@
@dagger.Name Dagger
@{ - MarkupString text = new(dagger.UnlockSecond == 0 ? "Also known as 'Pleb Dagger' in the game files" : $@"Unlocks at {dagger.UnlockSecond} seconds"); + MarkupString text = new(dagger.UnlockSecond == 0 ? "Also known as 'Pleb Dagger' in the game files" : $"""Unlocks at {dagger.UnlockSecond} seconds"""); @text } @dagger.Name diff --git a/src/DevilDaggersInfo.Web.Client/Utils/FormatUtils.cs b/src/DevilDaggersInfo.Web.Client/Utils/FormatUtils.cs index 9fc3eb9bd..3813d23a3 100644 --- a/src/DevilDaggersInfo.Web.Client/Utils/FormatUtils.cs +++ b/src/DevilDaggersInfo.Web.Client/Utils/FormatUtils.cs @@ -3,7 +3,9 @@ namespace DevilDaggersInfo.Web.Client.Utils; public static class FormatUtils { public static string FormatDaggersInt32(int hit, int fired, bool isHistory = false) - => FormatDaggersUInt64((ulong)hit, (ulong)fired, isHistory); + { + return FormatDaggersUInt64((ulong)hit, (ulong)fired, isHistory); + } public static string FormatDaggersUInt64(ulong hit, ulong fired, bool isHistory = false) { @@ -19,7 +21,9 @@ public static string FormatDaggersUInt64(ulong hit, ulong fired, bool isHistory } public static string FormatDateTimeAsTimeAgo(DateTime? dateTime) - => dateTime.HasValue ? FormatDateTimeAsTimeAgo(dateTime.Value) : "Never"; + { + return dateTime.HasValue ? FormatDateTimeAsTimeAgo(dateTime.Value) : "Never"; + } public static string FormatDateTimeAsTimeAgo(DateTime dateTime) { diff --git a/src/DevilDaggersInfo.Web.Client/Utils/MarkupUtils.cs b/src/DevilDaggersInfo.Web.Client/Utils/MarkupUtils.cs index 1da34e191..e64ec644a 100644 --- a/src/DevilDaggersInfo.Web.Client/Utils/MarkupUtils.cs +++ b/src/DevilDaggersInfo.Web.Client/Utils/MarkupUtils.cs @@ -10,13 +10,13 @@ public static class MarkupUtils { public static MarkupString DaggerString(Dagger dagger) { - return new($@"{dagger.Name} Dagger"); + return new($"""{dagger.Name} Dagger"""); } public static MarkupString CustomLeaderboardDeathString(byte? deathType, GameVersion gameVersion = GameConstants.CurrentVersion, string textSizeClass = "text-lg") { if (!deathType.HasValue) - return new($@"N/A"); + return new($"""N/A"""); return DeathString(deathType.Value, gameVersion, textSizeClass); } @@ -30,13 +30,13 @@ public static MarkupString DeathString(byte deathType, GameVersion gameVersion = public static MarkupString DeathString(Death? death, string textSizeClass = "text-lg") { string style = $"color: {death?.Color.HexCode ?? MarkupStrings.NoDataColor};"; - return new($@"{death?.Name ?? "Unknown"}"); + return new($"""{death?.Name ?? "Unknown"}"""); } public static MarkupString UpgradeString(Upgrade upgrade) { string style = $"color: {upgrade.Color.HexCode};"; - return new($@"{upgrade.Name}"); + return new($"""{upgrade.Name}"""); } public static MarkupString EnemyString(Enemy enemy, bool plural = false) @@ -47,12 +47,12 @@ public static MarkupString EnemyString(Enemy enemy, bool plural = false) public static MarkupString EnemyString(Color enemyColor, string enemyName, bool plural = false) { string style = $"color: {enemyColor.HexCode};"; - return new($@"{enemyName}{(plural ? "s" : string.Empty)}"); + return new($"""{enemyName}{(plural ? "s" : string.Empty)}"""); } public static MarkupString LeaderboardTime(double timeInSeconds) { - return new($@"{timeInSeconds.ToString(StringFormats.TimeFormat)}"); + return new($"""{timeInSeconds.ToString(StringFormats.TimeFormat)}"""); } public static MarkupString ProhibitedString(bool isProhibited) diff --git a/src/DevilDaggersInfo.Web.Server/HostedServices/LeaderboardHistoryBackgroundService.cs b/src/DevilDaggersInfo.Web.Server/HostedServices/LeaderboardHistoryBackgroundService.cs index ac2c4a4e7..306d1fe79 100644 --- a/src/DevilDaggersInfo.Web.Server/HostedServices/LeaderboardHistoryBackgroundService.cs +++ b/src/DevilDaggersInfo.Web.Server/HostedServices/LeaderboardHistoryBackgroundService.cs @@ -68,7 +68,7 @@ protected override async Task ExecuteTaskAsync(CancellationToken stoppingToken) string fileName = $"{DateTime.UtcNow:yyyyMMddHHmm}.bin"; string fullPath = Path.Combine(_fileSystemService.GetPath(DataSubDirectory.LeaderboardHistory), fileName); - await File.WriteAllBytesAsync(fullPath, historyModel.ToBytes(), stoppingToken); + await IoFile.WriteAllBytesAsync(fullPath, historyModel.ToBytes(), stoppingToken); } private bool HistoryFileExistsForDate(DateTime dateTime)