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

@@ -36,16 +36,31 @@ public sealed record SmartEmbedText : SmartText
Url = eb.Url,
Thumbnail = eb.Thumbnail?.Url,
Image = eb.Image?.Url,
Author = eb.Author is { } ea ? new() { Name = ea.Name, Url = ea.Url, IconUrl = ea.IconUrl } : null,
Footer = eb.Footer is { } ef ? new() { Text = ef.Text, IconUrl = ef.IconUrl } : null
Author = eb.Author is { } ea
? new()
{
Name = ea.Name,
Url = ea.Url,
IconUrl = ea.IconUrl
}
: null,
Footer = eb.Footer is { } ef
? new()
{
Text = ef.Text,
IconUrl = ef.IconUrl
}
: null
};
if (eb.Fields.Length > 0)
set.Fields = eb.Fields.Select(field
=> new SmartTextEmbedField
{
Inline = field.Inline, Name = field.Name, Value = field.Value
})
{
Inline = field.Inline,
Name = field.Name,
Value = field.Value
})
.ToArray();
set.Color = eb.Color?.RawValue ?? 0;
@@ -91,8 +106,10 @@ public sealed record SmartEmbedText : SmartText
if (Fields is not null)
foreach (var f in Fields)
{
if (!string.IsNullOrWhiteSpace(f.Name) && !string.IsNullOrWhiteSpace(f.Value))
embed.AddField(f.Name, f.Value, f.Inline);
}
return embed;
}

View File

@@ -14,7 +14,10 @@ public abstract record SmartText
public static SmartText operator +(SmartText text, string input)
=> text switch
{
SmartEmbedText set => set with { PlainText = set.PlainText + input },
SmartEmbedText set => set with
{
PlainText = set.PlainText + input
},
SmartPlainText spt => new SmartPlainText(spt.Text + input),
_ => throw new ArgumentOutOfRangeException(nameof(text))
};
@@ -22,7 +25,10 @@ public abstract record SmartText
public static SmartText operator +(string input, SmartText text)
=> text switch
{
SmartEmbedText set => set with { PlainText = input + set.PlainText },
SmartEmbedText set => set with
{
PlainText = input + set.PlainText
},
SmartPlainText spt => new SmartPlainText(input + spt.Text),
_ => throw new ArgumentOutOfRangeException(nameof(text))
};
@@ -41,7 +47,7 @@ public abstract record SmartText
smartEmbedText.NormalizeFields();
if (!smartEmbedText.IsValid)
if (!smartEmbedText.IsValid)
return new SmartPlainText(input);
return smartEmbedText;