Skip to content

Commit

Permalink
Fix more warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
NoahStolk committed Mar 3, 2024
1 parent 94ff145 commit f79a978
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 21 deletions.
8 changes: 0 additions & 8 deletions src/DevilDaggersInfo.Web.ApiSpec.Tools/Page.cs

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<TSource, TKey>(ref List<TSource> source, Dictionary<string, bool> sortings, Func<TSource, TKey> sorting, [CallerArgumentExpression("sorting")] string sortingExpression = "")
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<div class="p-2 border-2" style="@($"border-color: {dagger.Color.HexCode};")">
<div class="font-goethe text-xl @dagger.Name.ToLower()">@dagger.Name Dagger</div>
@{
MarkupString text = new(dagger.UnlockSecond == 0 ? "Also known as 'Pleb Dagger' in the game files" : $@"Unlocks at <span class=""{dagger.Name.ToLower()} font-goethe text-lg"">{dagger.UnlockSecond}</span> seconds");
MarkupString text = new(dagger.UnlockSecond == 0 ? "Also known as 'Pleb Dagger' in the game files" : $"""Unlocks at <span class="{dagger.Name.ToLower()} font-goethe text-lg">{dagger.UnlockSecond}</span> seconds""");
@text
}
<img src='images/wiki/daggers/@(dagger.Name.ToLower()).png' alt="@dagger.Name"/>
Expand Down
8 changes: 6 additions & 2 deletions src/DevilDaggersInfo.Web.Client/Utils/FormatUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand All @@ -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)
{
Expand Down
12 changes: 6 additions & 6 deletions src/DevilDaggersInfo.Web.Client/Utils/MarkupUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ public static class MarkupUtils
{
public static MarkupString DaggerString(Dagger dagger)
{
return new($@"<span class=""font-goethe text-lg {dagger.Name.ToLower()}"">{dagger.Name} Dagger</span>");
return new($"""<span class="font-goethe text-lg {dagger.Name.ToLower()}">{dagger.Name} Dagger</span>""");
}

public static MarkupString CustomLeaderboardDeathString(byte? deathType, GameVersion gameVersion = GameConstants.CurrentVersion, string textSizeClass = "text-lg")
{
if (!deathType.HasValue)
return new($@"<span style=""color: {MarkupStrings.NoDataColor};"" class=""font-goethe {textSizeClass}"">N/A</span>");
return new($"""<span style="color: {MarkupStrings.NoDataColor};" class="font-goethe {textSizeClass}">N/A</span>""");

return DeathString(deathType.Value, gameVersion, textSizeClass);
}
Expand All @@ -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($@"<span style=""{style}"" class=""font-goethe {textSizeClass}"">{death?.Name ?? "Unknown"}</span>");
return new($"""<span style="{style}" class="font-goethe {textSizeClass}">{death?.Name ?? "Unknown"}</span>""");
}

public static MarkupString UpgradeString(Upgrade upgrade)
{
string style = $"color: {upgrade.Color.HexCode};";
return new($@"<span style=""{style}"" class=""font-goethe text-lg"">{upgrade.Name}</span>");
return new($"""<span style="{style}" class="font-goethe text-lg">{upgrade.Name}</span>""");
}

public static MarkupString EnemyString(Enemy enemy, bool plural = false)
Expand All @@ -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($@"<span style=""{style}"" class=""font-goethe text-lg"">{enemyName}{(plural ? "s" : string.Empty)}</span>");
return new($"""<span style="{style}" class="font-goethe text-lg">{enemyName}{(plural ? "s" : string.Empty)}</span>""");
}

public static MarkupString LeaderboardTime(double timeInSeconds)
{
return new($@"<span class=""{Daggers.GetDaggerFromSeconds(GameConstants.CurrentVersion, timeInSeconds).Name.ToLower()} font-goethe text-lg"">{timeInSeconds.ToString(StringFormats.TimeFormat)}</span>");
return new($"""<span class="{Daggers.GetDaggerFromSeconds(GameConstants.CurrentVersion, timeInSeconds).Name.ToLower()} font-goethe text-lg">{timeInSeconds.ToString(StringFormats.TimeFormat)}</span>""");
}

public static MarkupString ProhibitedString(bool isProhibited)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit f79a978

Please sign in to comment.