Beispiel #1
0
 private static void Craw_OnDanmaku(object sender, DanmakuEventArgs e)
 {
     Console.WriteLine("-------------------------------------------------");
     Console.WriteLine(e.Danmaku.content);
     Console.WriteLine("-------------------------------------------------");
 }
 private void BarrageMnaager_OnReceiveMessage(object sender, DanmakuEventArgs e)
 {
     m_SyncContext.Post(AddLabel, e.Danmaku);
 }
Beispiel #3
0
 private static void Craw_OnDanmaku(object sender, DanmakuEventArgs e)
 {
     Console.WriteLine("-------------------------------------------------");
     Console.WriteLine(e.Danmaku.content + "  uid:" + e.Danmaku.uid + "  snick:" + e.Danmaku.snick);
     if (e.Danmaku.content[0] == '#')
     {
         log.DebugFormat(e.Danmaku.content + "  uid:" + e.Danmaku.uid + "  snick:" + e.Danmaku.snick);
         if (!userlastDanmu.ContainsKey(e.Danmaku.uid))
         {
             userlastDanmu.Add(e.Danmaku.uid, DateTime.Now);
         }
         else
         {
             if (DateTime.Now - userlastDanmu[e.Danmaku.uid] < TimeSpan.FromMinutes(30) && !adminsset.Contains(e.Danmaku.snick))
             {
                 Console.WriteLine("小于30分钟的点播弹幕或不是管理员:" + e.Danmaku.content + "  uid:" + e.Danmaku.uid + "  snick:" + e.Danmaku.snick);
                 return;
             }
         }
         //MessageBox.Show(e.Danmaku.content);
         if (remote == null)
         {
             Console.WriteLine("未找到播放器");
         }
         int count = 0;
         if (e.Danmaku.content.Length > 3 && e.Danmaku.content.Substring(0, 3) == "#快进")
         {
             int.TryParse(e.Danmaku.content.Substring(3), out count);
             if (count <= 100 && count > 0)
             {
                 for (int i = 0; i < count; i++)
                 {
                     remote.Forward();
                 }
                 System.Threading.Thread.Sleep(500);
             }
         }
         else if (e.Danmaku.content.Length > 3 && e.Danmaku.content.Length > 3 && e.Danmaku.content.Substring(0, 3) == "#快退")
         {
             int.TryParse(e.Danmaku.content.Substring(3), out count);
             if (count <= 100 && count > 0)
             {
                 for (int i = 0; i < count; i++)
                 {
                     remote.Rewind();
                 }
                 System.Threading.Thread.Sleep(500);
             }
         }
         else if (e.Danmaku.content.Length > 3 && e.Danmaku.content.Substring(0, 4) == "#上一集")
         {
             remote.PreviousFile();
             System.Threading.Thread.Sleep(500);
         }
         else if (e.Danmaku.content.Length > 3 && e.Danmaku.content.Substring(0, 4) == "#下一集")
         {
             remote.NextFile();
             System.Threading.Thread.Sleep(500);
         }
         else if (e.Danmaku.content.Length > 3 && e.Danmaku.content.Substring(0, 3) == "#上集")
         {
             int.TryParse(e.Danmaku.content.Substring(3), out count);
             if (count <= 10 && count > 0)
             {
                 for (int i = 0; i < count; i++)
                 {
                     remote.PreviousFile();
                     System.Threading.Thread.Sleep(500);
                 }
             }
         }
         else if (e.Danmaku.content.Length > 3 && e.Danmaku.content.Substring(0, 3) == "#下集")
         {
             int.TryParse(e.Danmaku.content.Substring(3), out count);
             if (count <= 10 && count > 0)
             {
                 for (int i = 0; i < count; i++)
                 {
                     remote.NextFile();
                     System.Threading.Thread.Sleep(500);
                 }
             }
         }
     }
     Console.WriteLine("-------------------------------------------------");
 }