From 4896d748aa94a29c259c0aef47906ce4fdf2b99c Mon Sep 17 00:00:00 2001 From: Tyrrrz <1935960+Tyrrrz@users.noreply.github.com> Date: Thu, 9 Nov 2023 13:06:00 +0200 Subject: [PATCH] Update NuGet packages --- .../DiscordChatExporter.Cli.Tests.csproj | 6 +- .../Commands/Base/DiscordCommandBase.cs | 12 +-- .../Commands/Base/ExportCommandBase.cs | 88 ++++++++++++------- .../Commands/ExportAllCommand.cs | 24 ++--- .../Commands/GetChannelsCommand.cs | 20 +++-- .../Commands/GetDirectChannelsCommand.cs | 6 +- .../Commands/GuideCommand.cs | 42 +++++---- .../DiscordChatExporter.Cli.csproj | 2 +- .../Discord/Data/Embeds/EmbedVideo.cs | 2 +- .../Embeds/SpotifyTrackEmbedProjection.cs | 8 +- .../Discord/Data/Message.cs | 3 +- .../Discord/DiscordClient.cs | 16 ++-- .../DiscordChatExporter.Core.csproj | 6 +- .../Exporting/ExportAssetDownloader.cs | 4 +- .../Exporting/ExportContext.cs | 3 +- .../Exporting/ExportRequest.cs | 7 +- .../Filtering/ContainsMessageFilter.cs | 18 ++-- .../Filtering/MentionsMessageFilter.cs | 16 ++-- .../Filtering/ReactionMessageFilter.cs | 18 ++-- .../Exporting/HtmlMarkdownVisitor.cs | 3 +- .../Exporting/JsonMessageWriter.cs | 14 +-- .../Exporting/MessageExporter.cs | 8 +- .../Markdown/Parsing/AggregateMatcher.cs | 3 +- .../Markdown/Parsing/StringMatcher.cs | 10 +-- DiscordChatExporter.Gui/Bootstrapper.cs | 1 - .../DiscordChatExporter.Gui.csproj | 4 +- .../Services/SettingsService.cs | 3 +- .../Components/DashboardViewModel.cs | 5 +- .../ViewModels/RootViewModel.cs | 2 +- 29 files changed, 204 insertions(+), 150 deletions(-) diff --git a/DiscordChatExporter.Cli.Tests/DiscordChatExporter.Cli.Tests.csproj b/DiscordChatExporter.Cli.Tests/DiscordChatExporter.Cli.Tests.csproj index d25043c..d33b4f3 100644 --- a/DiscordChatExporter.Cli.Tests/DiscordChatExporter.Cli.Tests.csproj +++ b/DiscordChatExporter.Cli.Tests/DiscordChatExporter.Cli.Tests.csproj @@ -13,16 +13,16 @@ - + - + - + diff --git a/DiscordChatExporter.Cli/Commands/Base/DiscordCommandBase.cs b/DiscordChatExporter.Cli/Commands/Base/DiscordCommandBase.cs index 610f1dc..abdde1e 100644 --- a/DiscordChatExporter.Cli/Commands/Base/DiscordCommandBase.cs +++ b/DiscordChatExporter.Cli/Commands/Base/DiscordCommandBase.cs @@ -37,11 +37,13 @@ public abstract class DiscordCommandBase : ICommand { using (console.WithForegroundColor(ConsoleColor.DarkYellow)) { - console.Error.WriteLine( - "Warning: Option --bot is deprecated and should not be used. " - + "The type of the provided token is now inferred automatically. " - + "Please update your workflows as this option may be completely removed in a future version." - ); + console + .Error + .WriteLine( + "Warning: Option --bot is deprecated and should not be used. " + + "The type of the provided token is now inferred automatically. " + + "Please update your workflows as this option may be completely removed in a future version." + ); } } #pragma warning restore CS0618 diff --git a/DiscordChatExporter.Cli/Commands/Base/ExportCommandBase.cs b/DiscordChatExporter.Cli/Commands/Base/ExportCommandBase.cs index 39e6119..711fa1f 100644 --- a/DiscordChatExporter.Cli/Commands/Base/ExportCommandBase.cs +++ b/DiscordChatExporter.Cli/Commands/Base/ExportCommandBase.cs @@ -244,9 +244,11 @@ public abstract class ExportCommandBase : DiscordCommandBase // Print the result using (console.WithForegroundColor(ConsoleColor.White)) { - await console.Output.WriteLineAsync( - $"Successfully exported {channels.Count - errorsByChannel.Count} channel(s)." - ); + await console + .Output + .WriteLineAsync( + $"Successfully exported {channels.Count - errorsByChannel.Count} channel(s)." + ); } // Print errors @@ -256,9 +258,11 @@ public abstract class ExportCommandBase : DiscordCommandBase using (console.WithForegroundColor(ConsoleColor.Red)) { - await console.Error.WriteLineAsync( - $"Failed to export {errorsByChannel.Count} the following channel(s):" - ); + await console + .Error + .WriteLineAsync( + $"Failed to export {errorsByChannel.Count} the following channel(s):" + ); } foreach (var (channel, error) in errorsByChannel) @@ -320,33 +324,51 @@ public abstract class ExportCommandBase : DiscordCommandBase // Support Ukraine callout if (!IsUkraineSupportMessageDisabled) { - console.Output.WriteLine( - "┌────────────────────────────────────────────────────────────────────┐" - ); - console.Output.WriteLine( - "│ Thank you for supporting Ukraine <3 │" - ); - console.Output.WriteLine( - "│ │" - ); - console.Output.WriteLine( - "│ As Russia wages a genocidal war against my country, │" - ); - console.Output.WriteLine( - "│ I'm grateful to everyone who continues to │" - ); - console.Output.WriteLine( - "│ stand with Ukraine in our fight for freedom. │" - ); - console.Output.WriteLine( - "│ │" - ); - console.Output.WriteLine( - "│ Learn more: https://tyrrrz.me/ukraine │" - ); - console.Output.WriteLine( - "└────────────────────────────────────────────────────────────────────┘" - ); + console + .Output + .WriteLine( + "┌────────────────────────────────────────────────────────────────────┐" + ); + console + .Output + .WriteLine( + "│ Thank you for supporting Ukraine <3 │" + ); + console + .Output + .WriteLine( + "│ │" + ); + console + .Output + .WriteLine( + "│ As Russia wages a genocidal war against my country, │" + ); + console + .Output + .WriteLine( + "│ I'm grateful to everyone who continues to │" + ); + console + .Output + .WriteLine( + "│ stand with Ukraine in our fight for freedom. │" + ); + console + .Output + .WriteLine( + "│ │" + ); + console + .Output + .WriteLine( + "│ Learn more: https://tyrrrz.me/ukraine │" + ); + console + .Output + .WriteLine( + "└────────────────────────────────────────────────────────────────────┘" + ); console.Output.WriteLine(""); } diff --git a/DiscordChatExporter.Cli/Commands/ExportAllCommand.cs b/DiscordChatExporter.Cli/Commands/ExportAllCommand.cs index 12335a1..cc6a0a7 100644 --- a/DiscordChatExporter.Cli/Commands/ExportAllCommand.cs +++ b/DiscordChatExporter.Cli/Commands/ExportAllCommand.cs @@ -54,9 +54,9 @@ public class ExportAllCommand : ExportCommandBase await foreach (var guild in Discord.GetUserGuildsAsync(cancellationToken)) { // Regular channels - await console.Output.WriteLineAsync( - $"Fetching channels for guild '{guild.Name}'..." - ); + await console + .Output + .WriteLineAsync($"Fetching channels for guild '{guild.Name}'..."); var fetchedChannelsCount = 0; await console @@ -94,9 +94,9 @@ public class ExportAllCommand : ExportCommandBase // Threads if (ThreadInclusionMode != ThreadInclusionMode.None) { - await console.Output.WriteLineAsync( - $"Fetching threads for guild '{guild.Name}'..." - ); + await console + .Output + .WriteLineAsync($"Fetching threads for guild '{guild.Name}'..."); var fetchedThreadsCount = 0; await console @@ -126,9 +126,9 @@ public class ExportAllCommand : ExportCommandBase } ); - await console.Output.WriteLineAsync( - $"Fetched {fetchedThreadsCount} thread(s)." - ); + await console + .Output + .WriteLineAsync($"Fetched {fetchedThreadsCount} thread(s)."); } } } @@ -180,9 +180,9 @@ public class ExportAllCommand : ExportCommandBase using (console.WithForegroundColor(ConsoleColor.Red)) { - await console.Error.WriteLineAsync( - "Failed to access the following channel(s):" - ); + await console + .Error + .WriteLineAsync("Failed to access the following channel(s):"); } foreach (var dumpChannel in inaccessibleChannels) diff --git a/DiscordChatExporter.Cli/Commands/GetChannelsCommand.cs b/DiscordChatExporter.Cli/Commands/GetChannelsCommand.cs index 6dca94f..bddc323 100644 --- a/DiscordChatExporter.Cli/Commands/GetChannelsCommand.cs +++ b/DiscordChatExporter.Cli/Commands/GetChannelsCommand.cs @@ -64,9 +64,9 @@ public class GetChannelsCommand : DiscordCommandBase foreach (var channel in channels) { // Channel ID - await console.Output.WriteAsync( - channel.Id.ToString().PadRight(channelIdMaxLength, ' ') - ); + await console + .Output + .WriteAsync(channel.Id.ToString().PadRight(channelIdMaxLength, ' ')); // Separator using (console.WithForegroundColor(ConsoleColor.DarkGray)) @@ -88,9 +88,11 @@ public class GetChannelsCommand : DiscordCommandBase await console.Output.WriteAsync(" * "); // Thread ID - await console.Output.WriteAsync( - channelThread.Id.ToString().PadRight(channelThreadIdMaxLength, ' ') - ); + await console + .Output + .WriteAsync( + channelThread.Id.ToString().PadRight(channelThreadIdMaxLength, ' ') + ); // Separator using (console.WithForegroundColor(ConsoleColor.DarkGray)) @@ -106,9 +108,9 @@ public class GetChannelsCommand : DiscordCommandBase // Thread status using (console.WithForegroundColor(ConsoleColor.White)) - await console.Output.WriteLineAsync( - channelThread.IsArchived ? "Archived" : "Active" - ); + await console + .Output + .WriteLineAsync(channelThread.IsArchived ? "Archived" : "Active"); } } } diff --git a/DiscordChatExporter.Cli/Commands/GetDirectChannelsCommand.cs b/DiscordChatExporter.Cli/Commands/GetDirectChannelsCommand.cs index daedf09..a72368d 100644 --- a/DiscordChatExporter.Cli/Commands/GetDirectChannelsCommand.cs +++ b/DiscordChatExporter.Cli/Commands/GetDirectChannelsCommand.cs @@ -33,9 +33,9 @@ public class GetDirectChannelsCommand : DiscordCommandBase foreach (var channel in channels) { // Channel ID - await console.Output.WriteAsync( - channel.Id.ToString().PadRight(channelIdMaxLength, ' ') - ); + await console + .Output + .WriteAsync(channel.Id.ToString().PadRight(channelIdMaxLength, ' ')); // Separator using (console.WithForegroundColor(ConsoleColor.DarkGray)) diff --git a/DiscordChatExporter.Cli/Commands/GuideCommand.cs b/DiscordChatExporter.Cli/Commands/GuideCommand.cs index 837e7ba..af7fcad 100644 --- a/DiscordChatExporter.Cli/Commands/GuideCommand.cs +++ b/DiscordChatExporter.Cli/Commands/GuideCommand.cs @@ -15,18 +15,20 @@ public class GuideCommand : ICommand using (console.WithForegroundColor(ConsoleColor.White)) console.Output.WriteLine("To get user token:"); - console.Output.WriteLine( - " * Automating user accounts is technically against TOS — USE AT YOUR OWN RISK!" - ); + console + .Output + .WriteLine( + " * Automating user accounts is technically against TOS — USE AT YOUR OWN RISK!" + ); console.Output.WriteLine(" 1. Open Discord in your web browser and login"); console.Output.WriteLine(" 2. Open any server or direct message channel"); console.Output.WriteLine(" 3. Press Ctrl+Shift+I to show developer tools"); console.Output.WriteLine(" 4. Navigate to the Network tab"); console.Output.WriteLine(" 5. Press Ctrl+R to reload"); console.Output.WriteLine(" 6. Switch between random channels to trigger network requests"); - console.Output.WriteLine( - " 7. Search for a request containing \"messages?limit=50\" or similar" - ); + console + .Output + .WriteLine(" 7. Search for a request containing \"messages?limit=50\" or similar"); console.Output.WriteLine(" 8. Select the Headers tab on the right"); console.Output.WriteLine(" 9. Scroll down to the Request Headers section"); console.Output.WriteLine(" 10. Copy the value of the \"authorization\" header"); @@ -40,9 +42,11 @@ public class GuideCommand : ICommand console.Output.WriteLine(" 2. Open your application's settings"); console.Output.WriteLine(" 3. Navigate to the Bot section on the left"); console.Output.WriteLine(" 4. Under Token click Copy"); - console.Output.WriteLine( - " * Your bot needs to have Message Content Intent enabled to read messages" - ); + console + .Output + .WriteLine( + " * Your bot needs to have Message Content Intent enabled to read messages" + ); console.Output.WriteLine(); // Guild or channel ID @@ -53,20 +57,22 @@ public class GuideCommand : ICommand console.Output.WriteLine(" 2. Open Settings"); console.Output.WriteLine(" 3. Go to Advanced section"); console.Output.WriteLine(" 4. Enable Developer Mode"); - console.Output.WriteLine( - " 5. Right-click on the desired guild or channel and click Copy Server ID or Copy Channel ID" - ); + console + .Output + .WriteLine( + " 5. Right-click on the desired guild or channel and click Copy Server ID or Copy Channel ID" + ); console.Output.WriteLine(); // Docs link using (console.WithForegroundColor(ConsoleColor.White)) - console.Output.WriteLine( - "If you have questions or issues, please refer to the documentation:" - ); + console + .Output + .WriteLine("If you have questions or issues, please refer to the documentation:"); using (console.WithForegroundColor(ConsoleColor.DarkCyan)) - console.Output.WriteLine( - "https://github.com/Tyrrrz/DiscordChatExporter/blob/master/.docs" - ); + console + .Output + .WriteLine("https://github.com/Tyrrrz/DiscordChatExporter/blob/master/.docs"); return default; } diff --git a/DiscordChatExporter.Cli/DiscordChatExporter.Cli.csproj b/DiscordChatExporter.Cli/DiscordChatExporter.Cli.csproj index 06daef9..fe1a4a3 100644 --- a/DiscordChatExporter.Cli/DiscordChatExporter.Cli.csproj +++ b/DiscordChatExporter.Cli/DiscordChatExporter.Cli.csproj @@ -7,7 +7,7 @@ - + diff --git a/DiscordChatExporter.Core/Discord/Data/Embeds/EmbedVideo.cs b/DiscordChatExporter.Core/Discord/Data/Embeds/EmbedVideo.cs index 1cf2cd2..deb3181 100644 --- a/DiscordChatExporter.Core/Discord/Data/Embeds/EmbedVideo.cs +++ b/DiscordChatExporter.Core/Discord/Data/Embeds/EmbedVideo.cs @@ -1,5 +1,5 @@ -using JsonExtensions.Reading; using System.Text.Json; +using JsonExtensions.Reading; namespace DiscordChatExporter.Core.Discord.Data.Embeds; diff --git a/DiscordChatExporter.Core/Discord/Data/Embeds/SpotifyTrackEmbedProjection.cs b/DiscordChatExporter.Core/Discord/Data/Embeds/SpotifyTrackEmbedProjection.cs index 05c5f67..4d68d62 100644 --- a/DiscordChatExporter.Core/Discord/Data/Embeds/SpotifyTrackEmbedProjection.cs +++ b/DiscordChatExporter.Core/Discord/Data/Embeds/SpotifyTrackEmbedProjection.cs @@ -12,9 +12,11 @@ public partial record SpotifyTrackEmbedProjection private static string? TryParseTrackId(string embedUrl) { // https://open.spotify.com/track/1LHZMWefF9502NPfArRfvP?si=3efac6ce9be04f0a - var trackId = Regex.Match(embedUrl, @"spotify\.com/track/(.*?)(?:\?|&|/|$)").Groups[ - 1 - ].Value; + var trackId = Regex + .Match(embedUrl, @"spotify\.com/track/(.*?)(?:\?|&|/|$)") + .Groups[1] + .Value; + if (!string.IsNullOrWhiteSpace(trackId)) return trackId; diff --git a/DiscordChatExporter.Core/Discord/Data/Message.cs b/DiscordChatExporter.Core/Discord/Data/Message.cs index 69f81df..b02dd98 100644 --- a/DiscordChatExporter.Core/Discord/Data/Message.cs +++ b/DiscordChatExporter.Core/Discord/Data/Message.cs @@ -99,7 +99,8 @@ public partial record Message if (trailingEmbeds.Any()) { // Concatenate all images into one embed - var images = embed.Images + var images = embed + .Images .Concat(trailingEmbeds.SelectMany(e => e.Images)) .ToArray(); diff --git a/DiscordChatExporter.Core/Discord/DiscordClient.cs b/DiscordChatExporter.Core/Discord/DiscordClient.cs index 29649d4..f87fdd3 100644 --- a/DiscordChatExporter.Core/Discord/DiscordClient.cs +++ b/DiscordChatExporter.Core/Discord/DiscordClient.cs @@ -40,10 +40,12 @@ public class DiscordClient // Don't validate because the token can have special characters // https://github.com/Tyrrrz/DiscordChatExporter/issues/828 - request.Headers.TryAddWithoutValidation( - "Authorization", - tokenKind == TokenKind.Bot ? $"Bot {_token}" : _token - ); + request + .Headers + .TryAddWithoutValidation( + "Authorization", + tokenKind == TokenKind.Bot ? $"Bot {_token}" : _token + ); var response = await Http.Client.SendAsync( request, @@ -58,11 +60,13 @@ public class DiscordClient // require properly keeping track of Discord's global/per-route/per-resource // rate limits and that's just way too much effort. // https://discord.com/developers/docs/topics/rate-limits - var remainingRequestCount = response.Headers + var remainingRequestCount = response + .Headers .TryGetValue("X-RateLimit-Remaining") ?.Pipe(s => int.Parse(s, CultureInfo.InvariantCulture)); - var resetAfterDelay = response.Headers + var resetAfterDelay = response + .Headers .TryGetValue("X-RateLimit-Reset-After") ?.Pipe(s => double.Parse(s, CultureInfo.InvariantCulture)) .Pipe(TimeSpan.FromSeconds); diff --git a/DiscordChatExporter.Core/DiscordChatExporter.Core.csproj b/DiscordChatExporter.Core/DiscordChatExporter.Core.csproj index b75c284..bb8692c 100644 --- a/DiscordChatExporter.Core/DiscordChatExporter.Core.csproj +++ b/DiscordChatExporter.Core/DiscordChatExporter.Core.csproj @@ -2,14 +2,14 @@ - + - + - + \ No newline at end of file diff --git a/DiscordChatExporter.Core/Exporting/ExportAssetDownloader.cs b/DiscordChatExporter.Core/Exporting/ExportAssetDownloader.cs index 4741fea..1bef119 100644 --- a/DiscordChatExporter.Core/Exporting/ExportAssetDownloader.cs +++ b/DiscordChatExporter.Core/Exporting/ExportAssetDownloader.cs @@ -65,7 +65,9 @@ internal partial class ExportAssetDownloader // Try to set the file date according to the last-modified header try { - var lastModified = response.Content.Headers + var lastModified = response + .Content + .Headers .TryGetValue("Last-Modified") ?.Pipe( s => diff --git a/DiscordChatExporter.Core/Exporting/ExportContext.cs b/DiscordChatExporter.Core/Exporting/ExportContext.cs index 072ccaf..596d098 100644 --- a/DiscordChatExporter.Core/Exporting/ExportContext.cs +++ b/DiscordChatExporter.Core/Exporting/ExportContext.cs @@ -101,7 +101,8 @@ internal class ExportContext public Role? TryGetRole(Snowflake id) => _rolesById.GetValueOrDefault(id); public IReadOnlyList GetUserRoles(Snowflake id) => - TryGetMember(id)?.RoleIds + TryGetMember(id) + ?.RoleIds .Select(TryGetRole) .WhereNotNull() .OrderByDescending(r => r.Position) diff --git a/DiscordChatExporter.Core/Exporting/ExportRequest.cs b/DiscordChatExporter.Core/Exporting/ExportRequest.cs index 8ddab72..fbd22de 100644 --- a/DiscordChatExporter.Core/Exporting/ExportRequest.cs +++ b/DiscordChatExporter.Core/Exporting/ExportRequest.cs @@ -182,10 +182,9 @@ public partial class ExportRequest => before?.ToDate().ToString("yyyy-MM-dd", CultureInfo.InvariantCulture) ?? "", "%d" - => DateTimeOffset.Now.ToString( - "yyyy-MM-dd", - CultureInfo.InvariantCulture - ), + => DateTimeOffset + .Now + .ToString("yyyy-MM-dd", CultureInfo.InvariantCulture), "%%" => "%", _ => m.Value diff --git a/DiscordChatExporter.Core/Exporting/Filtering/ContainsMessageFilter.cs b/DiscordChatExporter.Core/Exporting/Filtering/ContainsMessageFilter.cs index c424780..e9755ab 100644 --- a/DiscordChatExporter.Core/Exporting/Filtering/ContainsMessageFilter.cs +++ b/DiscordChatExporter.Core/Exporting/Filtering/ContainsMessageFilter.cs @@ -26,12 +26,14 @@ internal class ContainsMessageFilter : MessageFilter public override bool IsMatch(Message message) => IsMatch(message.Content) - || message.Embeds.Any( - e => - IsMatch(e.Title) - || IsMatch(e.Author?.Name) - || IsMatch(e.Description) - || IsMatch(e.Footer?.Text) - || e.Fields.Any(f => IsMatch(f.Name) || IsMatch(f.Value)) - ); + || message + .Embeds + .Any( + e => + IsMatch(e.Title) + || IsMatch(e.Author?.Name) + || IsMatch(e.Description) + || IsMatch(e.Footer?.Text) + || e.Fields.Any(f => IsMatch(f.Name) || IsMatch(f.Value)) + ); } diff --git a/DiscordChatExporter.Core/Exporting/Filtering/MentionsMessageFilter.cs b/DiscordChatExporter.Core/Exporting/Filtering/MentionsMessageFilter.cs index 24e5bb5..94b7582 100644 --- a/DiscordChatExporter.Core/Exporting/Filtering/MentionsMessageFilter.cs +++ b/DiscordChatExporter.Core/Exporting/Filtering/MentionsMessageFilter.cs @@ -11,11 +11,13 @@ internal class MentionsMessageFilter : MessageFilter public MentionsMessageFilter(string value) => _value = value; public override bool IsMatch(Message message) => - message.MentionedUsers.Any( - user => - string.Equals(_value, user.Name, StringComparison.OrdinalIgnoreCase) - || string.Equals(_value, user.DisplayName, StringComparison.OrdinalIgnoreCase) - || string.Equals(_value, user.FullName, StringComparison.OrdinalIgnoreCase) - || string.Equals(_value, user.Id.ToString(), StringComparison.OrdinalIgnoreCase) - ); + message + .MentionedUsers + .Any( + user => + string.Equals(_value, user.Name, StringComparison.OrdinalIgnoreCase) + || string.Equals(_value, user.DisplayName, StringComparison.OrdinalIgnoreCase) + || string.Equals(_value, user.FullName, StringComparison.OrdinalIgnoreCase) + || string.Equals(_value, user.Id.ToString(), StringComparison.OrdinalIgnoreCase) + ); } diff --git a/DiscordChatExporter.Core/Exporting/Filtering/ReactionMessageFilter.cs b/DiscordChatExporter.Core/Exporting/Filtering/ReactionMessageFilter.cs index efb7990..087a84a 100644 --- a/DiscordChatExporter.Core/Exporting/Filtering/ReactionMessageFilter.cs +++ b/DiscordChatExporter.Core/Exporting/Filtering/ReactionMessageFilter.cs @@ -11,10 +11,16 @@ internal class ReactionMessageFilter : MessageFilter public ReactionMessageFilter(string value) => _value = value; public override bool IsMatch(Message message) => - message.Reactions.Any( - r => - string.Equals(_value, r.Emoji.Id?.ToString(), StringComparison.OrdinalIgnoreCase) - || string.Equals(_value, r.Emoji.Name, StringComparison.OrdinalIgnoreCase) - || string.Equals(_value, r.Emoji.Code, StringComparison.OrdinalIgnoreCase) - ); + message + .Reactions + .Any( + r => + string.Equals( + _value, + r.Emoji.Id?.ToString(), + StringComparison.OrdinalIgnoreCase + ) + || string.Equals(_value, r.Emoji.Name, StringComparison.OrdinalIgnoreCase) + || string.Equals(_value, r.Emoji.Code, StringComparison.OrdinalIgnoreCase) + ); } diff --git a/DiscordChatExporter.Core/Exporting/HtmlMarkdownVisitor.cs b/DiscordChatExporter.Core/Exporting/HtmlMarkdownVisitor.cs index 9d294e8..4094b64 100644 --- a/DiscordChatExporter.Core/Exporting/HtmlMarkdownVisitor.cs +++ b/DiscordChatExporter.Core/Exporting/HtmlMarkdownVisitor.cs @@ -196,7 +196,8 @@ internal partial class HtmlMarkdownVisitor : MarkdownVisitor // Try to extract the message ID if the link points to a Discord message var linkedMessageId = Regex .Match(link.Url, @"^https?://(?:discord|discordapp)\.com/channels/.*?/(\d+)/?$") - .Groups[1].Value; + .Groups[1] + .Value; _buffer.Append( !string.IsNullOrWhiteSpace(linkedMessageId) diff --git a/DiscordChatExporter.Core/Exporting/JsonMessageWriter.cs b/DiscordChatExporter.Core/Exporting/JsonMessageWriter.cs index ac25510..693442e 100644 --- a/DiscordChatExporter.Core/Exporting/JsonMessageWriter.cs +++ b/DiscordChatExporter.Core/Exporting/JsonMessageWriter.cs @@ -450,12 +450,14 @@ internal class JsonMessageWriter : MessageWriter _writer.WriteStartArray("users"); await foreach ( - var user in Context.Discord.GetMessageReactionsAsync( - Context.Request.Channel.Id, - message.Id, - reaction.Emoji, - cancellationToken - ) + var user in Context + .Discord + .GetMessageReactionsAsync( + Context.Request.Channel.Id, + message.Id, + reaction.Emoji, + cancellationToken + ) ) { _writer.WriteStartObject(); diff --git a/DiscordChatExporter.Core/Exporting/MessageExporter.cs b/DiscordChatExporter.Core/Exporting/MessageExporter.cs index 8f916c9..0b178df 100644 --- a/DiscordChatExporter.Core/Exporting/MessageExporter.cs +++ b/DiscordChatExporter.Core/Exporting/MessageExporter.cs @@ -44,10 +44,10 @@ internal partial class MessageExporter : IAsyncDisposable // Ensure that the partition limit has not been reached if ( _writer is not null - && _context.Request.PartitionLimit.IsReached( - _writer.MessagesWritten, - _writer.BytesWritten - ) + && _context + .Request + .PartitionLimit + .IsReached(_writer.MessagesWritten, _writer.BytesWritten) ) { await ResetWriterAsync(cancellationToken); diff --git a/DiscordChatExporter.Core/Markdown/Parsing/AggregateMatcher.cs b/DiscordChatExporter.Core/Markdown/Parsing/AggregateMatcher.cs index cc0b398..3e1656c 100644 --- a/DiscordChatExporter.Core/Markdown/Parsing/AggregateMatcher.cs +++ b/DiscordChatExporter.Core/Markdown/Parsing/AggregateMatcher.cs @@ -30,7 +30,8 @@ internal class AggregateMatcher : IMatcher // If this match is earlier than previous earliest - replace if ( - earliestMatch is null || match.Segment.StartIndex < earliestMatch.Segment.StartIndex + earliestMatch is null + || match.Segment.StartIndex < earliestMatch.Segment.StartIndex ) earliestMatch = match; diff --git a/DiscordChatExporter.Core/Markdown/Parsing/StringMatcher.cs b/DiscordChatExporter.Core/Markdown/Parsing/StringMatcher.cs index 867dc8b..7f30735 100644 --- a/DiscordChatExporter.Core/Markdown/Parsing/StringMatcher.cs +++ b/DiscordChatExporter.Core/Markdown/Parsing/StringMatcher.cs @@ -24,12 +24,10 @@ internal class StringMatcher : IMatcher public ParsedMatch? TryMatch(StringSegment segment) { - var index = segment.Source.IndexOf( - _needle, - segment.StartIndex, - segment.Length, - _comparison - ); + var index = segment + .Source + .IndexOf(_needle, segment.StartIndex, segment.Length, _comparison); + if (index < 0) return null; diff --git a/DiscordChatExporter.Gui/Bootstrapper.cs b/DiscordChatExporter.Gui/Bootstrapper.cs index 3829a29..1be1e8b 100644 --- a/DiscordChatExporter.Gui/Bootstrapper.cs +++ b/DiscordChatExporter.Gui/Bootstrapper.cs @@ -3,7 +3,6 @@ using DiscordChatExporter.Gui.ViewModels; using DiscordChatExporter.Gui.ViewModels.Framework; using Stylet; using StyletIoC; - #if !DEBUG using System.Windows; using System.Windows.Threading; diff --git a/DiscordChatExporter.Gui/DiscordChatExporter.Gui.csproj b/DiscordChatExporter.Gui/DiscordChatExporter.Gui.csproj index 09c7642..416c8a2 100644 --- a/DiscordChatExporter.Gui/DiscordChatExporter.Gui.csproj +++ b/DiscordChatExporter.Gui/DiscordChatExporter.Gui.csproj @@ -14,13 +14,13 @@ - + - + diff --git a/DiscordChatExporter.Gui/Services/SettingsService.cs b/DiscordChatExporter.Gui/Services/SettingsService.cs index 526548d..3e90c33 100644 --- a/DiscordChatExporter.Gui/Services/SettingsService.cs +++ b/DiscordChatExporter.Gui/Services/SettingsService.cs @@ -66,7 +66,8 @@ public partial class SettingsService { try { - return Registry.CurrentUser + return Registry + .CurrentUser .OpenSubKey( "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Themes\\Personalize", false diff --git a/DiscordChatExporter.Gui/ViewModels/Components/DashboardViewModel.cs b/DiscordChatExporter.Gui/ViewModels/Components/DashboardViewModel.cs index 830b0b7..4dab3e1 100644 --- a/DiscordChatExporter.Gui/ViewModels/Components/DashboardViewModel.cs +++ b/DiscordChatExporter.Gui/ViewModels/Components/DashboardViewModel.cs @@ -12,8 +12,8 @@ using DiscordChatExporter.Gui.Models; using DiscordChatExporter.Gui.Services; using DiscordChatExporter.Gui.Utils; using DiscordChatExporter.Gui.ViewModels.Dialogs; -using DiscordChatExporter.Gui.ViewModels.Messages; using DiscordChatExporter.Gui.ViewModels.Framework; +using DiscordChatExporter.Gui.ViewModels.Messages; using Gress; using Gress.Completable; using Stylet; @@ -234,7 +234,8 @@ public class DashboardViewModel : PropertyChangedBase var exporter = new ChannelExporter(_discord); - var channelProgressPairs = dialog.Channels! + var channelProgressPairs = dialog + .Channels! .Select(c => new { Channel = c, Progress = _progressMuxer.CreateInput() }) .ToArray(); diff --git a/DiscordChatExporter.Gui/ViewModels/RootViewModel.cs b/DiscordChatExporter.Gui/ViewModels/RootViewModel.cs index 7a663dd..ec7432d 100644 --- a/DiscordChatExporter.Gui/ViewModels/RootViewModel.cs +++ b/DiscordChatExporter.Gui/ViewModels/RootViewModel.cs @@ -4,8 +4,8 @@ using DiscordChatExporter.Gui.Services; using DiscordChatExporter.Gui.Utils; using DiscordChatExporter.Gui.ViewModels.Components; using DiscordChatExporter.Gui.ViewModels.Dialogs; -using DiscordChatExporter.Gui.ViewModels.Messages; using DiscordChatExporter.Gui.ViewModels.Framework; +using DiscordChatExporter.Gui.ViewModels.Messages; using MaterialDesignThemes.Wpf; using Stylet;