Esempio n. 1
0
        public void MainReceivedDanMaku(ReceivedDanmakuArgs e)
        {
            try
            {
                ReceivedDanmaku?.Invoke(null, e);
            }
            catch (Exception ex)
            {

                MessageBox.Show(
                    "插件" + PluginName + "遇到了不明錯誤: 日誌已經保存在桌面, 請有空發給該插件作者 " + PluginAuth + ", 聯繫方式 " + PluginCont);
                try
                {
                    string path = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);


                    using (StreamWriter outfile = new StreamWriter(path + @"\B站彈幕姬插件" + PluginName + "錯誤報告.txt"))
                    {
                        outfile.WriteLine("請有空發給聯繫方式 " + PluginCont + " 謝謝");
                        outfile.WriteLine(PluginName + " " + PluginVer);
                        outfile.Write(ex.ToString());
                    }

                }
                catch (Exception)
                {

                }
            }
            
        }
Esempio n. 2
0
        public void MainReceivedDanMaku(ReceivedDanmakuArgs e)
        {
            try
            {
                ReceivedDanmaku?.Invoke(null, e);
            }
            catch (Exception ex)
            {
                MessageBox.Show(
                    "插件" + PluginName + "遇到了不明錯誤: 日誌已經保存在桌面, 請有空發給該插件作者 " + PluginAuth + ", 聯繫方式 " + PluginCont);
                try
                {
                    string path = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);


                    using (StreamWriter outfile = new StreamWriter(path + @"\B站彈幕姬插件" + PluginName + "錯誤報告.txt"))
                    {
                        outfile.WriteLine("請有空發給聯繫方式 " + PluginCont + " 謝謝");
                        outfile.WriteLine(PluginName + " " + PluginVer);
                        outfile.Write(ex.ToString());
                    }
                }
                catch (Exception)
                {
                }
            }
        }
Esempio n. 3
0
        public void MainReceivedDanMaku(ReceivedDanmakuArgs e)
        {
            try
            {
                ReceivedDanmaku?.Invoke(null, e);
            }
            catch (Exception ex)
            {
                MessageBox.Show(
                    "插件" + PluginName + "遇到了不明错误: 日志已经保存在桌面, 请有空发给该插件作者 " + PluginAuth + ", 联系方式 " + PluginCont);
                try
                {
                    string path = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);


                    using (StreamWriter outfile = new StreamWriter(path + @"\B站弹幕姬插件" + PluginName + "错误报告.txt"))
                    {
                        outfile.WriteLine("请有空发给联系方式 " + PluginCont + " 谢谢");
                        outfile.WriteLine(PluginName + " " + PluginVer);
                        outfile.Write(ex.ToString());
                    }
                }
                catch (Exception)
                {
                }
            }
        }
        private void BiliLiveLotteryPlugin_ReceivedDanmaku(object sender, ReceivedDanmakuArgs e)
        {
            if (Status)
            {
                if (e.Danmaku.MsgType==MsgTypeEnum.Comment)
                { mainWin.NewDMUser(e.Danmaku.CommentUser);}

            }
        }
Esempio n. 5
0
        private void TPJ_ReceivedDanmaku(object sender, BilibiliDM_PluginFramework.ReceivedDanmakuArgs e)
        {
            if (e.Danmaku.MsgType == MsgTypeEnum.Comment)
            {
                do
                {
                    string msg_value = e.Danmaku.CommentText.Trim();
                    if (msg_value.Count() <= 1) // 必须拥有至少 标识符+命令+参数 个字符
                    {
                        break;
                    }
                    char   dm_type  = msg_value[0];
                    string dm_value = msg_value.Substring(1);
                    if (dm_value.Count() <= 0)
                    {
                        break;
                    }
                    switch (dm_type)
                    {
                    case '@':     // 用户投票
                    {
                        if (this.tpj_main.tp_start == false)
                        {
                            goto default;
                        }
                        this.addUserItem((short)(this.tpj_main.getSettingAllowUseFullName() ? 0 : 1), e.Danmaku.CommentUser, dm_value);
                    }
                    break;

                    case '#':     // 用户添加票项
                        goto default;

                    //break;
                    case '%':     // 房管
                        break;

                    case '$':
                        goto default;

                    //break;
                    default:
                        goto _END;
                    }
                } while (false);
                _END :;
            }
            else
            {
                // Drop This Msg
            }
        }
Esempio n. 6
0
 private void DanmakuMotionPlugin_ReceivedDanmaku(object sender, BilibiliDM_PluginFramework.ReceivedDanmakuArgs e)
 {
     if (Status)
     {
         if (e.Danmaku.MsgType == MsgTypeEnum.Comment)
         {
             //載入配置文件
             try
             {
                 xml.Load(setting_file_path);
             }
             catch (Exception ex)
             {
                 MessageBox.Show("配置參數載入異常,詳見: " + ex.Message);
             }
             //彈幕權限分割
             if (e.Danmaku.isAdmin)
             {
                 string admin_comment = e.Danmaku.CommentText;
                 SendKeys.SendWait(admin_comment);
             }
             else
             {
                 string normal_user_comment = e.Danmaku.CommentText;
                 try
                 {
                     string      normal_user_command = "";
                     XmlNodeList xnList = xml.SelectNodes("/Key_Vector_Setting/event");
                     foreach (XmlNode xn in xnList)
                     {
                         string key = xn["key"].InnerText;
                         if (key == normal_user_comment)
                         {
                             normal_user_command = xn["motion"].InnerText;
                         }
                     }
                     SendKeys.SendWait(normal_user_command);
                 }
                 catch (Exception ex)
                 {
                     AddDM("用戶彈幕參數錯誤");
                     Log("用戶非法彈幕參數,詳細信息" + ex.Message);
                 }
             }
         }
     }
 }
Esempio n. 7
0
        // 收到弹幕、礼物等消息
        private void BSVPlugin_ReceivedDanmaku(object sender, BilibiliDM_PluginFramework.ReceivedDanmakuArgs e)
        {
            DanmakuModel dm     = e.Danmaku;
            int          userId = dm.UserID;

            switch (dm.MsgType)
            {
            case MsgTypeEnum.LiveStart:                      // 直播开始
                if (config.readLiveBegin)
                {
                    string str = makeStringFromTemplate(dm, config.templateLiveBegin);
                    addTTSTask(str);
                }
                break;

            case MsgTypeEnum.LiveEnd:                      // 直播结束
                if (config.readLiveEnd)
                {
                    string str = makeStringFromTemplate(dm, config.templateLiveEnd);
                    addTTSTask(str);
                }
                break;

            case MsgTypeEnum.Welcome:                      // 有观众进入直播间
            {
                UserService.UserInfo userInfo = UserService.getOrCreateUserInfo(userId);
                userInfo.isMilord = dm.isVIP;

                int userCfgIndex          = (int)getUserConfigIndex(userInfo);
                Config.UserConfig userCfg = config.userConfigs[userCfgIndex];
                if (userCfg.readWelcome)
                {
                    string str = makeStringFromTemplate(dm, userCfg.templateWelcome);
                    addTTSTask(str);
                }
            }
            break;

            case MsgTypeEnum.WelcomeGuard:                      // 有普通观众或船员进入直播间
            {
                UserService.UserInfo userInfo = UserService.getOrCreateUserInfo(userId);
                userInfo.level = (UserLevel)dm.UserGuardLevel;

                int userCfgIndex          = (int)getUserConfigIndex(userInfo);
                Config.UserConfig userCfg = config.userConfigs[userCfgIndex];
                if (userCfg.readWelcome)
                {
                    string str = makeStringFromTemplate(dm, userCfg.templateWelcome);
                    addTTSTask(str);
                }
            }
            break;

            case MsgTypeEnum.Comment:                      // 弹幕文本
            {
                int userCfgIndex = dm.UserGuardLevel;
                if (userCfgIndex == (int)UserLevel.Common)
                {
                    UserService.UserInfo userInfo = UserService.getUserInfo(userId);
                    userCfgIndex = (int)getUserConfigIndex(userInfo);
                }

                Config.UserConfig userCfg = config.userConfigs[userCfgIndex];
                if (userCfg.readText)
                {
                    string str = makeStringFromTemplate(dm, userCfg.templateText);
                    addTTSTask(str);
                }
            }
            break;

            case MsgTypeEnum.GiftSend:                      // 收到礼物
            {
                UserService.UserInfo userInfo = UserService.getUserInfo(userId);
                int userCfgIndex          = (int)getUserConfigIndex(userInfo);
                Config.UserConfig userCfg = config.userConfigs[userCfgIndex];
                if (userCfg.readGift)
                {
                    string str = makeStringFromTemplate(dm, userCfg.templateGift);
                    addTTSTask(str);
                }
            }
            break;

            case MsgTypeEnum.GuardBuy:                      // 购买船票
            {
                int userCfgIndex = dm.UserGuardLevel;
                if (userCfgIndex == (int)UserLevel.Common)
                {
                    UserService.UserInfo userInfo = UserService.getUserInfo(userId);
                    userCfgIndex = (int)getUserConfigIndex(userInfo);
                }

                Config.UserConfig userCfg = config.userConfigs[userCfgIndex];
                if (userCfg.readTicket)
                {
                    string str = makeStringFromTemplate(dm, userCfg.templateTicket);
                    addTTSTask(str);
                }
            }
            break;
            }
        }