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)); } }
private void StartSystem(object sender, RoutedEventArgs e) { if (SystemWorking) { return; } if (!BrowserOpen || !BilibiliWebControl.Launched) { AddInfo(InfoType.WARN, "浏览器还未载入,不允许激活轮播系统"); return; } AddInfo("激活轮播系统"); if (THBPlaying) { Playing = true; OBSWebSocket.StartStream(); BilibiliWebControl.ResumePlayer(); } SystemWorking = true; }