Updated editorconfig to (mostly?) require braces around if/else statements, and applied the new formatting rules

This commit is contained in:
Kwoth
2022-02-02 01:44:45 +01:00
parent b22cd5a81e
commit ffa2c3f119
202 changed files with 2108 additions and 920 deletions

View File

@@ -24,6 +24,7 @@ public sealed class DefaultHangmanSource : IHangmanSource
var qs = new Dictionary<string, HangmanTerm[]>();
foreach (var file in Directory.EnumerateFiles("data/hangman/", "*.yml"))
{
try
{
var data = Yaml.Deserializer.Deserialize<HangmanTerm[]>(File.ReadAllText(file));
@@ -33,6 +34,7 @@ public sealed class DefaultHangmanSource : IHangmanSource
{
Log.Error(ex, "Loading {HangmanFile} failed", file);
}
}
termsDict = qs;

View File

@@ -62,7 +62,8 @@ public partial class Games
[RequireContext(ContextType.Guild)]
public async partial Task HangmanStop()
{
if (await _service.StopHangman(ctx.Channel.Id)) await ReplyConfirmLocalizedAsync(strs.hangman_stopped);
if (await _service.StopHangman(ctx.Channel.Id))
await ReplyConfirmLocalizedAsync(strs.hangman_stopped);
}
}
}

View File

@@ -54,7 +54,8 @@ public sealed class HangmanService : IHangmanService, ILateExecutor
{
lock (_locker)
{
if (_hangmanGames.TryRemove(channelId, out _)) return new(true);
if (_hangmanGames.TryRemove(channelId, out _))
return new(true);
}
return new(false);
@@ -88,7 +89,10 @@ public sealed class HangmanService : IHangmanService, ILateExecutor
if (state.GuessResult is HangmanGame.GuessResult.Incorrect or HangmanGame.GuessResult.AlreadyTried)
_cdCache.Set(msg.Author.Id,
string.Empty,
new MemoryCacheEntryOptions { AbsoluteExpirationRelativeToNow = TimeSpan.FromSeconds(3) });
new MemoryCacheEntryOptions
{
AbsoluteExpirationRelativeToNow = TimeSpan.FromSeconds(3)
});
if (state.Phase == HangmanGame.Phase.Ended)
if (_hangmanGames.TryRemove(msg.Channel.Id, out _))