From 2cc8359c160b5d99726aeb534142fa2ec018f4eb Mon Sep 17 00:00:00 2001 From: lay295 Date: Sat, 19 Oct 2019 13:47:21 -0400 Subject: [PATCH] Change emote key to string to support new modified emotes --- TwitchDownloaderWPF/PageChatRender.xaml.cs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/TwitchDownloaderWPF/PageChatRender.xaml.cs b/TwitchDownloaderWPF/PageChatRender.xaml.cs index 779f6980..22619a99 100644 --- a/TwitchDownloaderWPF/PageChatRender.xaml.cs +++ b/TwitchDownloaderWPF/PageChatRender.xaml.cs @@ -94,7 +94,7 @@ private void BackgroundRenderManager_DoWork(object sender, DoWorkEventArgs e) BlockingCollection finalComments = new BlockingCollection(); List thirdPartyEmotes = new List(); List chatBadges = new List(); - Dictionary chatEmotes = new Dictionary(); + Dictionary chatEmotes = new Dictionary(); Dictionary emojiCache = new Dictionary(); Random rand = new Random(); string[] defaultColors = { "#FF0000", "#0000FF", "#00FF00", "#B22222", "#FF7F50", "#9ACD32", "#FF4500", "#2E8B57", "#DAA520", "#D2691E", "#5F9EA0", "#1E90FF", "#FF69B4", "#8A2BE2", "#00FF7F" }; @@ -298,7 +298,7 @@ private void RenderVideo(RenderOptions renderOptions, List finalC } } - private SKBitmap DrawMessage(SKBitmap sectionImage, List imageList, RenderOptions renderOptions, List currentGifEmotes, SKPaint messageFont, Dictionary emojiCache, Dictionary chatEmotes, List thirdPartyEmotes, Comment comment, Size canvasSize, ref Point drawPos, string emojiRegex, ref int default_x) + private SKBitmap DrawMessage(SKBitmap sectionImage, List imageList, RenderOptions renderOptions, List currentGifEmotes, SKPaint messageFont, Dictionary emojiCache, Dictionary chatEmotes, List thirdPartyEmotes, Comment comment, Size canvasSize, ref Point drawPos, string emojiRegex, ref int default_x) { bool hasEmote = false; foreach (var fragment in comment.message.fragments) @@ -422,7 +422,7 @@ private SKBitmap DrawMessage(SKBitmap sectionImage, List imageList, Re else { //Is a first party emote - int emoteId = Int32.Parse(new String(fragment.emoticon.emoticon_id.Where(Char.IsDigit).ToArray())); + string emoteId = fragment.emoticon.emoticon_id; if (chatEmotes.ContainsKey(emoteId)) { SKBitmap emoteImage = chatEmotes[emoteId]; @@ -828,10 +828,10 @@ private void GetTwitterEmojis(Dictionary emojiCache, List chatEmotes, List comments, RenderOptions renderOptions) + private void GetEmotes(Dictionary chatEmotes, List comments, RenderOptions renderOptions) { - List alreadyAdded = new List(); - List failedEmotes = new List(); + List alreadyAdded = new List(); + List failedEmotes = new List(); using (WebClient client = new WebClient()) { foreach (var comment in comments) @@ -840,7 +840,7 @@ private void GetEmotes(Dictionary chatEmotes, List comme { if (fragment.emoticon != null) { - int id = Int32.Parse(new String(fragment.emoticon.emoticon_id.Where(Char.IsDigit).ToArray())); + string id = fragment.emoticon.emoticon_id; if (!alreadyAdded.Contains(id) && !failedEmotes.Contains(id)) { try