修复窗体初始化问题;

修复轮询模式payload获取异常的问题
This commit is contained in:
Muihd
2024-05-16 22:24:45 +08:00
parent 6856569339
commit 7f37c7344a
5 changed files with 18 additions and 7 deletions
+5 -4
View File
@@ -30,10 +30,6 @@ namespace BarrageGrab
barServer.OnPrint += WssService_OnPrint;
barServer.Grab.Proxy.OnProxyStatus += Proxy_OnProxyStatus;
AppRuntime.RoomCaches.OnCache += RoomCaches_OnCache;
this.txb_wsaddr.Text = barServer.ServerLocation;
this.txb_upstreamProxy.Text = proxy.HttpUpstreamProxy;
this.cbx_barrageLog.Checked = AppSetting.Current.BarrageLog;
InitTabPages();
}
private void InitTabPages()
@@ -155,6 +151,11 @@ namespace BarrageGrab
private void FormView_Load(object sender, EventArgs e)
{
this.txb_wsaddr.Text = barServer.ServerLocation;
this.txb_upstreamProxy.Text = proxy.HttpUpstreamProxy;
this.cbx_barrageLog.Checked = AppSetting.Current.BarrageLog;
InitTabPages();
this.cbx_enableProxy.Checked = SystemProxy.ProxyIsOpen();
}
+1
View File
@@ -83,6 +83,7 @@ namespace BarrageGrab
{
var dir = Path.Combine(AppContext.BaseDirectory, "logs", "弹幕日志");
var room = AppRuntime.RoomCaches.GetCachedWebRoomInfo(msg.RoomId.ToString());
if(room == null) return;
var date = DateTime.Now.ToString("yyyy年MM月dd日直播");
dir = Path.Combine(dir, $"({room.WebRoomId}){room?.Owner?.Nickname ?? "-1"}", date);
if (!Directory.Exists(dir))
@@ -31,5 +31,10 @@ namespace BarrageGrab.Proxy.ProxyEventArgs
/// 域名
/// </summary>
public string HostName { get; set; }
/// <summary>
/// 有效载荷
/// </summary>
public byte[] Payload { get; set; }
}
}
+3 -1
View File
@@ -207,13 +207,15 @@ namespace BarrageGrab.Proxy
//轮询方式(当抖音ws连接断开后,客户端也会降级使用轮询模式获取弹幕)
if (uri.Contains(BARRAGE_POOL_PATH) && contentType.Contains("application/protobuffer"))
{
//var payload = await e.GetResponseBody();
var payload = await e.GetResponseBody();
base.FireOnFetchResponse(new HttpResponseEventArgs()
{
HttpClient = e.HttpClient,
ProcessID = processid,
HostName = hostname,
ProcessName = base.GetProcessName(processid),
Payload = payload
});
}
}
+3 -1
View File
@@ -136,7 +136,9 @@ namespace BarrageGrab
//http 数据处理
private void Proxy_OnFetchResponse(object sender, HttpResponseEventArgs e)
{
var payload = e.HttpClient.Response.Body;
var payload = e.Payload;
if (payload == null || payload.Length == 0) return;
var response = Serializer.Deserialize<Response>(new ReadOnlyMemory<byte>(payload));