From 68eb301e97f0f5c1e5433023244c3f977ab9f8be Mon Sep 17 00:00:00 2001 From: ScrubN <72096833+ScrubN@users.noreply.github.com> Date: Tue, 19 Dec 2023 01:54:23 -0500 Subject: [PATCH] SortedCommentComparer -> CommentOffsetComparer and fix a temporary variable name that snuck in --- TwitchDownloaderCore/ChatDownloader.cs | 2 +- TwitchDownloaderCore/ChatUpdater.cs | 2 +- .../Tools/{CommentTools.cs => CommentOffsetComparer.cs} | 2 +- TwitchDownloaderCore/Tools/TimeSpanHFormat.cs | 6 +++--- 4 files changed, 6 insertions(+), 6 deletions(-) rename TwitchDownloaderCore/Tools/{CommentTools.cs => CommentOffsetComparer.cs} (95%) diff --git a/TwitchDownloaderCore/ChatDownloader.cs b/TwitchDownloaderCore/ChatDownloader.cs index f2e5440a..d74df7b8 100644 --- a/TwitchDownloaderCore/ChatDownloader.cs +++ b/TwitchDownloaderCore/ChatDownloader.cs @@ -410,7 +410,7 @@ public async Task DownloadAsync(IProgress progress, Cancellation sortedComments.AddRange(commentTask.Result); } - sortedComments.Sort(new SortedCommentComparer()); + sortedComments.Sort(new CommentOffsetComparer()); chatRoot.comments = sortedComments.DistinctBy(x => x._id).ToList(); diff --git a/TwitchDownloaderCore/ChatUpdater.cs b/TwitchDownloaderCore/ChatUpdater.cs index faceb073..3e88316c 100644 --- a/TwitchDownloaderCore/ChatUpdater.cs +++ b/TwitchDownloaderCore/ChatUpdater.cs @@ -401,7 +401,7 @@ private async Task ChatEndingCropTask(IProgress progress, Cancel ChatRoot newChatRoot = await ChatJson.DeserializeAsync(inputFile, getComments: true, onlyFirstAndLastComments: false, getEmbeds: false, cancellationToken); // Append the new comment section - SortedSet commentsSet = new SortedSet(new SortedCommentComparer()); + SortedSet commentsSet = new SortedSet(new CommentOffsetComparer()); foreach (var comment in newChatRoot.comments) { if (comment.content_offset_seconds < downloadOptions.CropEndingTime && comment.content_offset_seconds >= downloadOptions.CropBeginningTime) diff --git a/TwitchDownloaderCore/Tools/CommentTools.cs b/TwitchDownloaderCore/Tools/CommentOffsetComparer.cs similarity index 95% rename from TwitchDownloaderCore/Tools/CommentTools.cs rename to TwitchDownloaderCore/Tools/CommentOffsetComparer.cs index 56d8e41f..be937837 100644 --- a/TwitchDownloaderCore/Tools/CommentTools.cs +++ b/TwitchDownloaderCore/Tools/CommentOffsetComparer.cs @@ -3,7 +3,7 @@ namespace TwitchDownloaderCore.Tools { - internal class SortedCommentComparer : IComparer + internal class CommentOffsetComparer : IComparer { // Modified from double.CompareTo // ReSharper disable once CompareOfFloatsByEqualityOperator diff --git a/TwitchDownloaderCore/Tools/TimeSpanHFormat.cs b/TwitchDownloaderCore/Tools/TimeSpanHFormat.cs index 6339d509..3e711b81 100644 --- a/TwitchDownloaderCore/Tools/TimeSpanHFormat.cs +++ b/TwitchDownloaderCore/Tools/TimeSpanHFormat.cs @@ -184,9 +184,9 @@ private static void AppendBigHFormat(StringBuilder sb, TimeSpan timeSpan, int co } else { - var foo = ((uint)timeSpan.TotalHours).ToString(); - sb.Append('0', Math.Max(0, count - foo.Length)); - sb.Append(foo); + var hourString = ((uint)timeSpan.TotalHours).ToString(); + sb.Append('0', Math.Max(0, count - hourString.Length)); + sb.Append(hourString); } }