修复通过用户抖音号进入房间房间信息匹配不到的问题

This commit is contained in:
Muihd
2024-05-12 15:43:10 +08:00
parent 1f29618a47
commit 250a8fcfbf
5 changed files with 26 additions and 19 deletions
+2 -2
View File
@@ -33,6 +33,6 @@ using System.Runtime.InteropServices;
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值 //可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
//通过使用 "*",如下所示: //通过使用 "*",如下所示:
// [assembly: AssemblyVersion("1.0.*")] // [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.7.3.0")] [assembly: AssemblyVersion("2.7.4.0")]
[assembly: AssemblyFileVersion("2.7.3.0")] [assembly: AssemblyFileVersion("2.7.4.0")]
[assembly: NeutralResourcesLanguage("zh-CN")] [assembly: NeutralResourcesLanguage("zh-CN")]
+2 -1
View File
@@ -108,7 +108,8 @@ namespace BarrageGrab.Proxy
{ {
RegistryKey registry = Registry.CurrentUser.OpenSubKey("Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings", true); RegistryKey registry = Registry.CurrentUser.OpenSubKey("Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings", true);
registry.SetValue("ProxyEnable", 1); registry.SetValue("ProxyEnable", 1);
registry.SetValue("ProxyServer", $"http=localhost:{ProxyPort};https=localhost:{ProxyPort}"); registry.SetValue("ProxyServer", $"127.0.0.1:{ProxyPort}");
OnProxyStatus?.Invoke(this, new SystemProxyChangeEventArgs() OnProxyStatus?.Invoke(this, new SystemProxyChangeEventArgs()
{ {
Open = true Open = true
+5 -3
View File
@@ -243,7 +243,7 @@ namespace BarrageGrab.Proxy
var urlNoQuery = url.Split('?')[0]; var urlNoQuery = url.Split('?')[0];
var processid = e.HttpClient.ProcessId.Value; var processid = e.HttpClient.ProcessId.Value;
var processName = base.GetProcessName(processid); var processName = base.GetProcessName(processid);
var liveRoomMactch = Regex.Match(uri.Trim(), @".*:\/\/live.douyin\.com\/(\d+)"); var liveRoomMactch = Regex.Match(uri.Trim(), @".*:\/\/live.douyin\.com\/([0-9a-zA-Z_]+)");
var liveHomeMatch = Regex.Match(uri.Trim(), @".*:\/\/live.douyin\.com\/?$"); var liveHomeMatch = Regex.Match(uri.Trim(), @".*:\/\/live.douyin\.com\/?$");
var contentType = e.HttpClient.Response.ContentType ?? ""; var contentType = e.HttpClient.Response.ContentType ?? "";
@@ -586,8 +586,10 @@ namespace BarrageGrab.Proxy
proxyServer.Start(AppSetting.Current.UsedProxy); proxyServer.Start(AppSetting.Current.UsedProxy);
if (AppSetting.Current.UsedProxy) if (AppSetting.Current.UsedProxy)
{ {
proxyServer.SetAsSystemHttpProxy(explicitEndPoint); base.RegisterSystemProxy();
proxyServer.SetAsSystemHttpsProxy(explicitEndPoint); //使用其自带的系统代理设置可能会导致格式问题
//proxyServer.SetAsSystemHttpProxy(explicitEndPoint);
//proxyServer.SetAsSystemHttpsProxy(explicitEndPoint);
} }
} }
} }
+10 -6
View File
@@ -125,11 +125,11 @@ namespace BarrageGrab
var response = Serializer.Deserialize<Response>(new ReadOnlyMemory<byte>(allBuff)); var response = Serializer.Deserialize<Response>(new ReadOnlyMemory<byte>(allBuff));
response.Messages.ForEach(f => DoMessage(f,e.ProcessName)); response.Messages.ForEach(f => DoMessage(f, e.ProcessName));
} }
catch (Exception ex) catch (Exception ex)
{ {
Logger.LogError(ex,$"处理弹幕数据包时出错:{ex.Message}"); Logger.LogError(ex, $"处理弹幕数据包时出错:{ex.Message}");
} }
} }
@@ -142,7 +142,7 @@ namespace BarrageGrab
response.Messages.ForEach(f => response.Messages.ForEach(f =>
{ {
DoMessage(f,e.ProcessName); DoMessage(f, e.ProcessName);
}); });
} }
@@ -150,7 +150,7 @@ namespace BarrageGrab
Dictionary<string, List<long>> msgDic = new Dictionary<string, List<long>>(); Dictionary<string, List<long>> msgDic = new Dictionary<string, List<long>>();
//发送事件 //发送事件
private void DoMessage(Message msg,string processName) private void DoMessage(Message msg, string processName)
{ {
List<long> msgIdList; List<long> msgIdList;
if (msgDic.ContainsKey(msg.Method)) if (msgDic.ContainsKey(msg.Method))
@@ -168,7 +168,11 @@ namespace BarrageGrab
} }
msgIdList.Add(msg.msgId); msgIdList.Add(msg.msgId);
if (msgIdList.Count > 300) msgIdList.RemoveAt(0); //每种消息类型设置300容量应该足够,不太可能存在一条消息被挤出队列后再次出现
while (msgIdList.Count > 300)
{
msgIdList.RemoveAt(0);
}
try try
{ {
@@ -178,7 +182,7 @@ namespace BarrageGrab
case "WebcastMemberMessage": case "WebcastMemberMessage":
{ {
var arg = Serializer.Deserialize<MemberMessage>(new ReadOnlyMemory<byte>(msg.Payload)); var arg = Serializer.Deserialize<MemberMessage>(new ReadOnlyMemory<byte>(msg.Payload));
this.OnMemberMessage?.Invoke(this, new RoomMessageEventArgs<MemberMessage>(processName,arg)); this.OnMemberMessage?.Invoke(this, new RoomMessageEventArgs<MemberMessage>(processName, arg));
break; break;
} }
//关注 //关注
+4 -4
View File
@@ -13,6 +13,8 @@
<TargetFrameworkVersion>v4.6.2</TargetFrameworkVersion> <TargetFrameworkVersion>v4.6.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment> <FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic> <Deterministic>true</Deterministic>
<IsWebBootstrapper>false</IsWebBootstrapper>
<TargetFrameworkProfile />
<PublishUrl>publish\</PublishUrl> <PublishUrl>publish\</PublishUrl>
<Install>true</Install> <Install>true</Install>
<InstallFrom>Disk</InstallFrom> <InstallFrom>Disk</InstallFrom>
@@ -25,10 +27,8 @@
<MapFileExtensions>true</MapFileExtensions> <MapFileExtensions>true</MapFileExtensions>
<ApplicationRevision>0</ApplicationRevision> <ApplicationRevision>0</ApplicationRevision>
<ApplicationVersion>1.0.0.%2a</ApplicationVersion> <ApplicationVersion>1.0.0.%2a</ApplicationVersion>
<IsWebBootstrapper>false</IsWebBootstrapper>
<UseApplicationTrust>false</UseApplicationTrust> <UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled> <BootstrapperEnabled>true</BootstrapperEnabled>
<TargetFrameworkProfile />
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols> <DebugSymbols>true</DebugSymbols>
@@ -40,12 +40,12 @@
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType> <DebugType>none</DebugType>
<Optimize>true</Optimize> <Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath> <OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants> <DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport> <ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel> <WarningLevel>0</WarningLevel>
</PropertyGroup> </PropertyGroup>
<PropertyGroup> <PropertyGroup>
<StartupObject /> <StartupObject />