Skip to content

Commit

Permalink
Fix some emoji flags rendering as the wales flag, double emoji render…
Browse files Browse the repository at this point in the history
… speed
  • Loading branch information
ScrubN committed Mar 7, 2023
1 parent 69f1e52 commit 83680e4
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions TwitchDownloaderCore/ChatRenderer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -785,13 +785,15 @@ private void DrawEmojiMessage(List<SKBitmap> sectionImages, List<(Point, TwitchE
StringBuilder nonEmojiBuffer = new();
while (enumerator.MoveNext())
{
// Old LINQ method. Leaving this for reference
//List<SingleEmoji> emojiMatches = Emoji.All.Where(x => fragmentString.StartsWith(x.ToString()) && fragmentString.Contains(x.Sequence.AsString.Trim('\uFE0F'))).ToList();

List<SingleEmoji> emojiMatches = new List<SingleEmoji>();
foreach (var emoji in Emoji.All)
foreach (var emoji in Emoji.All.AsParallel().Where(emoji => ((string)enumerator.Current).StartsWith(emoji.Sequence.AsString)))
{
if (((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))
{
emojiMatches.Add(emoji);
}
Expand Down

0 comments on commit 83680e4

Please sign in to comment.