diff --git a/DiscordChatExporter.Cli.Tests/Infra/ExportWrapper.cs b/DiscordChatExporter.Cli.Tests/Infra/ExportWrapper.cs index 0cfa3f6..f59670b 100644 --- a/DiscordChatExporter.Cli.Tests/Infra/ExportWrapper.cs +++ b/DiscordChatExporter.Cli.Tests/Infra/ExportWrapper.cs @@ -56,7 +56,7 @@ public static class ExportWrapper ExportFormat = format, OutputPath = filePath, Locale = "en-US", - IsUtcNormalizationEnabled = true + IsUtcNormalizationEnabled = true, }.ExecuteAsync(console); } diff --git a/DiscordChatExporter.Cli.Tests/Specs/DateRangeSpecs.cs b/DiscordChatExporter.Cli.Tests/Specs/DateRangeSpecs.cs index 41e8cc9..070951b 100644 --- a/DiscordChatExporter.Cli.Tests/Specs/DateRangeSpecs.cs +++ b/DiscordChatExporter.Cli.Tests/Specs/DateRangeSpecs.cs @@ -30,7 +30,7 @@ public class DateRangeSpecs ChannelIds = [ChannelIds.DateRangeTestCases], ExportFormat = ExportFormat.Json, OutputPath = file.Path, - After = Snowflake.FromDate(after) + After = Snowflake.FromDate(after), }.ExecuteAsync(new FakeConsole()); // Assert @@ -50,7 +50,7 @@ public class DateRangeSpecs new DateTimeOffset(2021, 07, 24, 14, 52, 38, TimeSpan.Zero), new DateTimeOffset(2021, 07, 24, 14, 52, 39, TimeSpan.Zero), new DateTimeOffset(2021, 07, 24, 14, 52, 40, TimeSpan.Zero), - new DateTimeOffset(2021, 09, 08, 14, 26, 35, TimeSpan.Zero) + new DateTimeOffset(2021, 09, 08, 14, 26, 35, TimeSpan.Zero), ], o => o.Using(ctx => @@ -74,7 +74,7 @@ public class DateRangeSpecs ChannelIds = [ChannelIds.DateRangeTestCases], ExportFormat = ExportFormat.Json, OutputPath = file.Path, - Before = Snowflake.FromDate(before) + Before = Snowflake.FromDate(before), }.ExecuteAsync(new FakeConsole()); // Assert @@ -92,7 +92,7 @@ public class DateRangeSpecs [ new DateTimeOffset(2021, 07, 19, 13, 34, 18, TimeSpan.Zero), new DateTimeOffset(2021, 07, 19, 15, 58, 48, TimeSpan.Zero), - new DateTimeOffset(2021, 07, 19, 17, 23, 58, TimeSpan.Zero) + new DateTimeOffset(2021, 07, 19, 17, 23, 58, TimeSpan.Zero), ], o => o.Using(ctx => @@ -118,7 +118,7 @@ public class DateRangeSpecs ExportFormat = ExportFormat.Json, OutputPath = file.Path, Before = Snowflake.FromDate(before), - After = Snowflake.FromDate(after) + After = Snowflake.FromDate(after), }.ExecuteAsync(new FakeConsole()); // Assert @@ -137,7 +137,7 @@ public class DateRangeSpecs new DateTimeOffset(2021, 07, 24, 13, 49, 13, TimeSpan.Zero), new DateTimeOffset(2021, 07, 24, 14, 52, 38, TimeSpan.Zero), new DateTimeOffset(2021, 07, 24, 14, 52, 39, TimeSpan.Zero), - new DateTimeOffset(2021, 07, 24, 14, 52, 40, TimeSpan.Zero) + new DateTimeOffset(2021, 07, 24, 14, 52, 40, TimeSpan.Zero), ], o => o.Using(ctx => diff --git a/DiscordChatExporter.Cli.Tests/Specs/FilterSpecs.cs b/DiscordChatExporter.Cli.Tests/Specs/FilterSpecs.cs index 06e0870..3b09786 100644 --- a/DiscordChatExporter.Cli.Tests/Specs/FilterSpecs.cs +++ b/DiscordChatExporter.Cli.Tests/Specs/FilterSpecs.cs @@ -29,7 +29,7 @@ public class FilterSpecs ChannelIds = [ChannelIds.FilterTestCases], ExportFormat = ExportFormat.Json, OutputPath = file.Path, - MessageFilter = MessageFilter.Parse("some text") + MessageFilter = MessageFilter.Parse("some text"), }.ExecuteAsync(new FakeConsole()); // Assert @@ -54,7 +54,7 @@ public class FilterSpecs ChannelIds = [ChannelIds.FilterTestCases], ExportFormat = ExportFormat.Json, OutputPath = file.Path, - MessageFilter = MessageFilter.Parse("from:Tyrrrz") + MessageFilter = MessageFilter.Parse("from:Tyrrrz"), }.ExecuteAsync(new FakeConsole()); // Assert @@ -79,7 +79,7 @@ public class FilterSpecs ChannelIds = [ChannelIds.FilterTestCases], ExportFormat = ExportFormat.Json, OutputPath = file.Path, - MessageFilter = MessageFilter.Parse("has:image") + MessageFilter = MessageFilter.Parse("has:image"), }.ExecuteAsync(new FakeConsole()); // Assert @@ -104,7 +104,7 @@ public class FilterSpecs ChannelIds = [ChannelIds.FilterTestCases], ExportFormat = ExportFormat.Json, OutputPath = file.Path, - MessageFilter = MessageFilter.Parse("has:pin") + MessageFilter = MessageFilter.Parse("has:pin"), }.ExecuteAsync(new FakeConsole()); // Assert @@ -129,7 +129,7 @@ public class FilterSpecs ChannelIds = [ChannelIds.FilterTestCases], ExportFormat = ExportFormat.Json, OutputPath = file.Path, - MessageFilter = MessageFilter.Parse("has:invite") + MessageFilter = MessageFilter.Parse("has:invite"), }.ExecuteAsync(new FakeConsole()); // Assert @@ -154,7 +154,7 @@ public class FilterSpecs ChannelIds = [ChannelIds.FilterTestCases], ExportFormat = ExportFormat.Json, OutputPath = file.Path, - MessageFilter = MessageFilter.Parse("mentions:Tyrrrz") + MessageFilter = MessageFilter.Parse("mentions:Tyrrrz"), }.ExecuteAsync(new FakeConsole()); // Assert diff --git a/DiscordChatExporter.Cli.Tests/Specs/HtmlGroupingSpecs.cs b/DiscordChatExporter.Cli.Tests/Specs/HtmlGroupingSpecs.cs index 8ccb64a..627a246 100644 --- a/DiscordChatExporter.Cli.Tests/Specs/HtmlGroupingSpecs.cs +++ b/DiscordChatExporter.Cli.Tests/Specs/HtmlGroupingSpecs.cs @@ -28,7 +28,7 @@ public class HtmlGroupingSpecs Token = Secrets.DiscordToken, ChannelIds = [ChannelIds.GroupingTestCases], ExportFormat = ExportFormat.HtmlDark, - OutputPath = file.Path + OutputPath = file.Path, }.ExecuteAsync(new FakeConsole()); // Assert diff --git a/DiscordChatExporter.Cli.Tests/Specs/PartitioningSpecs.cs b/DiscordChatExporter.Cli.Tests/Specs/PartitioningSpecs.cs index e245f91..a763c9a 100644 --- a/DiscordChatExporter.Cli.Tests/Specs/PartitioningSpecs.cs +++ b/DiscordChatExporter.Cli.Tests/Specs/PartitioningSpecs.cs @@ -27,7 +27,7 @@ public class PartitioningSpecs ChannelIds = [ChannelIds.DateRangeTestCases], ExportFormat = ExportFormat.HtmlDark, OutputPath = filePath, - PartitionLimit = PartitionLimit.Parse("3") + PartitionLimit = PartitionLimit.Parse("3"), }.ExecuteAsync(new FakeConsole()); // Assert @@ -48,7 +48,7 @@ public class PartitioningSpecs ChannelIds = [ChannelIds.DateRangeTestCases], ExportFormat = ExportFormat.HtmlDark, OutputPath = filePath, - PartitionLimit = PartitionLimit.Parse("1kb") + PartitionLimit = PartitionLimit.Parse("1kb"), }.ExecuteAsync(new FakeConsole()); // Assert diff --git a/DiscordChatExporter.Cli.Tests/Specs/SelfContainedSpecs.cs b/DiscordChatExporter.Cli.Tests/Specs/SelfContainedSpecs.cs index 8699e92..b8a2d67 100644 --- a/DiscordChatExporter.Cli.Tests/Specs/SelfContainedSpecs.cs +++ b/DiscordChatExporter.Cli.Tests/Specs/SelfContainedSpecs.cs @@ -27,7 +27,7 @@ public class SelfContainedSpecs ChannelIds = [ChannelIds.SelfContainedTestCases], ExportFormat = ExportFormat.HtmlDark, OutputPath = filePath, - ShouldDownloadAssets = true + ShouldDownloadAssets = true, }.ExecuteAsync(new FakeConsole()); // Assert diff --git a/DiscordChatExporter.Cli/Commands/Base/ExportCommandBase.cs b/DiscordChatExporter.Cli/Commands/Base/ExportCommandBase.cs index e494583..67f9991 100644 --- a/DiscordChatExporter.Cli/Commands/Base/ExportCommandBase.cs +++ b/DiscordChatExporter.Cli/Commands/Base/ExportCommandBase.cs @@ -196,7 +196,7 @@ public abstract class ExportCommandBase : DiscordCommandBase new ParallelOptions { MaxDegreeOfParallelism = Math.Max(1, ParallelLimit), - CancellationToken = cancellationToken + CancellationToken = cancellationToken, }, async (channel, innerCancellationToken) => { diff --git a/DiscordChatExporter.Cli/Commands/Shared/ThreadInclusionMode.cs b/DiscordChatExporter.Cli/Commands/Shared/ThreadInclusionMode.cs index 878cdff..d77decb 100644 --- a/DiscordChatExporter.Cli/Commands/Shared/ThreadInclusionMode.cs +++ b/DiscordChatExporter.Cli/Commands/Shared/ThreadInclusionMode.cs @@ -4,5 +4,5 @@ public enum ThreadInclusionMode { None, Active, - All + All, } diff --git a/DiscordChatExporter.Cli/Utils/Extensions/ConsoleExtensions.cs b/DiscordChatExporter.Cli/Utils/Extensions/ConsoleExtensions.cs index 239de80..4509026 100644 --- a/DiscordChatExporter.Cli/Utils/Extensions/ConsoleExtensions.cs +++ b/DiscordChatExporter.Cli/Utils/Extensions/ConsoleExtensions.cs @@ -13,7 +13,7 @@ internal static class ConsoleExtensions { Ansi = AnsiSupport.Detect, ColorSystem = ColorSystemSupport.Detect, - Out = new AnsiConsoleOutput(console.Output) + Out = new AnsiConsoleOutput(console.Output), } ); diff --git a/DiscordChatExporter.Core/Discord/Data/ApplicationFlags.cs b/DiscordChatExporter.Core/Discord/Data/ApplicationFlags.cs index 850ea6f..7086b06 100644 --- a/DiscordChatExporter.Core/Discord/Data/ApplicationFlags.cs +++ b/DiscordChatExporter.Core/Discord/Data/ApplicationFlags.cs @@ -16,5 +16,5 @@ public enum ApplicationFlags Embedded = 131072, GatewayMessageContent = 262144, GatewayMessageContentLimited = 524288, - ApplicationCommandBadge = 8388608 + ApplicationCommandBadge = 8388608, } diff --git a/DiscordChatExporter.Core/Discord/Data/ChannelKind.cs b/DiscordChatExporter.Core/Discord/Data/ChannelKind.cs index 6e36b51..feb4338 100644 --- a/DiscordChatExporter.Core/Discord/Data/ChannelKind.cs +++ b/DiscordChatExporter.Core/Discord/Data/ChannelKind.cs @@ -14,5 +14,5 @@ public enum ChannelKind GuildPrivateThread = 12, GuildStageVoice = 13, GuildDirectory = 14, - GuildForum = 15 + GuildForum = 15, } diff --git a/DiscordChatExporter.Core/Discord/Data/Embeds/EmbedKind.cs b/DiscordChatExporter.Core/Discord/Data/Embeds/EmbedKind.cs index 539f862..b1240b0 100644 --- a/DiscordChatExporter.Core/Discord/Data/Embeds/EmbedKind.cs +++ b/DiscordChatExporter.Core/Discord/Data/Embeds/EmbedKind.cs @@ -7,5 +7,5 @@ public enum EmbedKind Image, Video, Gifv, - Link + Link, } diff --git a/DiscordChatExporter.Core/Discord/Data/EmojiIndex.cs b/DiscordChatExporter.Core/Discord/Data/EmojiIndex.cs index 80d157c..b037fd6 100644 --- a/DiscordChatExporter.Core/Discord/Data/EmojiIndex.cs +++ b/DiscordChatExporter.Core/Discord/Data/EmojiIndex.cs @@ -3548,7 +3548,7 @@ internal static class EmojiIndex ["πŸ‡ΈπŸ‡―"] = "flag_sj", ["πŸ‡ΉπŸ‡¦"] = "flag_ta", ["πŸ‡ΊπŸ‡²"] = "flag_um", - ["πŸ‡ΊπŸ‡³"] = "united_nations" + ["πŸ‡ΊπŸ‡³"] = "united_nations", }; private static Dictionary _fromCodes = @@ -8880,7 +8880,7 @@ internal static class EmojiIndex ["flag_sj"] = "πŸ‡ΈπŸ‡―", ["flag_ta"] = "πŸ‡ΉπŸ‡¦", ["flag_um"] = "πŸ‡ΊπŸ‡²", - ["united_nations"] = "πŸ‡ΊπŸ‡³" + ["united_nations"] = "πŸ‡ΊπŸ‡³", }; public static string? TryGetCode(string name) => _toCodes.GetValueOrDefault(name); diff --git a/DiscordChatExporter.Core/Discord/Data/MessageFlags.cs b/DiscordChatExporter.Core/Discord/Data/MessageFlags.cs index cb12eac..c3a7532 100644 --- a/DiscordChatExporter.Core/Discord/Data/MessageFlags.cs +++ b/DiscordChatExporter.Core/Discord/Data/MessageFlags.cs @@ -14,5 +14,5 @@ public enum MessageFlags Urgent = 16, HasThread = 32, Ephemeral = 64, - Loading = 128 + Loading = 128, } diff --git a/DiscordChatExporter.Core/Discord/Data/MessageKind.cs b/DiscordChatExporter.Core/Discord/Data/MessageKind.cs index 411238b..67fca44 100644 --- a/DiscordChatExporter.Core/Discord/Data/MessageKind.cs +++ b/DiscordChatExporter.Core/Discord/Data/MessageKind.cs @@ -12,5 +12,5 @@ public enum MessageKind ChannelPinnedMessage = 6, GuildMemberJoin = 7, ThreadCreated = 18, - Reply = 19 + Reply = 19, } diff --git a/DiscordChatExporter.Core/Discord/Data/Sticker.cs b/DiscordChatExporter.Core/Discord/Data/Sticker.cs index 63462d8..a99cbcc 100644 --- a/DiscordChatExporter.Core/Discord/Data/Sticker.cs +++ b/DiscordChatExporter.Core/Discord/Data/Sticker.cs @@ -28,7 +28,7 @@ public partial record Sticker StickerFormat.Apng => "png", StickerFormat.Lottie => "json", StickerFormat.Gif => "gif", - _ => throw new InvalidOperationException($"Unknown sticker format '{format}'.") + _ => throw new InvalidOperationException($"Unknown sticker format '{format}'."), } ); diff --git a/DiscordChatExporter.Core/Discord/Data/StickerFormat.cs b/DiscordChatExporter.Core/Discord/Data/StickerFormat.cs index a1a78d4..082ad54 100644 --- a/DiscordChatExporter.Core/Discord/Data/StickerFormat.cs +++ b/DiscordChatExporter.Core/Discord/Data/StickerFormat.cs @@ -5,5 +5,5 @@ public enum StickerFormat Png = 1, Apng = 2, Lottie = 3, - Gif = 4 + Gif = 4, } diff --git a/DiscordChatExporter.Core/Discord/DiscordClient.cs b/DiscordChatExporter.Core/Discord/DiscordClient.cs index 0aa4ab1..045e62f 100644 --- a/DiscordChatExporter.Core/Discord/DiscordClient.cs +++ b/DiscordChatExporter.Core/Discord/DiscordClient.cs @@ -133,25 +133,21 @@ public class DiscordClient(string token) { throw response.StatusCode switch { - HttpStatusCode.Unauthorized - => throw new DiscordChatExporterException( - "Authentication token is invalid.", - true - ), + HttpStatusCode.Unauthorized => throw new DiscordChatExporterException( + "Authentication token is invalid.", + true + ), - HttpStatusCode.Forbidden - => throw new DiscordChatExporterException( - $"Request to '{url}' failed: forbidden." - ), + HttpStatusCode.Forbidden => throw new DiscordChatExporterException( + $"Request to '{url}' failed: forbidden." + ), - HttpStatusCode.NotFound - => throw new DiscordChatExporterException( - $"Request to '{url}' failed: not found." - ), + HttpStatusCode.NotFound => throw new DiscordChatExporterException( + $"Request to '{url}' failed: not found." + ), - _ - => throw new DiscordChatExporterException( - $""" + _ => throw new DiscordChatExporterException( + $""" Request to '{url}' failed: {response .StatusCode.ToString() .ToSpaceSeparatedWords() @@ -160,8 +156,8 @@ public class DiscordClient(string token) cancellationToken )} """, - true - ) + true + ), }; } diff --git a/DiscordChatExporter.Core/Discord/TokenKind.cs b/DiscordChatExporter.Core/Discord/TokenKind.cs index 0911720..a1030e6 100644 --- a/DiscordChatExporter.Core/Discord/TokenKind.cs +++ b/DiscordChatExporter.Core/Discord/TokenKind.cs @@ -3,5 +3,5 @@ public enum TokenKind { User, - Bot + Bot, } diff --git a/DiscordChatExporter.Core/Exporting/ExportFormat.cs b/DiscordChatExporter.Core/Exporting/ExportFormat.cs index 923ceb1..233a5a8 100644 --- a/DiscordChatExporter.Core/Exporting/ExportFormat.cs +++ b/DiscordChatExporter.Core/Exporting/ExportFormat.cs @@ -8,7 +8,7 @@ public enum ExportFormat HtmlDark, HtmlLight, Csv, - Json + Json, } public static class ExportFormatExtensions @@ -21,7 +21,7 @@ public static class ExportFormatExtensions ExportFormat.HtmlLight => "html", ExportFormat.Csv => "csv", ExportFormat.Json => "json", - _ => throw new ArgumentOutOfRangeException(nameof(format)) + _ => throw new ArgumentOutOfRangeException(nameof(format)), }; public static string GetDisplayName(this ExportFormat format) => @@ -32,6 +32,6 @@ public static class ExportFormatExtensions ExportFormat.HtmlLight => "HTML (Light)", ExportFormat.Csv => "CSV", ExportFormat.Json => "JSON", - _ => throw new ArgumentOutOfRangeException(nameof(format)) + _ => throw new ArgumentOutOfRangeException(nameof(format)), }; } diff --git a/DiscordChatExporter.Core/Exporting/ExportRequest.cs b/DiscordChatExporter.Core/Exporting/ExportRequest.cs index 30a7cb2..2804e6c 100644 --- a/DiscordChatExporter.Core/Exporting/ExportRequest.cs +++ b/DiscordChatExporter.Core/Exporting/ExportRequest.cs @@ -172,24 +172,21 @@ public partial class ExportRequest "%C" => channel.Name, "%p" => channel.Position?.ToString(CultureInfo.InvariantCulture) ?? "0", - "%P" - => channel.Parent?.Position?.ToString(CultureInfo.InvariantCulture) - ?? "0", - - "%a" - => after?.ToDate().ToString("yyyy-MM-dd", CultureInfo.InvariantCulture) - ?? "", - "%b" - => before?.ToDate().ToString("yyyy-MM-dd", CultureInfo.InvariantCulture) - ?? "", - "%d" - => DateTimeOffset.Now.ToString( - "yyyy-MM-dd", - CultureInfo.InvariantCulture - ), + "%P" => channel.Parent?.Position?.ToString(CultureInfo.InvariantCulture) + ?? "0", + + "%a" => after?.ToDate().ToString("yyyy-MM-dd", CultureInfo.InvariantCulture) + ?? "", + "%b" => before + ?.ToDate() + .ToString("yyyy-MM-dd", CultureInfo.InvariantCulture) ?? "", + "%d" => DateTimeOffset.Now.ToString( + "yyyy-MM-dd", + CultureInfo.InvariantCulture + ), "%%" => "%", - _ => m.Value + _ => m.Value, } ) ); diff --git a/DiscordChatExporter.Core/Exporting/Filtering/BinaryExpressionKind.cs b/DiscordChatExporter.Core/Exporting/Filtering/BinaryExpressionKind.cs index 7514759..4a639c1 100644 --- a/DiscordChatExporter.Core/Exporting/Filtering/BinaryExpressionKind.cs +++ b/DiscordChatExporter.Core/Exporting/Filtering/BinaryExpressionKind.cs @@ -3,5 +3,5 @@ internal enum BinaryExpressionKind { Or, - And + And, } diff --git a/DiscordChatExporter.Core/Exporting/Filtering/BinaryExpressionMessageFilter.cs b/DiscordChatExporter.Core/Exporting/Filtering/BinaryExpressionMessageFilter.cs index 73ab483..6267fb7 100644 --- a/DiscordChatExporter.Core/Exporting/Filtering/BinaryExpressionMessageFilter.cs +++ b/DiscordChatExporter.Core/Exporting/Filtering/BinaryExpressionMessageFilter.cs @@ -14,6 +14,6 @@ internal class BinaryExpressionMessageFilter( { BinaryExpressionKind.Or => first.IsMatch(message) || second.IsMatch(message), BinaryExpressionKind.And => first.IsMatch(message) && second.IsMatch(message), - _ => throw new InvalidOperationException($"Unknown binary expression kind '{kind}'.") + _ => throw new InvalidOperationException($"Unknown binary expression kind '{kind}'."), }; } diff --git a/DiscordChatExporter.Core/Exporting/Filtering/HasMessageFilter.cs b/DiscordChatExporter.Core/Exporting/Filtering/HasMessageFilter.cs index c061ad3..ad5bb43 100644 --- a/DiscordChatExporter.Core/Exporting/Filtering/HasMessageFilter.cs +++ b/DiscordChatExporter.Core/Exporting/Filtering/HasMessageFilter.cs @@ -17,15 +17,13 @@ internal class HasMessageFilter(MessageContentMatchKind kind) : MessageFilter MessageContentMatchKind.Image => message.Attachments.Any(file => file.IsImage), MessageContentMatchKind.Sound => message.Attachments.Any(file => file.IsAudio), MessageContentMatchKind.Pin => message.IsPinned, - MessageContentMatchKind.Invite - => MarkdownParser - .ExtractLinks(message.Content) - .Select(l => l.Url) - .Select(Invite.TryGetCodeFromUrl) - .Any(c => !string.IsNullOrWhiteSpace(c)), - _ - => throw new InvalidOperationException( - $"Unknown message content match kind '{kind}'." - ) + MessageContentMatchKind.Invite => MarkdownParser + .ExtractLinks(message.Content) + .Select(l => l.Url) + .Select(Invite.TryGetCodeFromUrl) + .Any(c => !string.IsNullOrWhiteSpace(c)), + _ => throw new InvalidOperationException( + $"Unknown message content match kind '{kind}'." + ), }; } diff --git a/DiscordChatExporter.Core/Exporting/Filtering/MessageContentMatchKind.cs b/DiscordChatExporter.Core/Exporting/Filtering/MessageContentMatchKind.cs index d649661..eae531a 100644 --- a/DiscordChatExporter.Core/Exporting/Filtering/MessageContentMatchKind.cs +++ b/DiscordChatExporter.Core/Exporting/Filtering/MessageContentMatchKind.cs @@ -9,5 +9,5 @@ internal enum MessageContentMatchKind Image, Sound, Pin, - Invite + Invite, } diff --git a/DiscordChatExporter.Core/Exporting/Filtering/Parsing/FilterGrammar.cs b/DiscordChatExporter.Core/Exporting/Filtering/Parsing/FilterGrammar.cs index 2015694..c509b08 100644 --- a/DiscordChatExporter.Core/Exporting/Filtering/Parsing/FilterGrammar.cs +++ b/DiscordChatExporter.Core/Exporting/Filtering/Parsing/FilterGrammar.cs @@ -125,7 +125,7 @@ internal static class FilterGrammar op switch { '|' => new BinaryExpressionMessageFilter(left, right, BinaryExpressionKind.Or), - _ => new BinaryExpressionMessageFilter(left, right, BinaryExpressionKind.And) + _ => new BinaryExpressionMessageFilter(left, right, BinaryExpressionKind.And), } ); diff --git a/DiscordChatExporter.Core/Exporting/HtmlMarkdownVisitor.cs b/DiscordChatExporter.Core/Exporting/HtmlMarkdownVisitor.cs index 735aade..fa11d97 100644 --- a/DiscordChatExporter.Core/Exporting/HtmlMarkdownVisitor.cs +++ b/DiscordChatExporter.Core/Exporting/HtmlMarkdownVisitor.cs @@ -34,58 +34,51 @@ internal partial class HtmlMarkdownVisitor( { var (openingTag, closingTag) = formatting.Kind switch { - FormattingKind.Bold - => ( - // lang=html - "", - // lang=html - "" - ), - - FormattingKind.Italic - => ( - // lang=html - "", - // lang=html - "" - ), - - FormattingKind.Underline - => ( - // lang=html - "", - // lang=html - "" - ), - - FormattingKind.Strikethrough - => ( - // lang=html - "", - // lang=html - "" - ), - - FormattingKind.Spoiler - => ( - // lang=html - """""", - // lang=html - """""" - ), - - FormattingKind.Quote - => ( - // lang=html - """
""", - // lang=html - """
""" - ), - - _ - => throw new InvalidOperationException( - $"Unknown formatting kind '{formatting.Kind}'." - ) + FormattingKind.Bold => ( + // lang=html + "", + // lang=html + "" + ), + + FormattingKind.Italic => ( + // lang=html + "", + // lang=html + "" + ), + + FormattingKind.Underline => ( + // lang=html + "", + // lang=html + "" + ), + + FormattingKind.Strikethrough => ( + // lang=html + "", + // lang=html + "" + ), + + FormattingKind.Spoiler => ( + // lang=html + """""", + // lang=html + """""" + ), + + FormattingKind.Quote => ( + // lang=html + """
""", + // lang=html + """
""" + ), + + _ => throw new InvalidOperationException( + $"Unknown formatting kind '{formatting.Kind}'." + ), }; buffer.Append(openingTag); diff --git a/DiscordChatExporter.Core/Exporting/HtmlMessageWriter.cs b/DiscordChatExporter.Core/Exporting/HtmlMessageWriter.cs index 1747afd..05b1bba 100644 --- a/DiscordChatExporter.Core/Exporting/HtmlMessageWriter.cs +++ b/DiscordChatExporter.Core/Exporting/HtmlMessageWriter.cs @@ -90,7 +90,7 @@ internal class HtmlMessageWriter(Stream stream, ExportContext context, string th await new MessageGroupTemplate { Context = Context, - Messages = messages + Messages = messages, }.RenderAsync(cancellationToken) ) ); @@ -131,7 +131,7 @@ internal class HtmlMessageWriter(Stream stream, ExportContext context, string th await new PostambleTemplate { Context = Context, - MessagesWritten = MessagesWritten + MessagesWritten = MessagesWritten, }.RenderAsync(cancellationToken) ) ); diff --git a/DiscordChatExporter.Core/Exporting/JsonMessageWriter.cs b/DiscordChatExporter.Core/Exporting/JsonMessageWriter.cs index 2f8a444..60ba01f 100644 --- a/DiscordChatExporter.Core/Exporting/JsonMessageWriter.cs +++ b/DiscordChatExporter.Core/Exporting/JsonMessageWriter.cs @@ -25,7 +25,7 @@ internal class JsonMessageWriter(Stream stream, ExportContext context) Indented = true, // Validation errors may mask actual failures // https://github.com/Tyrrrz/DiscordChatExporter/issues/413 - SkipValidation = true + SkipValidation = true, } ); diff --git a/DiscordChatExporter.Core/Exporting/MessageExporter.cs b/DiscordChatExporter.Core/Exporting/MessageExporter.cs index 24b1e62..05181b1 100644 --- a/DiscordChatExporter.Core/Exporting/MessageExporter.cs +++ b/DiscordChatExporter.Core/Exporting/MessageExporter.cs @@ -100,13 +100,15 @@ internal partial class MessageExporter ExportFormat.PlainText => new PlainTextMessageWriter(File.Create(filePath), context), ExportFormat.Csv => new CsvMessageWriter(File.Create(filePath), context), ExportFormat.HtmlDark => new HtmlMessageWriter(File.Create(filePath), context, "Dark"), - ExportFormat.HtmlLight - => new HtmlMessageWriter(File.Create(filePath), context, "Light"), + ExportFormat.HtmlLight => new HtmlMessageWriter( + File.Create(filePath), + context, + "Light" + ), ExportFormat.Json => new JsonMessageWriter(File.Create(filePath), context), - _ - => throw new ArgumentOutOfRangeException( - nameof(format), - $"Unknown export format '{format}'." - ) + _ => throw new ArgumentOutOfRangeException( + nameof(format), + $"Unknown export format '{format}'." + ), }; } diff --git a/DiscordChatExporter.Core/Exporting/Partitioning/PartitionLimit.cs b/DiscordChatExporter.Core/Exporting/Partitioning/PartitionLimit.cs index 016a665..11e73c8 100644 --- a/DiscordChatExporter.Core/Exporting/Partitioning/PartitionLimit.cs +++ b/DiscordChatExporter.Core/Exporting/Partitioning/PartitionLimit.cs @@ -37,7 +37,7 @@ public partial class PartitionLimit "M" => 1_000_000, "K" => 1_000, "" => 1, - _ => -1 + _ => -1, }; if (magnitude < 0) diff --git a/DiscordChatExporter.Core/Exporting/PlainTextMessageExtensions.cs b/DiscordChatExporter.Core/Exporting/PlainTextMessageExtensions.cs index 572cfaa..023bf97 100644 --- a/DiscordChatExporter.Core/Exporting/PlainTextMessageExtensions.cs +++ b/DiscordChatExporter.Core/Exporting/PlainTextMessageExtensions.cs @@ -10,20 +10,18 @@ internal static class PlainTextMessageExtensions public static string GetFallbackContent(this Message message) => message.Kind switch { - MessageKind.RecipientAdd - => message.MentionedUsers.Any() - ? $"Added {message.MentionedUsers.First().DisplayName} to the group." - : "Added a recipient.", + MessageKind.RecipientAdd => message.MentionedUsers.Any() + ? $"Added {message.MentionedUsers.First().DisplayName} to the group." + : "Added a recipient.", - MessageKind.RecipientRemove - => message.MentionedUsers.Any() - ? message.Author.Id == message.MentionedUsers.First().Id - ? "Left the group." - : $"Removed {message.MentionedUsers.First().DisplayName} from the group." - : "Removed a recipient.", + MessageKind.RecipientRemove => message.MentionedUsers.Any() + ? message.Author.Id == message.MentionedUsers.First().Id + ? "Left the group." + : $"Removed {message.MentionedUsers.First().DisplayName} from the group." + : "Removed a recipient.", - MessageKind.Call - => $"Started a call that lasted { + MessageKind.Call => + $"Started a call that lasted { message .CallEndedTimestamp? .Pipe(t => t - message.Timestamp) @@ -31,16 +29,15 @@ internal static class PlainTextMessageExtensions .ToString("n0", CultureInfo.InvariantCulture) ?? "0" } minutes.", - MessageKind.ChannelNameChange - => !string.IsNullOrWhiteSpace(message.Content) - ? $"Changed the channel name: {message.Content}" - : "Changed the channel name.", + MessageKind.ChannelNameChange => !string.IsNullOrWhiteSpace(message.Content) + ? $"Changed the channel name: {message.Content}" + : "Changed the channel name.", MessageKind.ChannelIconChange => "Changed the channel icon.", MessageKind.ChannelPinnedMessage => "Pinned a message.", MessageKind.ThreadCreated => "Started a thread.", MessageKind.GuildMemberJoin => "Joined the server.", - _ => message.Content + _ => message.Content, }; } diff --git a/DiscordChatExporter.Core/Markdown/FormattingKind.cs b/DiscordChatExporter.Core/Markdown/FormattingKind.cs index 658def7..cce3970 100644 --- a/DiscordChatExporter.Core/Markdown/FormattingKind.cs +++ b/DiscordChatExporter.Core/Markdown/FormattingKind.cs @@ -7,5 +7,5 @@ internal enum FormattingKind Underline, Strikethrough, Spoiler, - Quote + Quote, } diff --git a/DiscordChatExporter.Core/Markdown/MentionKind.cs b/DiscordChatExporter.Core/Markdown/MentionKind.cs index dbd1bff..c26f7ef 100644 --- a/DiscordChatExporter.Core/Markdown/MentionKind.cs +++ b/DiscordChatExporter.Core/Markdown/MentionKind.cs @@ -6,5 +6,5 @@ internal enum MentionKind Here, User, Channel, - Role + Role, } diff --git a/DiscordChatExporter.Core/Markdown/Parsing/MarkdownParser.cs b/DiscordChatExporter.Core/Markdown/Parsing/MarkdownParser.cs index 87399f9..db67c4f 100644 --- a/DiscordChatExporter.Core/Markdown/Parsing/MarkdownParser.cs +++ b/DiscordChatExporter.Core/Markdown/Parsing/MarkdownParser.cs @@ -377,10 +377,9 @@ internal static partial class MarkdownParser null => null, // Unknown format: throw an exception to consider this timestamp invalid // https://github.com/Tyrrrz/DiscordChatExporter/issues/1156 - var f - => throw new InvalidOperationException( - $"Unknown timestamp format '{f}'." - ) + var f => throw new InvalidOperationException( + $"Unknown timestamp format '{f}'." + ), }; return new TimestampNode(instant, format); diff --git a/DiscordChatExporter.Core/Utils/Http.cs b/DiscordChatExporter.Core/Utils/Http.cs index b70852c..7ed0b47 100644 --- a/DiscordChatExporter.Core/Utils/Http.cs +++ b/DiscordChatExporter.Core/Utils/Http.cs @@ -39,7 +39,7 @@ public static class Http ShouldHandle = new PredicateBuilder().Handle(IsRetryableException), MaxRetryAttempts = 4, BackoffType = DelayBackoffType.Exponential, - Delay = TimeSpan.FromSeconds(1) + Delay = TimeSpan.FromSeconds(1), } ) .Build(); @@ -68,7 +68,7 @@ public static class Http return ValueTask.FromResult( TimeSpan.FromSeconds(Math.Pow(2, args.AttemptNumber) + 1) ); - } + }, } ) .Build(); diff --git a/DiscordChatExporter.Core/Utils/PathEx.cs b/DiscordChatExporter.Core/Utils/PathEx.cs index 1a76ec5..b2e75ac 100644 --- a/DiscordChatExporter.Core/Utils/PathEx.cs +++ b/DiscordChatExporter.Core/Utils/PathEx.cs @@ -9,7 +9,7 @@ public static class PathEx { private static readonly HashSet InvalidFileNameChars = [ - .. Path.GetInvalidFileNameChars() + .. Path.GetInvalidFileNameChars(), ]; public static string EscapeFileName(string path) diff --git a/DiscordChatExporter.Gui/App.axaml.cs b/DiscordChatExporter.Gui/App.axaml.cs index c9a5d91..5d333ae 100644 --- a/DiscordChatExporter.Gui/App.axaml.cs +++ b/DiscordChatExporter.Gui/App.axaml.cs @@ -61,7 +61,7 @@ public class App : Application, IDisposable { ThemeVariant.Light => Avalonia.Styling.ThemeVariant.Light, ThemeVariant.Dark => Avalonia.Styling.ThemeVariant.Dark, - _ => Avalonia.Styling.ThemeVariant.Default + _ => Avalonia.Styling.ThemeVariant.Default, }; InitializeTheme(); @@ -86,7 +86,7 @@ public class App : Application, IDisposable { "Light" => PlatformThemeVariant.Light, "Dark" => PlatformThemeVariant.Dark, - _ => PlatformSettings?.GetColorValues().ThemeVariant ?? PlatformThemeVariant.Light + _ => PlatformSettings?.GetColorValues().ThemeVariant ?? PlatformThemeVariant.Light, }; this.LocateMaterialTheme().CurrentTheme = diff --git a/DiscordChatExporter.Gui/Framework/DialogManager.cs b/DiscordChatExporter.Gui/Framework/DialogManager.cs index 6ec2f32..930c02c 100644 --- a/DiscordChatExporter.Gui/Framework/DialogManager.cs +++ b/DiscordChatExporter.Gui/Framework/DialogManager.cs @@ -56,7 +56,7 @@ public class DialogManager : IDisposable { FileTypeChoices = fileTypes, SuggestedFileName = defaultFilePath, - DefaultExtension = Path.GetExtension(defaultFilePath).TrimStart('.') + DefaultExtension = Path.GetExtension(defaultFilePath).TrimStart('.'), } ); @@ -77,7 +77,7 @@ public class DialogManager : IDisposable new FolderPickerOpenOptions { AllowMultiple = false, - SuggestedStartLocation = startLocation + SuggestedStartLocation = startLocation, } ); diff --git a/DiscordChatExporter.Gui/Framework/ThemeVariant.cs b/DiscordChatExporter.Gui/Framework/ThemeVariant.cs index e89751d..820deeb 100644 --- a/DiscordChatExporter.Gui/Framework/ThemeVariant.cs +++ b/DiscordChatExporter.Gui/Framework/ThemeVariant.cs @@ -4,5 +4,5 @@ public enum ThemeVariant { System, Light, - Dark + Dark, } diff --git a/DiscordChatExporter.Gui/Framework/ViewManager.cs b/DiscordChatExporter.Gui/Framework/ViewManager.cs index a9dc2aa..4096778 100644 --- a/DiscordChatExporter.Gui/Framework/ViewManager.cs +++ b/DiscordChatExporter.Gui/Framework/ViewManager.cs @@ -19,7 +19,7 @@ public partial class ViewManager ExportSetupViewModel => new ExportSetupView(), MessageBoxViewModel => new MessageBoxView(), SettingsViewModel => new SettingsView(), - _ => null + _ => null, }; public Control? TryBindView(ViewModelBase viewModel) diff --git a/DiscordChatExporter.Gui/Models/ThreadInclusionMode.cs b/DiscordChatExporter.Gui/Models/ThreadInclusionMode.cs index 41e2162..a5d610a 100644 --- a/DiscordChatExporter.Gui/Models/ThreadInclusionMode.cs +++ b/DiscordChatExporter.Gui/Models/ThreadInclusionMode.cs @@ -4,5 +4,5 @@ public enum ThreadInclusionMode { None, Active, - All + All, } diff --git a/DiscordChatExporter.Gui/ViewModels/Components/DashboardViewModel.cs b/DiscordChatExporter.Gui/ViewModels/Components/DashboardViewModel.cs index 9172880..56a12a0 100644 --- a/DiscordChatExporter.Gui/ViewModels/Components/DashboardViewModel.cs +++ b/DiscordChatExporter.Gui/ViewModels/Components/DashboardViewModel.cs @@ -253,7 +253,7 @@ public partial class DashboardViewModel : ViewModelBase channelProgressPairs, new ParallelOptions { - MaxDegreeOfParallelism = Math.Max(1, _settingsService.ParallelLimit) + MaxDegreeOfParallelism = Math.Max(1, _settingsService.ParallelLimit), }, async (pair, cancellationToken) => { diff --git a/DiscordChatExporter.Gui/ViewModels/Dialogs/ExportSetupViewModel.cs b/DiscordChatExporter.Gui/ViewModels/Dialogs/ExportSetupViewModel.cs index 5ea15b3..1baf285 100644 --- a/DiscordChatExporter.Gui/ViewModels/Dialogs/ExportSetupViewModel.cs +++ b/DiscordChatExporter.Gui/ViewModels/Dialogs/ExportSetupViewModel.cs @@ -138,8 +138,8 @@ public partial class ExportSetupViewModel( [ new FilePickerFileType($"{extension.ToUpperInvariant()} file") { - Patterns = [$"*.{extension}"] - } + Patterns = [$"*.{extension}"], + }, ], defaultFileName ); diff --git a/DiscordChatExporter.Gui/ViewModels/Dialogs/SettingsViewModel.cs b/DiscordChatExporter.Gui/ViewModels/Dialogs/SettingsViewModel.cs index 4193e6a..66c28b9 100644 --- a/DiscordChatExporter.Gui/ViewModels/Dialogs/SettingsViewModel.cs +++ b/DiscordChatExporter.Gui/ViewModels/Dialogs/SettingsViewModel.cs @@ -85,7 +85,7 @@ public class SettingsViewModel : DialogViewModelBase "zh-CN", "ja-JP", "zh-TW", - "ko-KR" + "ko-KR", ]; // This has to be non-nullable because Avalonia ComboBox doesn't allow a null value to be selected