private TwitchBitsCheerViewModel GetBitCheermote(string part) { foreach (TwitchBitsCheermoteViewModel cheermote in ChannelSession.Services.Chat.TwitchChatService.BitsCheermotes) { if (part.StartsWith(cheermote.ID, StringComparison.InvariantCultureIgnoreCase) && int.TryParse(part.ToLower().Replace(cheermote.ID.ToLower(), ""), out int amount) && amount > 0) { TwitchBitsCheermoteTierViewModel tier = cheermote.GetAppropriateTier(amount); if (tier != null) { return(new TwitchBitsCheerViewModel(part, amount, tier)); } } } return(null); }
private void ProcessMessageContents(string message) { if (!string.IsNullOrEmpty(message)) { string[] parts = message.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries); foreach (string part in parts) { this.AddStringMessagePart(part); if (ChannelSession.Services.Chat.TwitchChatService != null) { if (this.HasBits) { foreach (TwitchBitsCheermoteViewModel cheermote in ChannelSession.Services.Chat.TwitchChatService.BitsCheermotes) { if (part.StartsWith(cheermote.ID) && int.TryParse(part.Replace(cheermote.ID, ""), out int amount) && amount > 0) { TwitchBitsCheermoteTierViewModel tier = cheermote.GetAppropriateTier(amount); if (tier != null) { this.MessageParts[this.MessageParts.Count - 1] = new TwitchBitsCheerViewModel(part, amount, tier); continue; } } } } if (ChannelSession.Services.Chat.TwitchChatService.Emotes.ContainsKey(part)) { this.MessageParts[this.MessageParts.Count - 1] = ChannelSession.Services.Chat.TwitchChatService.Emotes[part]; } else if (messageEmotesCache.ContainsKey(part)) { this.MessageParts[this.MessageParts.Count - 1] = messageEmotesCache[part]; } else if (ChannelSession.Settings.ShowBetterTTVEmotes && ChannelSession.Services.Chat.TwitchChatService.BetterTTVEmotes.ContainsKey(part)) { this.MessageParts[this.MessageParts.Count - 1] = ChannelSession.Services.Chat.TwitchChatService.BetterTTVEmotes[part]; } else if (ChannelSession.Settings.ShowFrankerFaceZEmotes && ChannelSession.Services.Chat.TwitchChatService.FrankerFaceZEmotes.ContainsKey(part)) { this.MessageParts[this.MessageParts.Count - 1] = ChannelSession.Services.Chat.TwitchChatService.FrankerFaceZEmotes[part]; } } } } }
public TwitchBitsCheerViewModel(string text, int amount, TwitchBitsCheermoteTierViewModel tier) { this.Text = text; this.Amount = amount; this.Tier = tier; }