protected override async Task PerformReplacements(JObject jobj, UserViewModel user, IEnumerable <string> arguments, Dictionary <string, string> extraSpecialIdentifiers, StreamingPlatformTypeEnum platform)
        {
            StringBuilder htmlBuilder = new StringBuilder();

            htmlBuilder.AppendLine(SectionSeparatorHTML);
            htmlBuilder.AppendLine(await this.ReplaceStringWithSpecialModifiers(this.TitleTemplate, ChannelSession.GetCurrentUser(), new List <string>(), new Dictionary <string, string>(), platform));

            foreach (var kvp in this.SectionTemplates)
            {
                if (kvp.Key == OverlayEndCreditsSectionTypeEnum.FreeFormHTML || kvp.Key == OverlayEndCreditsSectionTypeEnum.FreeFormHTML2 ||
                    kvp.Key == OverlayEndCreditsSectionTypeEnum.FreeFormHTML3)
                {
                    OverlayEndCreditsSectionModel sectionTemplate = this.SectionTemplates[kvp.Key];

                    string sectionHTML = this.PerformTemplateReplacements(sectionTemplate.SectionHTML, new Dictionary <string, string>());
                    sectionHTML = await this.ReplaceStringWithSpecialModifiers(sectionHTML, ChannelSession.GetCurrentUser(), new List <string>(), new Dictionary <string, string>(), platform);

                    string userHTML = this.PerformTemplateReplacements(sectionTemplate.UserHTML, new Dictionary <string, string>());
                    userHTML = await this.ReplaceStringWithSpecialModifiers(userHTML, user, new List <string>(), new Dictionary <string, string>(), platform);

                    htmlBuilder.AppendLine(SectionSeparatorHTML);
                    htmlBuilder.AppendLine(sectionHTML);
                    htmlBuilder.AppendLine(userHTML);
                }
                else
                {
                    Dictionary <UserViewModel, string> items = new Dictionary <UserViewModel, string>();
                    switch (kvp.Key)
                    {
                    case OverlayEndCreditsSectionTypeEnum.Chatters: items = this.GetUsersDictionary(this.viewers); break;

                    case OverlayEndCreditsSectionTypeEnum.Subscribers: items = this.GetUsersDictionary(this.subs); break;

                    case OverlayEndCreditsSectionTypeEnum.Moderators: items = this.GetUsersDictionary(this.mods); break;

                    case OverlayEndCreditsSectionTypeEnum.Followers: items = this.GetUsersDictionary(this.follows); break;

                    case OverlayEndCreditsSectionTypeEnum.Hosts: items = this.GetUsersDictionary(this.hosts); break;

                    case OverlayEndCreditsSectionTypeEnum.Raids: items = this.GetUsersDictionary(this.raids); break;

                    case OverlayEndCreditsSectionTypeEnum.NewSubscribers: items = this.GetUsersDictionary(this.newSubs); break;

                    case OverlayEndCreditsSectionTypeEnum.Resubscribers: items = this.GetUsersDictionary(this.resubs); break;

                    case OverlayEndCreditsSectionTypeEnum.GiftedSubs: items = this.GetUsersDictionary(this.giftedSubs); break;

                    case OverlayEndCreditsSectionTypeEnum.Donations: items = this.GetUsersDictionary(this.donations); break;

                    case OverlayEndCreditsSectionTypeEnum.Bits: items = this.GetUsersDictionary(this.bits); break;
                    }
                    await this.PerformSectionTemplateReplacement(htmlBuilder, kvp.Key, items, platform);
                }
            }

            jobj["HTML"] = string.Format(CreditsWrapperHTML, this.BackgroundColor, htmlBuilder.ToString());
        }
        private async Task PerformSectionTemplateReplacement(StringBuilder htmlBuilder, OverlayEndCreditsSectionTypeEnum itemType, Dictionary <UserViewModel, string> replacers, StreamingPlatformTypeEnum platform)
        {
            if (this.SectionTemplates.ContainsKey(itemType) && replacers.Count > 0)
            {
                OverlayEndCreditsSectionModel sectionTemplate = this.SectionTemplates[itemType];

                string sectionHTML = this.PerformTemplateReplacements(sectionTemplate.SectionHTML, new Dictionary <string, string>()
                {
                    { "NAME", EnumHelper.GetEnumName(itemType) },
                    { "TEXT_FONT", this.SectionTextFont },
                    { "TEXT_SIZE", this.SectionTextSize.ToString() },
                    { "TEXT_COLOR", this.SectionTextColor }
                });
                sectionHTML = await this.ReplaceStringWithSpecialModifiers(sectionHTML, ChannelSession.GetCurrentUser(), new List <string>(), new Dictionary <string, string>(), platform);

                List <string> userHTMLs = new List <string>();
                foreach (var kvp in replacers.OrderBy(kvp => kvp.Key.Username))
                {
                    if (!string.IsNullOrEmpty(kvp.Key.Username))
                    {
                        string userHTML = this.PerformTemplateReplacements(sectionTemplate.UserHTML, new Dictionary <string, string>()
                        {
                            { "NAME", kvp.Key.Username },
                            { "DETAILS", kvp.Value },
                            { "TEXT_FONT", this.ItemTextFont },
                            { "TEXT_SIZE", this.ItemTextSize.ToString() },
                            { "TEXT_COLOR", this.ItemTextColor }
                        });
                        userHTML = await this.ReplaceStringWithSpecialModifiers(userHTML, kvp.Key, new List <string>(), new Dictionary <string, string>(), platform);

                        userHTMLs.Add(userHTML);
                    }
                }

                htmlBuilder.AppendLine(SectionSeparatorHTML);
                htmlBuilder.AppendLine(sectionHTML);
                foreach (string userHTML in userHTMLs)
                {
                    htmlBuilder.AppendLine(userHTML);
                }
            }
        }