完善窗体逻辑;

添加弹幕日志;
修复房间信息获取正则表达式;
This commit is contained in:
梅浩东
2023-11-23 16:43:21 +08:00
parent 37b9da6d38
commit 873608f534
25 changed files with 1278 additions and 481 deletions
+36 -6
View File
@@ -24,15 +24,26 @@ namespace BarrageGrab.Proxy
/// </summary>
public event EventHandler<HttpResponseEventArgs> OnFetchResponse;
/// <summary>
/// 代理切换时触�?
/// </summary>
public event EventHandler<SystemProxyChangeEventArgs> OnProxyStatus;
/// <summary>
/// 代理端口
/// </summary>
public int ProxyPort { get { return Appsetting.Current.ProxyPort; } }
public int ProxyPort { get { return Appsetting.Current.ProxyPort; } }
public abstract string HttpUpstreamProxy { get; }
public abstract string HttpsUpstreamProxy { get; }
public abstract void Dispose();
public abstract void Start();
public abstract void SetUpstreamProxy(string addr);
//https://live.douyin.com/webcast/gift/list/ [礼物数据接口]
/// <summary>
@@ -41,16 +52,16 @@ namespace BarrageGrab.Proxy
/// <param name="host"></param>
/// <returns></returns>
protected virtual bool CheckHost(string host)
{
{
host = host.Trim().ToLower();
if (!Appsetting.Current.FilterHostName) return true;
if (host.StartsWith("webcast")) return true;
if (Appsetting.Current.HostNameFilter.Any(a => a.Trim().ToLower() == host)) return true;
return false;
return false;
}
/// <summary>
@@ -86,18 +97,22 @@ namespace BarrageGrab.Proxy
return process.ProcessName;
}
}
catch (Exception ex){}
catch (Exception ex) { }
return $"<{processID}>";
}
/// <summary>
/// 注册为系统代理
/// 注册为系统代�?
/// </summary>
public void RegisterSystemProxy()
{
RegistryKey registry = Registry.CurrentUser.OpenSubKey("Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings", true);
registry.SetValue("ProxyEnable", 1);
registry.SetValue("ProxyServer", $"http=localhost:{ProxyPort};https=localhost:{ProxyPort}");
OnProxyStatus?.Invoke(this, new SystemProxyChangeEventArgs()
{
Open = true
});
}
/// <summary>
@@ -108,6 +123,21 @@ namespace BarrageGrab.Proxy
RegistryKey registry = Registry.CurrentUser.OpenSubKey("Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings", true);
registry.SetValue("ProxyEnable", 0);
registry.SetValue("ProxyServer", $"http=localhost:{ProxyPort};https=localhost:{ProxyPort}");
OnProxyStatus?.Invoke(this, new SystemProxyChangeEventArgs()
{
Open = false
});
}
public static bool ProxyIsOpen()
{
RegistryKey registry = Registry.CurrentUser.OpenSubKey("Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings", true);
var proxyEnable = registry.GetValue("ProxyEnable");
if (proxyEnable != null && proxyEnable.ToString() == "1")
{
return true;
}
return false;
}
}
}