示例#1
0
 private void B_ReceivedDanmaku(object sender, ReceivedDanmakuArgs e)
 {
     if (e.Danmaku.UserID != 0)
     {
         e.Danmaku.UserName += string.Format(" ({0})", e.Danmaku.UserID);
     }
 }
示例#2
0
 private void B_ReceivedDanmaku(object sender, ReceivedDanmakuArgs e)
 {
     if (e.Danmaku.MsgType == MsgTypeEnum.LiveStart)
     {
         AddDM("黑猫老爷的直播间5051打开了!");
     }
 }
示例#3
0
 private void Main_ReceivedDanmaku(object sender, ReceivedDanmakuArgs e)
 {
     if (e.Danmaku.MsgType == MsgTypeEnum.Comment)
     {
         w.AddDM(e.Danmaku);
     }
 }
 private void B_ReceivedDanmaku(object sender, ReceivedDanmakuArgs e)
 {
     try
     {
         if (e.Danmaku.MsgType == MsgTypeEnum.Comment)
         {
             foreach (var i in System.Net.NetworkInformation.NetworkInterface.GetAllNetworkInterfaces())
             {
                 foreach (var ua in i.GetIPProperties().UnicastAddresses)
                 {
                     UdpClient  client = new UdpClient();
                     IPEndPoint ip     = new IPEndPoint(ua.Address.GetBroadcastAddress(ua.IPv4Mask), 45695);
                     var        obj    =
                         JObject.FromObject(new { User = e.Danmaku.CommentUser + "", Comment = e.Danmaku.CommentText + "" });
                     byte[] sendbuf = Encoding.UTF8.GetBytes(obj.ToString());
                     client.Send(sendbuf, sendbuf.Length, ip);
                     client.Close();
                 }
             }
         }
     }
     catch (Exception)
     {
     }
 }
示例#5
0
        private static void Sm_ReceivedDanmaku(object sender, ReceivedDanmakuArgs e)
        {
            switch (e.Danmaku.MsgType)
            {
            //case MsgTypeEnum.SuperChat:
            //    pman.TriggerSuperchat(e.Danmaku.RawData);
            //    break;
            case MsgTypeEnum.Comment:
                pman.TriggerDanmaku(e.Danmaku.RawData);
                break;

            case MsgTypeEnum.GuardBuy:
            case MsgTypeEnum.GiftSend:
                pman.TriggerGift(e.Danmaku.RawData);
                break;

            case MsgTypeEnum.WelcomeGuard:
            case MsgTypeEnum.Welcome:
                pman.TriggerEnter(e.Danmaku.RawData);
                break;

            case MsgTypeEnum.LiveEnd:
            case MsgTypeEnum.LiveStart:
                pman.TriggerStreamStartEnd(e.Danmaku.RawData);
                break;

            default:
                pman.TriggerOther(e.Danmaku.RawData);
                break;
            }
        }
示例#6
0
        private void B_ReceivedDanmaku(object sender, ReceivedDanmakuArgs e)
        {
            try
            {
                if (e.Danmaku.MsgType == MsgTypeEnum.Comment)
                {
                    foreach (var i in System.Net.NetworkInformation.NetworkInterface.GetAllNetworkInterfaces())
                        foreach (var ua in i.GetIPProperties().UnicastAddresses)
                        {

                    UdpClient client = new UdpClient();
                    IPEndPoint ip = new IPEndPoint(ua.Address.GetBroadcastAddress(ua.IPv4Mask), 45695);
                    var obj =
                        JObject.FromObject(new {User = e.Danmaku.CommentUser + "", Comment = e.Danmaku.CommentText + ""});
                    byte[] sendbuf = Encoding.UTF8.GetBytes(obj.ToString());
                    client.Send(sendbuf, sendbuf.Length, ip);
                    client.Close();
                }

            }
            }
            catch (Exception)
            {

            }
        }
示例#7
0
        public async Task GiftRoute(object sender, ReceivedDanmakuArgs e)
        {
            // check user eligibility
            if (!Conf.CheckUserEligibility(e))
            {
                return;
            }
            // check gift eligibility
            if (!Conf.CheckGiftEligibility(e))
            {
                return;
            }
            Bridge.ALog("规则检查通过,准备朗读");
            if (Vars.CurrentConf.VoiceReplyFirst)
            {
                var hitAnyRule = await TTSPlayer.PlayVoiceReply(e.Danmaku);

                if (!hitAnyRule || !Vars.CurrentConf.IgnoreIfHitVoiceReply)
                {
                    await TTSPlayer.UnifiedPlay(ProcessGift(e));
                }
            }
            else
            {
                var hitAnyRule = Vars.CurrentConf.VoiceReplyRules.Any(x => x.Matches(e.Danmaku));
                if (!hitAnyRule || !Vars.CurrentConf.IgnoreIfHitVoiceReply)
                {
                    await TTSPlayer.UnifiedPlay(ProcessGift(e));
                }
                await TTSPlayer.PlayVoiceReply(e.Danmaku);
            }
        }
示例#8
0
        private void b_ReceivedDanmaku(object sender, ReceivedDanmakuArgs e)
        {
            foreach (var dmPlugin in Plugins)
            {
                if (dmPlugin.Status)
                {
                    new Thread(() =>
                    {
                        try
                        {
                            dmPlugin.MainReceivedDanMaku(e);
                        }
                        catch (Exception ex)
                        {
                            Utils.PluginExceptionHandler(ex, dmPlugin);
                        }
                    }).Start();
                }
            }

            if (e.Danmaku.MsgType == MsgTypeEnum.Comment)
            {
                lock (Static)
                {
                    Static.DanmakuCountRaw += 1;
                }
            }

            lock (_danmakuQueue)
            {
                var danmakuModel = e.Danmaku;
                _danmakuQueue.Enqueue(danmakuModel);
            }
        }
 private void B_ReceivedDanmaku(object sender, ReceivedDanmakuArgs e)
 {
     //logging("received: " + e.Danmaku.);
     ProcDanmaku(e.Danmaku);
     if (e.Danmaku.MsgType == MsgTypeEnum.Comment)
     {
         foreach (var cmd in this.lstCommands)
         {
             if (cmd.Keys.Any(_ => _ == e.Danmaku.CommentText))
             {
                 this.ExecuteCommand(cmd.Command);
                 if (cmd.RevertDelay > 0)
                 {
                     System.Threading.Timer timer = null;
                     timer = new System.Threading.Timer(
                         _ =>
                     {
                         this.Invoke((Action)(() => this.ExecuteCommand(cmd.RevertCommand)));
                         Console.WriteLine("time out");
                         timer.Dispose();
                     },
                         null,
                         cmd.RevertDelay * 1000,
                         int.MaxValue);
                 }
                 break;
             }
         }
     }
 }
示例#10
0
 private void B_ReceivedDanmaku(object sender, ReceivedDanmakuArgs e)
 {
     if (e.Danmaku.MsgType == MsgTypeEnum.LiveStart)
     {
         AddDM("黑猫老爷的直播间5051打开了!");
     }
 }
示例#11
0
        private void b_ReceivedDanmaku(object sender, ReceivedDanmakuArgs e)
        {
            switch (e.Danmaku.MsgType)
            {
            case MsgTypeEnum.Comment:
            {
                OnComment(e);
                break;
            }

            case MsgTypeEnum.GiftTop:
                break;

            case MsgTypeEnum.GiftSend:
            {
                OnGiftSend(e);
                break;
            }

            case MsgTypeEnum.Welcome:
            {
                break;
            }
            }
        }
示例#12
0
        private void DanMuJieMain_ReceivedDanmaku(object sender, ReceivedDanmakuArgs e)
        {
            string commentText = e.Danmaku.CommentText;

            this.AddDM(commentText);
            if (!commentText.Trim().StartsWith("dmj"))
            {
                return;
            }
            this.AddDM(commentText);
            string[] apiAndSongInfo = commentText.Trim().Split(new char[] { '-' });
            if (apiAndSongInfo != null && apiAndSongInfo.Length >= 3)
            {
                ServerProvider api = SelectServerProvider(apiAndSongInfo[1]);
                this.Api.Server = api;
                try
                {
                    var songs = Api.SearchObj(apiAndSongInfo[2]);

                    if (songs != null && songs.Length >= 1)
                    {
                        _window.ReLoadSearchResult(songs);

                        var song = songs.FirstOrDefault();

                        try
                        {
                            _window.ShowMessage("正在播放: " + song.name + " - " + string.Join(",", song.artist));
                        }
                        catch (Exception ex)
                        { }

                        this.AddDM("开始播放: " + song.name);

                        try
                        {
                            PlayMusicHelper.AddPlayList(GetPlayUrlById(song.url_id));
                        }
                        catch (Exception ex)
                        {
                            throw;
                        }
                    }
                    else
                    {
                        try
                        {
                            _window.ShowMessage("无搜索结果: " + apiAndSongInfo[2]);
                        }
                        catch (Exception ex)
                        { }
                    }
                }
                catch (Exception ex)
                {
                    this.AddDM("错误: " + ex.Message);
                }
            }
        }
示例#13
0
 public static string ProcessSuperChat(ReceivedDanmakuArgs e)
 {
     var rawDanmaku = Preprocess(Vars.CurrentConf.OnSuperChat, e);
     return rawDanmaku
         .Replace("$PRICE", e.Danmaku.Price.ToString())
         .Replace("$USER", e.Danmaku.UserName)
         .Replace("$DM", e.Danmaku.CommentText);
 }
示例#14
0
 public static bool CheckKeywordEligibility(ReceivedDanmakuArgs e)
 {
     if (!CheckKeywordEligibility(e.Danmaku.CommentText))
     {
         Bridge.ALog("忽略:弹幕已命中屏蔽规则");
         return(false);
     }
     return(true);
 }
示例#15
0
 public static bool CheckGiftEligibility(ReceivedDanmakuArgs e)
 {
     if (!CheckGiftEligibility(e.Danmaku.GiftName))
     {
         Bridge.ALog("忽略:礼物已命中屏蔽规则");
         return(false);
     }
     return(true);
 }
示例#16
0
 private void B_ReceivedDanmaku(object sender, ReceivedDanmakuArgs e)
 {
     if (e.Danmaku.MsgType == MsgTypeEnum.GiftSend)
     {
         string rawData  = e.Danmaku.RawData;
         bool   isBag    = (rawData.Contains("\"gold\":0,") && rawData.Contains("\"silver\":0,")) || !rawData.Contains("\"remain\":0,");
         bool   isSilver = rawData.Contains("\"giftId\":1,");
         e.Danmaku.GiftName += string.Format("({0})", isBag ? "包" : isSilver ? "银" : "金");
     }
 }
示例#17
0
        public void OnReceive(object sender, ReceivedDanmakuArgs e)
        {
            //string nowtime = (DateTime.Now - startTime).ToString(@"hh\:mm\:ss");
            string nowtime = DateTime.Now.ToString();
            string a       = e.Danmaku.CommentText;
            string b       = e.Danmaku.UserName;

            if (a == null || a == "")
            {
                return;
            }
            if (check1.Checked && a[0] == '【' && a[a.Length - 1] == '】')
            {
                this.Invoke(new Action(() =>
                {
                    Console.WriteLine("in" + a);
                    this.AddLog(nowtime.ToString() + a + Environment.NewLine);
                    this.LogBox.Refresh();
                })
                            );
                return;
            }
            if (checkBox1.Checked)
            {
                bool flag = false;
                for (int i = 0; i < TargetList.Items.Count; i++)
                {
                    if (a.Contains(TargetList.Items[i].Text))
                    {
                        flag = true;
                        break;
                    }
                }
                if (flag == true)
                {
                    this.Invoke(new Action(() =>
                    {
                        this.AddLog(nowtime.ToString() + a + "|" + b + "|" + Environment.NewLine);
                        //this.LogBox.Text += nowtime.ToString() + a + Environment.NewLine;
                        this.LogBox.Refresh();
                    })
                                );
                }
            }
            if (textFilter.Check(b))
            {
                this.Invoke(new Action(() =>
                {
                    this.AddLog(nowtime.ToString() + a + Environment.NewLine);
                    this.LogBox.Refresh();
                })
                            );
            }
            return;
        }
示例#18
0
 private void OnReceivedDanmaku(object sender, ReceivedDanmakuArgs e)
 {
     mp?.Dispatcher.BeginInvoke(DispatcherPriority.Normal, new Action(() =>
     {
         this.mp.context.DataList.Add(new DMItem()
         {
             ItemName = DateTime.Now.ToString("HH:mm:ss") + " " + e.Danmaku.RawDataJToken["cmd"],
             Model    = e.Danmaku
         });
     }));
 }
示例#19
0
 private void Dl_ReceivedDanmaku(object sender, ReceivedDanmakuArgs e)
 {
     if (e.Danmaku.MsgType == MsgTypeEnum.Comment)
     {
         base.RaiseEvent <IBaseDanmakuEvent>(new BiliBiliDanmuku(e.Danmaku));
     }
     else if (e.Danmaku.MsgType == MsgTypeEnum.GiftSend)
     {
         base.RaiseEvent <IBaseGiftEvent>(new BiliBiliGift(e.Danmaku));
     }
 }
示例#20
0
 public static async Task WelcomeRoute(object sender, ReceivedDanmakuArgs e)
 {
     // check user eligibility
     if (!Conf.CheckUserEligibility(e))
     {
         return;
     }
     Bridge.ALog("规则检查通过,准备朗读");
     await TTSPlayer.UnifiedPlay(Vars.CurrentConf.OnWelcome
                                 .Replace("$USER", e.Danmaku.UserName)
                                 , true
                                 );
 }
示例#21
0
        private async void GiftDebouncedEvent(object sender, UserGift e)
        {
            ALog($"合并礼物: 来自 {e.User} ({e.UserId}) 的 {e.Qty} 个 {e.Gift},直接路由到礼物路线...");
            var constructedArgs = new ReceivedDanmakuArgs();

            constructedArgs.Danmaku           = new DanmakuModel();
            constructedArgs.Danmaku.GiftName  = e.Gift;
            constructedArgs.Danmaku.GiftCount = e.Qty;
            constructedArgs.Danmaku.UserName  = e.User;
            constructedArgs.Danmaku.UserID    = e.UserId;
            constructedArgs.Danmaku.MsgType   = MsgTypeEnum.GiftSend;
            await GiftRoute(null, constructedArgs);
        }
示例#22
0
        private void Class1_ReceivedDanmaku(object sender, ReceivedDanmakuArgs e)
        {
            string Info;
            string Roomid = RoomId.ToString();

            switch (e.Danmaku.MsgType)
            {
            case MsgTypeEnum.LiveStart:
            {
                Log(Roomid + "已开播");
                break;
            }

            case MsgTypeEnum.LiveEnd:
            {
                Log(Roomid + "已下播");
                break;
            }

            case MsgTypeEnum.Comment:
            {
                if (Settings.DanmuLog)
                {
                    Info = "【弹幕】" + DateTime.Now.ToString("HH:mm:ss.fff") + " : " + e.Danmaku.UserName + " 说:" + e.Danmaku.CommentText;
                    Output("Log", Info, Roomid);
                }
                else
                {
                    Info = "{\"TimeStamp\":\"" + DateTime.Now.ToString("HH:mm:ss.fff") + "\", \"Uname\":\"" + e.Danmaku.UserName + "\", \"Comment\":\"" + e.Danmaku.CommentText + "\", \"Type\":\"弹幕\", \"SCTime\":0}";
                    Output("Data", Info, Roomid);
                }
                break;
            }

            case MsgTypeEnum.SuperChat:
            {
                if (Settings.DanmuLog)
                {
                    Info = "【留言】" + DateTime.Now.ToString("HH:mm:ss.fff") + " : " + e.Danmaku.UserName + " 说:" + e.Danmaku.CommentText;
                    Output("Log", Info, Roomid);
                }
                else
                {
                    Info = "{\"TimeStamp\":\"" + DateTime.Now.ToString("HH:mm:ss.fff") + "\", \"Uname\":\"" + e.Danmaku.UserName + "\", \"Comment\":\"" + e.Danmaku.CommentText + "\", \"Type\":\"留言\", \"SCTime\":" + e.Danmaku.SCKeepTime.ToString() + "}";
                    Output("Data", Info, Roomid);
                }
                break;
            }
            }
        }
示例#23
0
 public static async Task GuardBuyRoute(object sender, ReceivedDanmakuArgs e)
 {
     // check user eligibility
     if (!Conf.CheckUserEligibility(e))
     {
         return;
     }
     Bridge.ALog("规则检查通过,准备朗读");
     await TTSPlayer.UnifiedPlay(Vars.CurrentConf.OnGuardBuy
                                 .Replace("$COUNT", e.Danmaku.GiftCount.ToString())
                                 .Replace("$USER", e.Danmaku.UserName)
                                 , true
                                 );
 }
示例#24
0
 private void OnComment(ReceivedDanmakuArgs e)
 {
     if (textBox1.Dispatcher.CheckAccess())
     {
         _messageQueue.Enqueue((e.Danmaku.isAdmin ? "[管]" : "") + (e.Danmaku.isVIP ? "[爷]" : "") + e.Danmaku.CommentUser + " 说:  " + e.Danmaku.CommentText);
         textBox1.Text = string.Join("\n", _messageQueue);
         textBox1.ScrollToEnd();
     }
     else
     {
         textBox1.Dispatcher.BeginInvoke(
             DispatcherPriority.Normal,
             new Action(() => OnComment(e)));
     }
 }
示例#25
0
 private void OnReceivedDanmaku(object sender, ReceivedDanmakuArgs e)
 {
     if (e.Danmaku.MsgType == MsgTypeEnum.Comment)
     {
         var audioobj = e.Danmaku.RawDataJToken["info"][0][14];
         if (audioobj != null && audioobj["voice_url"] != null)
         {
             Application.Current.Dispatcher
             .BeginInvoke(DispatcherPriority.Normal, new Action(() =>
             {
                 Log($"语音弹幕: {e.Danmaku.UserName}: {e.Danmaku.CommentText}");
                 context.DataList.Add(new DMItem()
                 {
                     ItemName = $"{DateTime.Now:HH:mm:ss} {e.Danmaku.UserName}: {e.Danmaku.CommentText}",
                     Model    = e.Danmaku
                 });
             }));
示例#26
0
        private static void Receiver_ReceivedDanmaku(object sender, ReceivedDanmakuArgs e)
        {
            var    d    = e.Danmaku;
            string guid = "";

            switch (d.MsgType)
            {
            case MsgTypeEnum.GuardBuy:
                guid = Guid.NewGuid().ToString("N");
                db.logCREW(d.UserID, d.UserGuardLevel, d.GiftCount, TimestampHandler.GetTimeStamp(DateTime.Now), guid);
                break;

            case MsgTypeEnum.LiveEnd:
                lid = -1;
                break;
            }
            db.logDMK(TimestampHandler.GetTimeStamp16(DateTime.Now), d.RawData, lid, guid);
        }
示例#27
0
        private static void Loader_ReceivedDanmaku(object sender, ReceivedDanmakuArgs e)
        {
            _receive_DanmakuCount++;
            //FlushConsole();
            int roomId = ((DanmakuLoader)sender).RoomId;

            var jToken   = e.Danmaku.RawDataJToken;
            int msg_type = Convert.ToInt32(jToken["msg_type"]);

            if (msg_type == 2 || jToken["msg_common"].ToString().Contains("抽奖"))
            {
                int real_roomid = Convert.ToInt32(jToken["real_roomid"].ToString());

                Console.WriteLine($"---{DateTime.Now.ToString()}----{jToken["msg_common"].ToString()}-----");

                _biliClient.LotteryCheck(real_roomid);
            }
        }
示例#28
0
        public void Test_OnClick(object sender, RoutedEventArgs e)
        {
//            logging("投喂记录不会在弹幕模式上出现, 这不是bug");
            var ran = new Random();

            var n = ran.Next(100);

            if (n > 98)
            {
                AddDMText("彈幕姬報告", "這不是個測試", false);
            }
            else
            {
                AddDMText("彈幕姬報告", "這是一個測試", false);
            }
            SendSSP("彈幕姬測試");
            foreach (var dmPlugin in Plugins.Where(dmPlugin => dmPlugin.Status))
            {
                new Thread(() =>
                {
                    try
                    {
                        var m = new ReceivedDanmakuArgs
                        {
                            Danmaku =
                                new DanmakuModel
                            {
                                CommentText = "插件彈幕測試",
                                CommentUser = "******",
                                MsgType     = MsgTypeEnum.Comment
                            }
                        };
                        dmPlugin.MainReceivedDanMaku(m);
                    }
                    catch (Exception ex)
                    {
                        Utils.PluginExceptionHandler(ex, dmPlugin);
                    }
                }).Start();
            }

//            logging(DateTime.Now.Ticks+"");
        }
示例#29
0
        private void b_ReceivedDanmaku(object sender, ReceivedDanmakuArgs e)
        {
            string strSend = "";

            if (e.Danmaku.MsgType == MsgTypeEnum.Comment)
            {
                strSend = e.Danmaku.UserName + "[" + e.Danmaku.UserID + "]:" + e.Danmaku.CommentText;
                adapter.Add(strSend);
                vibrate();
                readDamaku(e.Danmaku.CommentText);
            }

            if (e.Danmaku.MsgType == MsgTypeEnum.GiftSend)
            {
                strSend = e.Danmaku.UserName + "送了" + e.Danmaku.GiftCount + "个" + e.Danmaku.GiftName;
                adapter.Add(strSend);
                readDamaku(strSend);
            }
        }
示例#30
0
 public async Task SuperChatRoute(object sender, ReceivedDanmakuArgs e)
 {
     // check user eligibility
     if (!Conf.CheckUserEligibility(e))
     {
         return;
     }
     // check content eligibility
     if (!Conf.CheckKeywordEligibility(e))
     {
         return;
     }
     // check length rule
     if (!Conf.CheckDanmakuLength(e))
     {
         return;
     }
     Bridge.ALog("规则检查通过,准备朗读");
     await TTSPlayer.UnifiedPlay(ProcessSuperChat(e), Vars.CurrentConf.SuperChatIgnoreRandomDitch);
 }
 public static bool CheckUserEligibility(ReceivedDanmakuArgs e)
 {
     if (Vars.CurrentConf.BlockUID)
     {
         if (!CheckUserEligibility(e.Danmaku.UserID.ToString()))
         {
             Bridge.ALog("忽略:用户已命中 UID 规则");
             return(false);
         }
     }
     else
     {
         if (!CheckUserEligibility(e.Danmaku.UserName))
         {
             Bridge.ALog("忽略:用户已命中用户名规则");
             return(false);
         }
     }
     return(true);
 }
示例#32
0
 private void OnGiftSend(ReceivedDanmakuArgs e)
 {
     if (textBox1.Dispatcher.CheckAccess())
     {
         _messageQueue.Enqueue(
             e.Danmaku.GiftUser
             + " 赠送:  "
             + e.Danmaku.GiftName
             + " x "
             + e.Danmaku.GiftNum);
         textBox1.Text = string.Join("\n", _messageQueue);
         textBox1.ScrollToEnd();
     }
     else
     {
         textBox1.Dispatcher.BeginInvoke(
             DispatcherPriority.Normal,
             new Action(() => OnGiftSend(e)));
     }
 }
示例#33
0
        private void b_ReceivedDanmaku(object sender, ReceivedDanmakuArgs e)
        {
            foreach (var dmPlugin in Plugins)
            {
                if (dmPlugin.Status)
                    new Thread(() => dmPlugin.MainReceivedDanMaku(e)).Start();
            }
            switch (e.Danmaku.MsgType)
            {
                case MsgTypeEnum.Comment:
                    logging("收到彈幕:" + (e.Danmaku.isAdmin?"[管]":"")+ (e.Danmaku.isVIP ? "[爷]" : "") +e.Danmaku.CommentUser + " 說: " + e.Danmaku.CommentText);

                    AddDMText((e.Danmaku.isAdmin ? "[管]" : "") + (e.Danmaku.isVIP ? "[爷]" : "") + e.Danmaku.CommentUser, e.Danmaku.CommentText);
                    SendSSP(string.Format(@"\_q{0}\n\_q\f[height,20]{1}",
                        (e.Danmaku.isAdmin ? "[管]" : "") + (e.Danmaku.isVIP ? "[爷]" : "") + e.Danmaku.CommentUser,
                        e.Danmaku.CommentText));
                    
                    break;
                case MsgTypeEnum.GiftTop:
                    foreach (var giftRank in e.Danmaku.GiftRanking)
                    {
                        var query = Ranking.Where(p => p.uid == giftRank.uid);
                        if (query.Any())
                        {
                            var f = query.First();
                            this.Dispatcher.BeginInvoke(new Action(() => f.coin = giftRank.coin));

                        }
                        else
                        {
                            this.Dispatcher.BeginInvoke(new Action(() => Ranking.Add(new GiftRank()
                            {
                                uid = giftRank.uid,
                                coin = giftRank.coin,
                                UserName = giftRank.UserName
                            })));

                        }
                    }
                    break;
                case MsgTypeEnum.GiftSend:
                {
                    var query = SessionItems.Where(p => p.UserName == e.Danmaku.GiftUser && p.Item == e.Danmaku.GiftName);
                    if (query.Any())
                    {
                        this.Dispatcher.BeginInvoke(
                            new Action(() => query.First().num += Convert.ToDecimal(e.Danmaku.GiftNum)));

                    }
                    else
                    {
                        this.Dispatcher.BeginInvoke(new Action(() => SessionItems.Add(
                            new SessionItem()
                            {
                                Item = e.Danmaku.GiftName,
                                UserName = e.Danmaku.GiftUser,
                                num = Convert.ToDecimal(e.Danmaku.GiftNum)
                            }
                            )));

                    }
                    logging("收到道具:" + e.Danmaku.GiftUser + " 赠送的: " + e.Danmaku.GiftName + " x " + e.Danmaku.GiftNum);
                    this.Dispatcher.BeginInvoke(new Action(() =>
                    {
                        if (ShowItem.IsChecked == true)
                        {
                            AddDMText("收到道具",
                                e.Danmaku.GiftUser + " 赠送的: " + e.Danmaku.GiftName + " x " + e.Danmaku.GiftNum, true);
                        }
                    }));
                    break;
                }
                case MsgTypeEnum.Welcome:
                {
                        logging("欢迎老爷"+(e.Danmaku.isAdmin?"和管理":"")+": " + e.Danmaku.CommentUser + " 进入直播间");
                        this.Dispatcher.BeginInvoke(new Action(() =>
                        {
                            if (ShowItem.IsChecked == true)
                            {
                                AddDMText("欢迎老爷" + (e.Danmaku.isAdmin ? "和管理" : ""),
                                    e.Danmaku.CommentUser + " 进入直播间", true);
                            }
                        }));
                        
                        break;
                    }



            }

        }