From b2e9ab7bbc7cbf11bbb52dd8a4a6c362a9484e7d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E7=99=BD=E7=8C=BF?= <1083092844@qq.com> Date: Thu, 17 Aug 2023 20:33:30 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=AF=E6=8C=81=E5=9C=A8any=E7=AB=AF?= =?UTF-8?q?=E5=8F=A3=E4=B8=8A=E7=9B=91=E5=90=ACws?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- BarrageGrab/App.config | 51 ++++++++++++++++++--------------------- BarrageGrab/Appsetting.cs | 22 +++++++++++++---- 2 files changed, 41 insertions(+), 32 deletions(-) diff --git a/BarrageGrab/App.config b/BarrageGrab/App.config index 5b801f4..3a74f82 100644 --- a/BarrageGrab/App.config +++ b/BarrageGrab/App.config @@ -1,29 +1,26 @@ - + - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/BarrageGrab/Appsetting.cs b/BarrageGrab/Appsetting.cs index 9a79bfc..bf7d8c1 100644 --- a/BarrageGrab/Appsetting.cs +++ b/BarrageGrab/Appsetting.cs @@ -4,7 +4,7 @@ using System.Configuration; using System.Linq; using System.Text; using System.Threading.Tasks; -using BarrageGrab.JsonEntity; +using BarrageGrab.Modles.JsonEntity; using static System.Configuration.ConfigurationManager; namespace BarrageGrab { @@ -24,8 +24,10 @@ namespace BarrageGrab ProxyPort = int.Parse(AppSettings["proxyPort"]); PrintFilter = Enum.GetValues(typeof(BarrageMsgType)).Cast().ToArray(); FilterHostName = bool.Parse(AppSettings["filterHostName"].Trim()); - HostNameFilter = AppSettings["hostNameFilter"].Trim().Split(',').Where(w=>!string.IsNullOrWhiteSpace(w)).ToArray(); - RoomIds = AppSettings["roomIds"].Trim().Split(',').Where(w=>!string.IsNullOrWhiteSpace(w)).Select(s => long.Parse(s)).ToArray(); + HostNameFilter = AppSettings["hostNameFilter"].Trim().Split(',').Where(w => !string.IsNullOrWhiteSpace(w)).ToArray(); + RoomIds = AppSettings["roomIds"].Trim().Split(',').Where(w => !string.IsNullOrWhiteSpace(w)).Select(s => long.Parse(s)).ToArray(); + UsedProxy = bool.Parse(AppSettings["usedProxy"].Trim()); + ListenAny = bool.Parse(AppSettings["listenAny"].Trim()); var printFilter = AppSettings["printFilter"].Trim().ToLower(); if (printFilter != "all") @@ -38,9 +40,14 @@ namespace BarrageGrab { Console.WriteLine("配置文件读取失败,请检查配置文件是否正确"); throw ex; - } + } } + /// + /// 使用系统代理 + /// + public bool UsedProxy { get; private set; } = true; + /// /// 过滤的进程 /// @@ -49,7 +56,12 @@ namespace BarrageGrab /// /// 端口号 /// - public int WsProt { get; private set; } + public int WsProt { get; private set; } = 8888; + + /// + /// true:监听在0.0.0.0,接受任意Ip连接,false:监听在127.0.0.1,仅接受本机连接 + /// + public bool ListenAny { get; private set; } = true; /// /// 控制台打印消息开关