From 3b9116dfcee97d17bb69d728cef73677f8d80a4e Mon Sep 17 00:00:00 2001 From: ScrubN <72096833+ScrubN@users.noreply.github.com> Date: Thu, 1 Aug 2024 14:35:11 -0400 Subject: [PATCH] Use EnumerationOptions instead of regex matching --- TwitchDownloaderCore/TwitchHelper.cs | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/TwitchDownloaderCore/TwitchHelper.cs b/TwitchDownloaderCore/TwitchHelper.cs index 5307dc77..af52fee6 100644 --- a/TwitchDownloaderCore/TwitchHelper.cs +++ b/TwitchDownloaderCore/TwitchHelper.cs @@ -680,13 +680,11 @@ public static async Task> GetEmojis(string cacheFol return returnCache; var emojiFolder = Path.Combine(cacheFolder, "emojis", emojiVendor.EmojiFolder()); - var emojiExtensions = new Regex(@"\.(?:png|PNG)$", RegexOptions.RightToLeft); // Extensions are case sensitive on Linux and Mac - if (!Directory.Exists(emojiFolder)) CreateDirectory(emojiFolder); - var emojiFiles = Directory.GetFiles(emojiFolder) - .Where(i => emojiExtensions.IsMatch(i)).ToArray(); + var enumerationOptions = new EnumerationOptions { MatchType = MatchType.Simple, MatchCasing = MatchCasing.CaseInsensitive }; + var emojiFiles = Directory.GetFiles(emojiFolder, "*.png", enumerationOptions); if (emojiFiles.Length < emojiVendor.EmojiCount()) { @@ -719,8 +717,7 @@ public static async Task> GetEmojis(string cacheFol } } - emojiFiles = Directory.GetFiles(emojiFolder) - .Where(i => emojiExtensions.IsMatch(i)).ToArray(); + emojiFiles = Directory.GetFiles(emojiFolder, "*.png", enumerationOptions); } finally {