From 0a85a617400d2bcd3a06172cacfd9b9022ee26c5 Mon Sep 17 00:00:00 2001 From: ScrubN <72096833+ScrubN@users.noreply.github.com> Date: Sun, 12 Nov 2023 03:18:01 -0500 Subject: [PATCH] Rename TimeSpanExtensions to UrlTimeCode --- TwitchDownloaderCore/Chat/ChatJson.cs | 2 +- .../TimeSpanExtensions.cs => Tools/UrlTimeCode.cs} | 6 +++--- TwitchDownloaderWPF/PageChatDownload.xaml.cs | 2 +- TwitchDownloaderWPF/PageVodDownload.xaml.cs | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) rename TwitchDownloaderCore/{Extensions/TimeSpanExtensions.cs => Tools/UrlTimeCode.cs} (91%) diff --git a/TwitchDownloaderCore/Chat/ChatJson.cs b/TwitchDownloaderCore/Chat/ChatJson.cs index b156a184..bdfe1bc4 100644 --- a/TwitchDownloaderCore/Chat/ChatJson.cs +++ b/TwitchDownloaderCore/Chat/ChatJson.cs @@ -207,7 +207,7 @@ private static async Task UpgradeChatJson(ChatRoot chatRoot) if (chatRoot.video.duration is not null) { - chatRoot.video.length = TimeSpanExtensions.ParseTimeCode(chatRoot.video.duration).TotalSeconds; + chatRoot.video.length = UrlTimeCode.Parse(chatRoot.video.duration).TotalSeconds; chatRoot.video.end = chatRoot.video.length; chatRoot.video.duration = null; } diff --git a/TwitchDownloaderCore/Extensions/TimeSpanExtensions.cs b/TwitchDownloaderCore/Tools/UrlTimeCode.cs similarity index 91% rename from TwitchDownloaderCore/Extensions/TimeSpanExtensions.cs rename to TwitchDownloaderCore/Tools/UrlTimeCode.cs index 508ff4d0..57498951 100644 --- a/TwitchDownloaderCore/Extensions/TimeSpanExtensions.cs +++ b/TwitchDownloaderCore/Tools/UrlTimeCode.cs @@ -1,15 +1,15 @@ using System; -namespace TwitchDownloaderCore.Extensions +namespace TwitchDownloaderCore.Tools { - public static class TimeSpanExtensions + public static class UrlTimeCode { /// /// Converts the span representation of a time interval in the format of '2d21h11m9s' to its equivalent. /// /// A span containing the characters that represent the time interval to convert. /// The equivalent to the time interval contained in the span. - public static TimeSpan ParseTimeCode(ReadOnlySpan input) + public static TimeSpan Parse(ReadOnlySpan input) { var dayIndex = input.IndexOf('d'); var hourIndex = input.IndexOf('h'); diff --git a/TwitchDownloaderWPF/PageChatDownload.xaml.cs b/TwitchDownloaderWPF/PageChatDownload.xaml.cs index 08fa9ac7..4ed52a29 100644 --- a/TwitchDownloaderWPF/PageChatDownload.xaml.cs +++ b/TwitchDownloaderWPF/PageChatDownload.xaml.cs @@ -137,7 +137,7 @@ private async Task GetVideoInfo() var urlTimeCodeMatch = TwitchRegex.UrlTimeCode.Match(textUrl.Text); if (urlTimeCodeMatch.Success) { - var time = TimeSpanExtensions.ParseTimeCode(urlTimeCodeMatch.ValueSpan); + var time = UrlTimeCode.Parse(urlTimeCodeMatch.ValueSpan); checkCropStart.IsChecked = true; numStartHour.Value = time.Hours; numStartMinute.Value = time.Minutes; diff --git a/TwitchDownloaderWPF/PageVodDownload.xaml.cs b/TwitchDownloaderWPF/PageVodDownload.xaml.cs index 01cd107a..98717176 100644 --- a/TwitchDownloaderWPF/PageVodDownload.xaml.cs +++ b/TwitchDownloaderWPF/PageVodDownload.xaml.cs @@ -146,7 +146,7 @@ private async Task GetVideoInfo() var urlTimeCodeMatch = TwitchRegex.UrlTimeCode.Match(textUrl.Text); if (urlTimeCodeMatch.Success) { - var time = TimeSpanExtensions.ParseTimeCode(urlTimeCodeMatch.ValueSpan); + var time = UrlTimeCode.Parse(urlTimeCodeMatch.ValueSpan); checkStart.IsChecked = true; numStartHour.Value = time.Hours; numStartMinute.Value = time.Minutes;