private void CS_Danmaku_Plgin_ReceivedDanmaku(object sender, BilibiliDM_PluginFramework.ReceivedDanmakuArgs e) { if (Status) { if (e.Danmaku.MsgType == MsgTypeEnum.Comment) { //MessageBox.Show(e.Danmaku.CommentText); switch (e.Danmaku.CommentText) { case "up": SendKeys.SendWait("{UP}"); break; case "down": SendKeys.SendWait("{DOWN}"); break; case "left": SendKeys.SendWait("{LEFT}"); break; case "rigth": SendKeys.SendWait("{RIGHT}"); break; case "enter": SendKeys.SendWait("{ENTER}"); break; case "space": SendKeys.SendWait(" "); break; default: break; } } } }
public Person(BilibiliDM_PluginFramework.DanmakuModel d) { //已抛弃= = this.name = d.CommentUser; this.id = Convert.ToInt32(getJson("\",[", ",\"", d.RawData)); this.id_s = id.ToString(); this.isAdmin = d.isAdmin; this.isVip = d.isVIP; this.level = -1; this.rank = ""; this.danmaku = new List<BilibiliDM_PluginFramework.DanmakuModel>(); }
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); } } } } }
private void Countress_ReceivedDanmaku(object sender, BilibiliDM_PluginFramework.ReceivedDanmakuArgs e) { //首先分析rawData中cmd是否等于DANMU_MSG然后进行操作 string cmd_tmp = e.Danmaku.RawData.Substring(e.Danmaku.RawData.IndexOf("\"cmd\"") + 7); string cmd = cmd_tmp.Substring(0, cmd_tmp.IndexOf("\"")); if (cmd == "DANMU_MSG") { if (_data.getPersonByName(e.Danmaku.CommentUser) != null) { _data.getPersonByName(e.Danmaku.CommentUser).AddDanmaku(e.Danmaku); } else { //_data.AddPerson(e.Danmaku); _data.AddPerson(new Data.Person(e.Danmaku.RawData)); _data.getPersonByName(e.Danmaku.CommentUser).AddDanmaku(e.Danmaku); } //System.Windows.Forms.MessageBox.Show(e.Danmaku.CommentText + "——by " + e.Danmaku.CommentUser); } }
private void Countress_Disconnected(object sender, BilibiliDM_PluginFramework.DisconnectEvtArgs e) { SaveData(); }
//接受弹幕 估计是整个程序的核心了吧 private void Class1_ReceivedDanmaku(object sender, BilibiliDM_PluginFramework.ReceivedDanmakuArgs e) { string d_txt = e.Danmaku.CommentText; string d_by = e.Danmaku.CommentUser; if (d_txt == null) return; if (d_txt.Substring(0, 2) == "点歌") { string id = d_txt.Substring(3); songInfo newsong = new songInfo(id, d_by); if (!newsong.err) { l_frmSongList.addSong(newsong); } else { AddDM(d_by + "输入的歌曲id:" + id + "有误!"); } } if (d_txt.Substring(0, 2) == "歌单") { //原有歌曲数量 int oldnum = l_frmSongList.getSongNum(); if (e.Danmaku.isAdmin == true) { string id = d_txt.Substring(3); string url = "http://music.163.com/api/playlist/detail?id=" + id; WebClient w = new WebClient(); Stream sc = w.OpenRead(url); StreamReader sr = new StreamReader(sc, Encoding.UTF8); string json = sr.ReadToEnd(); sr.Close(); sc.Close(); Newtonsoft.Json.Linq.JObject jo = Newtonsoft.Json.Linq.JObject.Parse(json); int i = 0; while (i < jo["result"]["tracks"].Count()) { string name = jo["result"]["tracks"][i]["name"].ToString(); string m_url = jo["result"]["tracks"][i]["mp3Url"].ToString(); long last = Convert.ToInt32(jo["result"]["tracks"][i]["duration"]); songInfo newsong = new songInfo(id, name, last, m_url, d_by); l_frmSongList.addSong(newsong); i++; } #region /* json = json.Substring(json.IndexOf("popularity") + 10); while (json.IndexOf("mp3Url") != -1 && json.IndexOf("popularity") != -1) { songInfo newsong = new songInfo(id, json, d_by); if (!newsong.err) { l_frmSongList.addSong(newsong); json = json.Substring(json.IndexOf("popularity") + 10); } else { AddDM(d_by + "输入的歌单id:" + id + "有误!"); break; } } //补充处理 l_frmSongList.addSong(new songInfo(id, json, d_by)); //l_frmSongList.delSong(oldnum+1); */ #endregion } else { AddDM("只有房管才能点歌单!"); } } //throw new NotImplementedException(); }
private void Class1_Connected(object sender, BilibiliDM_PluginFramework.ConnectedEvtArgs e) { // throw new NotImplementedException(); }
private void Class1_ReceivedDanmaku(object sender, BilibiliDM_PluginFramework.ReceivedDanmakuArgs e) { this.Log("BBB"); this.AddDM("bbb",true); }
private void Class1_ReceivedRoomCount(object sender, BilibiliDM_PluginFramework.ReceivedRoomCountArgs e) { }
public void AddPerson(BilibiliDM_PluginFramework.DanmakuModel x) { dt.Add(new Person(x)); this.getPersonByName(x.CommentUser).AddDanmaku(x); }
public void AddDanmaku(BilibiliDM_PluginFramework.DanmakuModel dm) { danmaku.Add(dm); }