Ejemplo n.º 1
0
        protected override async Task ProcessReceivedPacket(string packetJSON)
        {
            if (!string.IsNullOrEmpty(packetJSON))
            {
                GawkBoxAlert alert = JsonConvert.DeserializeObject <GawkBoxAlert>(packetJSON);
                if (alert != null && alert.Gifts.Count > 0)
                {
                    UserDonationModel donation = alert.ToGenericDonation();
                    GlobalEvents.DonationOccurred(donation);

                    UserViewModel user = new UserViewModel(0, donation.UserName);

                    UserModel userModel = await ChannelSession.Connection.GetUser(user.UserName);

                    if (userModel != null)
                    {
                        user = new UserViewModel(userModel);
                    }

                    EventCommand command = ChannelSession.Constellation.FindMatchingEventCommand(EnumHelper.GetEnumName(OtherEventTypeEnum.GawkBoxDonation));
                    if (command != null)
                    {
                        command.AddSpecialIdentifier("donationsource", EnumHelper.GetEnumName(donation.Source));
                        command.AddSpecialIdentifier("donationamount", donation.AmountText);
                        command.AddSpecialIdentifier("donationmessage", donation.Message);
                        command.AddSpecialIdentifier("donationimage", donation.ImageLink);
                        await command.Perform(user);
                    }
                }
            }
        }
Ejemplo n.º 2
0
 protected override async Task ProcessReceivedPacket(string packetJSON)
 {
     if (!string.IsNullOrEmpty(packetJSON))
     {
         GawkBoxAlert alert = JsonConvert.DeserializeObject <GawkBoxAlert>(packetJSON);
         if (alert != null && alert.Gifts.Count > 0)
         {
             UserDonationModel donation = alert.ToGenericDonation();
             await EventCommand.ProcessDonationEventCommand(donation, OtherEventTypeEnum.GawkBoxDonation);
         }
     }
 }