diff --git a/TwitchDownloaderCore/ChatRenderer.cs b/TwitchDownloaderCore/ChatRenderer.cs index b15ba349..17f92f42 100644 --- a/TwitchDownloaderCore/ChatRenderer.cs +++ b/TwitchDownloaderCore/ChatRenderer.cs @@ -786,18 +786,20 @@ private void DrawEmojiMessage(List sectionImages, List<(Point, TwitchE while (enumerator.MoveNext()) { List emojiMatches = new List(); - foreach (var emoji in Emoji.All.AsParallel().Where(emoji => ((string)enumerator.Current).StartsWith(emoji.Sequence.AsString))) - { - if (emoji.Group != "Flags") - { - emojiMatches.Add(emoji); - continue; - } - if (((string)enumerator.Current).StartsWith(emoji.Sequence.AsString, StringComparison.Ordinal)) + Emoji.All.AsParallel() + .Where(emoji => enumerator.GetTextElement().StartsWith(emoji.Sequence.AsString)) + .ForAll(emoji => { - emojiMatches.Add(emoji); - } - } + if (emoji.Group != "Flags") + { + emojiMatches.Add(emoji); + return; + } + if (enumerator.GetTextElement().StartsWith(emoji.Sequence.AsString, StringComparison.Ordinal)) + { + emojiMatches.Add(emoji); + } + }); // Make sure the found emojis actually exist in our cache int emojiMatchesCount = emojiMatches.Count; @@ -842,7 +844,7 @@ private void DrawEmojiMessage(List sectionImages, List<(Point, TwitchE } else { - nonEmojiBuffer.Append((string)enumerator.Current); + nonEmojiBuffer.Append(enumerator.GetTextElement()); } } if (nonEmojiBuffer.Length > 0)