文件名变更

This commit is contained in:
梅浩东
2024-03-29 17:45:46 +08:00
parent ffc3d69bcb
commit 0c5b01a146
8 changed files with 43 additions and 43 deletions
+4 -4
View File
@@ -18,7 +18,7 @@ namespace BarrageGrab
static ComPortServer()
{
if (AppSetting.Current.UseComPortFilter)
if (Appsetting.Current.UseComPortFilter)
{
jsEngine = JsEngine.CreateNewEngine();
var jsFile = JsEngine.GetJsFile("comPortFilter.js");
@@ -28,8 +28,8 @@ namespace BarrageGrab
public ComPortServer(WsBarrageServer server)
{
string portName = AppSetting.Current.ComPort;
int baudRate = AppSetting.Current.ComBaudRate;
string portName = Appsetting.Current.ComPort;
int baudRate = Appsetting.Current.ComBaudRate;
if (portName.IsNullOrWhiteSpace())
{
return;
@@ -50,7 +50,7 @@ namespace BarrageGrab
{
if (!sendPort.IsOpen) return;
if (e == null) return;
if (!AppSetting.Current.UseComPortFilter)
if (!Appsetting.Current.UseComPortFilter)
{
var json = e.ToJson() + "\r\n";
var jbuff = Encoding.UTF8.GetBytes(json);
+13 -13
View File
@@ -32,7 +32,7 @@ namespace BarrageGrab
AppRuntime.RoomCaches.OnCache += RoomCaches_OnCache;
this.txb_wsaddr.Text = barServer.ServerLocation;
this.txb_upstreamProxy.Text = proxy.HttpUpstreamProxy;
this.cbx_barrageLog.Checked = AppSetting.Current.BarrageLog;
this.cbx_barrageLog.Checked = Appsetting.Current.BarrageLog;
InitTabPages();
}
@@ -67,17 +67,17 @@ namespace BarrageGrab
if (page == this.tabPage_Ws)
{
type = "ws";
ck.Checked = AppSetting.Current.PushFilter.Contains(label.Key);
ck.Checked = Appsetting.Current.PushFilter.Contains(label.Key);
}
if (page == this.tabPage_Console)
{
type = "console";
ck.Checked = AppSetting.Current.PrintFilter.Contains(label.Key);
ck.Checked = Appsetting.Current.PrintFilter.Contains(label.Key);
}
if (page == this.tabPage_Log)
{
type = "log";
ck.Checked = AppSetting.Current.LogFilter.Contains(label.Key);
ck.Checked = Appsetting.Current.LogFilter.Contains(label.Key);
}
ck.Name = $"cbx_bartype_{type}_{label.Key}";
ck.CheckedChanged += Ck_CheckedChanged;
@@ -94,17 +94,17 @@ namespace BarrageGrab
var selected = GetCheckedBarTypes((FlowLayoutPanel)cbx.Parent);
if (cbx.Parent.Parent == this.tabPage_Console)
{
AppSetting.Current.PrintFilter = selected;
Appsetting.Current.PrintFilter = selected;
}
if (cbx.Parent.Parent == this.tabPage_Ws)
{
AppSetting.Current.PushFilter = selected;
Appsetting.Current.PushFilter = selected;
}
if(cbx.Parent.Parent == this.tabPage_Log)
{
AppSetting.Current.LogFilter = selected;
Appsetting.Current.LogFilter = selected;
}
AppSetting.Current.Save();
Appsetting.Current.Save();
}
private int[] GetCheckedBarTypes(FlowLayoutPanel panel)
@@ -171,7 +171,7 @@ namespace BarrageGrab
{
//将弹幕输出到richTextBox
//颜色转换
Color color = AppSetting.Current.ColorMap[e.MsgType].Item2;
Color color = Appsetting.Current.ColorMap[e.MsgType].Item2;
string msg = e.Message;
this.Invoke(new Action(() =>
@@ -218,8 +218,8 @@ namespace BarrageGrab
try
{
proxy.SetUpstreamProxy(text);
AppSetting.Current.UpstreamProxy = text;
AppSetting.Current.Save();
Appsetting.Current.UpstreamProxy = text;
Appsetting.Current.Save();
}
catch (Exception ex)
{
@@ -231,8 +231,8 @@ namespace BarrageGrab
private void cbx_barrageLog_CheckedChanged(object sender, EventArgs e)
{
var checker = (CheckBox)sender;
AppSetting.Current.BarrageLog = checker.Checked;
AppSetting.Current.Save();
Appsetting.Current.BarrageLog = checker.Checked;
Appsetting.Current.Save();
}
}
}
+3 -3
View File
@@ -94,9 +94,9 @@ namespace BarrageGrab
/// <param name="msg">弹幕内容</param>
public static void LogBarrage(PackMsgType type, Msg msg)
{
if (!AppSetting.Current.BarrageLog) return;
if (!Appsetting.Current.BarrageLog) return;
if (type == PackMsgType.无) return;
if (AppSetting.Current.LogFilter.Any() && !AppSetting.Current.LogFilter.Contains(type.GetHashCode())) return;
if (Appsetting.Current.LogFilter.Any() && !Appsetting.Current.LogFilter.Contains(type.GetHashCode())) return;
try
{
@@ -135,7 +135,7 @@ namespace BarrageGrab
text += $" [{msg.User?.GenderToString()}] ";
}
ConsoleColor color = AppSetting.Current.ColorMap[barType].Item1;
ConsoleColor color = Appsetting.Current.ColorMap[barType].Item1;
var append = msg.Content;
switch (barType)
{
+4 -4
View File
@@ -63,21 +63,21 @@ namespace BarrageGrab
AppRuntime.Init();
WinApi.SetConsoleCtrlHandler(controlCtr, true);//捕获控制台关闭
WinApi.DisableQuickEditMode();//禁用控制台快速编辑模式
AppRuntime.DisplayConsole(!AppSetting.Current.HideConsole);//控制控制台可见
AppRuntime.WsServer.Grab.Proxy.SetUpstreamProxy(AppSetting.Current.UpstreamProxy);//设置上游代理
AppRuntime.DisplayConsole(!Appsetting.Current.HideConsole);//控制控制台可见
AppRuntime.WsServer.Grab.Proxy.SetUpstreamProxy(Appsetting.Current.UpstreamProxy);//设置上游代理
AppRuntime.WsServer.OnClose += (s, e) =>
{
exited = true;
};
//串口写入服务
if (!AppSetting.Current.ComPort.IsNullOrWhiteSpace())
if (!Appsetting.Current.ComPort.IsNullOrWhiteSpace())
{
AppRuntime.ComPortServer.OpenStart();
}
//显示窗体
if (AppSetting.Current.ShowWindow)
if (Appsetting.Current.ShowWindow)
{
var uiThread = new Thread(new ThreadStart(() =>
{
+3 -3
View File
@@ -32,7 +32,7 @@ namespace BarrageGrab.Proxy
/// <summary>
/// 代理端口
/// </summary>
public int ProxyPort { get { return AppSetting.Current.ProxyPort; } }
public int ProxyPort { get { return Appsetting.Current.ProxyPort; } }
public abstract string HttpUpstreamProxy { get; }
@@ -55,11 +55,11 @@ namespace BarrageGrab.Proxy
{
host = host.Trim().ToLower();
if (!AppSetting.Current.FilterHostName) return true;
if (!Appsetting.Current.FilterHostName) return true;
if (host.StartsWith("webcast")) return true;
if (AppSetting.Current.HostNameFilter.Any(a => a.Trim().ToLower() == host)) return true;
if (Appsetting.Current.HostNameFilter.Any(a => a.Trim().ToLower() == host)) return true;
return false;
}
+8 -8
View File
@@ -212,7 +212,7 @@ namespace BarrageGrab.Proxy
var scriptContext = BuildContext(new Dictionary<string, string>()
{
{"PROCESS_NAME","'{processName}'"},
{"AUTOPAUSE",AppSetting.Current.AutoPause.ToString().ToLower()}
{"AUTOPAUSE",Appsetting.Current.AutoPause.ToString().ToLower()}
});
liveRoomInjectScript = scriptContext + liveRoomInjectScript;
var html = await e.GetResponseBodyAsString();
@@ -275,7 +275,7 @@ namespace BarrageGrab.Proxy
}
//给script标签 src加上时间戳避免缓存
if (AppSetting.Current.DisableLivePageScriptCache)
if (Appsetting.Current.DisableLivePageScriptCache)
{
var scripts = doc.DocumentNode.SelectNodes("//script[@src]");
if (scripts != null)
@@ -311,7 +311,7 @@ namespace BarrageGrab.Proxy
var scriptContext = BuildContext(new Dictionary<string, string>()
{
{"PROCESS_NAME","'{processName}'"},
{"AUTOPAUSE",AppSetting.Current.AutoPause.ToString().ToLower()}
{"AUTOPAUSE",Appsetting.Current.AutoPause.ToString().ToLower()}
});
liveHoomInjectScript = scriptContext + liveHoomInjectScript;
@@ -382,7 +382,7 @@ namespace BarrageGrab.Proxy
}
}
if (url.Contains(LIVE_SCRIPT_PATH) && AppSetting.Current.ForcePolling)
if (url.Contains(LIVE_SCRIPT_PATH) && Appsetting.Current.ForcePolling)
{
var reg = new Regex(@"if\s*\((?<patt>!this\.stopPolling)\)");
var js = await e.GetResponseBodyAsString();
@@ -393,7 +393,7 @@ namespace BarrageGrab.Proxy
var pollingIntervalMatch = pollingIntervalReg.Match(js);
if (pollingIntervalMatch.Success)
{
var myValue = AppSetting.Current.PollingInterval;
var myValue = Appsetting.Current.PollingInterval;
js = pollingIntervalReg.Replace(js, $"this.pollingInterval={myValue},");
Logger.PrintColor($"直播间已成功修改轮询间隔为{myValue}ms", ConsoleColor.Green);
}
@@ -515,7 +515,7 @@ namespace BarrageGrab.Proxy
{
proxyServer.Stop();
proxyServer.Dispose();
if (AppSetting.Current.UsedProxy)
if (Appsetting.Current.UsedProxy)
{
CloseSystemProxy();
}
@@ -526,8 +526,8 @@ namespace BarrageGrab.Proxy
/// </summary>
override public void Start()
{
proxyServer.Start(AppSetting.Current.UsedProxy);
if (AppSetting.Current.UsedProxy)
proxyServer.Start(Appsetting.Current.UsedProxy);
if (Appsetting.Current.UsedProxy)
{
proxyServer.SetAsSystemHttpProxy(explicitEndPoint);
proxyServer.SetAsSystemHttpsProxy(explicitEndPoint);
+7 -7
View File
@@ -36,7 +36,7 @@ namespace BarrageGrab
Timer dieout = new Timer(10000);//离线客户端清理计时器
Timer giftCountTimer = new Timer(10000);//礼物缓存清理计时器
WssBarrageGrab grab = new WssBarrageGrab();//弹幕解析器核心
AppSetting Appsetting = AppSetting.Current;//全局配置文件实例
Appsetting Appsetting = Appsetting.Current;//全局配置文件实例
static int printCount = 0; //控制台输出计数,用于判断清理控制台
/// <summary>
@@ -120,12 +120,12 @@ namespace BarrageGrab
//判断Rommid是否符合拦截规则
private bool CheckRoomId(long roomid)
{
if (!AppSetting.Current.WebRoomIds.Any()) return true;
if (!Appsetting.Current.WebRoomIds.Any()) return true;
var webrid = AppRuntime.RoomCaches.GetCachedWebRoomid(roomid.ToString());
if (webrid <= 0) return true;
return AppSetting.Current.WebRoomIds.Contains(webrid);
return Appsetting.Current.WebRoomIds.Contains(webrid);
}
//解析用户
@@ -174,7 +174,7 @@ namespace BarrageGrab
text += $" [{msg.User?.GenderToString()}] ";
}
ConsoleColor color = AppSetting.Current.ColorMap[barType].Item1;
ConsoleColor color = Appsetting.Current.ColorMap[barType].Item1;
var append = msg.Content;
switch (barType)
{
@@ -185,13 +185,13 @@ namespace BarrageGrab
text += append;
if (AppSetting.Current.BarrageLog)
if (Appsetting.Current.BarrageLog)
{
Logger.LogBarrage(barType, msg);
}
if (!Appsetting.PrintBarrage) return;
if (AppSetting.Current.PrintFilter.Any() && !AppSetting.Current.PrintFilter.Contains(barType.GetHashCode())) return;
if (Appsetting.Current.PrintFilter.Any() && !Appsetting.Current.PrintFilter.Contains(barType.GetHashCode())) return;
OnPrint?.Invoke(this, new PrintEventArgs()
{
@@ -575,7 +575,7 @@ namespace BarrageGrab
public void Broadcast(BarrageMsgPack pack)
{
if (pack == null) return;
if (AppSetting.Current.PushFilter.Any() && !AppSetting.Current.PushFilter.Contains(pack.Type.GetHashCode())) return;
if (Appsetting.Current.PushFilter.Any() && !Appsetting.Current.PushFilter.Contains(pack.Type.GetHashCode())) return;
var offLines = new List<string>();
foreach (var item in socketList)
+1 -1
View File
@@ -19,7 +19,7 @@ namespace BarrageGrab
{
//ISystemProxy proxy = new FiddlerProxy();
ISystemProxy proxy = new TitaniumProxy();
AppSetting appsetting = AppSetting.Current;
Appsetting appsetting = Appsetting.Current;
/// <summary>
/// 进入直播间