コード例 #1
0
 private static void BotServerMessageReceived(string msg)
 {
     if (msg == "###THBWiki Live Start###")
     {
         Form?.AddInfo("接收到开始轮播请求");
         if (SystemWorking && !THBPlaying)
         {
             Playing = true;
             OBSWebSocket.StartStream();
             BilibiliWebControl.ResumePlayer();
         }
         THBPlaying = true;
     }
     else if (msg == "###THBWiki Live Stop###")
     {
         Form?.AddInfo("接收到停止轮播请求");
         if (SystemWorking && THBPlaying)
         {
             Playing = false;
             BilibiliWebControl.PausePlayer();
             OBSWebSocket.StopStream();
         }
         THBPlaying = false;
     }
     else if (msg == "###THBWiki Live Refresh###")
     {
         Form?.AddInfo("接收到页面刷新请求");
         BilibiliWebControl.Refresh();
     }
     else if (msg == "###THBWiki Live Next###")
     {
         Form?.AddInfo("接收到切换视频请求");
         BilibiliWebControl.NextVideo();
     }
     else if (msg.StartsWith("###THBWiki Live GOTO###"))
     {
         Form?.AddInfo("接收到视频跳跃请求");
         try
         {
             int p = int.Parse(msg.Substring(23));
             BilibiliWebControl.SetPart(p);
         }
         catch (Exception ex)
         {
             Form?.AddInfo(InfoType.ERROR, ex.Message);
         }
     }
     else if (msg.StartsWith("###THBWiki Live RunJS###"))
     {
         Form?.AddInfo("接收到JS执行请求");
         BilibiliWebControl.SendJS(msg.Substring(24));
     }
 }
コード例 #2
0
        private void StopSystem(object sender, RoutedEventArgs e)
        {
            if (!SystemWorking)
            {
                return;
            }

            AddInfo("轮播系统停止");

            if (Playing)
            {
                Playing = false;
                BilibiliWebControl.PausePlayer();
                OBSWebSocket.StopStream();
            }
            SystemWorking = false;
        }