完善窗体逻辑;
添加弹幕日志; 修复房间信息获取正则表达式;
This commit is contained in:
+12
-4
@@ -10,12 +10,16 @@
|
||||
<add key="listenAny" value="true"/>
|
||||
<!--系统代理端口-->
|
||||
<add key="proxyPort" value="8827"/>
|
||||
<!--上游代理地址,例如开启了系统代理,但是需要将其他无关请求转发到VPN工具中,例如:127.0.0.1:11223,不要带http://-->
|
||||
<add key="upstreamProxy" value=""/>
|
||||
<!--上游代理地址,例如开启了系统代理,但是需要将其他无关请求转发到VPN工具中,例如:127.0.0.1:11223,不要带http://-->
|
||||
<add key="upstreamProxy" value="dgproxy.qp-cn.local:3128"/>
|
||||
<!--在控制台输出弹幕-->
|
||||
<add key="printBarrage" value="true"/>
|
||||
<!--要在控制台打印的弹幕类型,可以用','隔开 all[全部],1[普通弹幕],2[点赞消息],3[进入直播间],4[关注消息],5[礼物消息],6[统计消息],7[粉丝团消息]-->
|
||||
<add key="printFilter" value="all"/>
|
||||
<!--要在控制台打印的弹幕类型,可以用','隔开(空代表不过滤) 1[普通弹幕],2[点赞消息],3[进入直播间],4[关注消息],5[礼物消息],6[统计消息],7[粉丝团消息],8[直播间分享],9[下播]-->
|
||||
<add key="printFilter" value=""/>
|
||||
<!--要推送的弹幕消息类型,可以用','隔开,同上-->
|
||||
<add key="pushFilter" value=""/>
|
||||
<!--要日志记录的弹幕消息类型,可以用','隔开,同上-->
|
||||
<add key="logFilter" value="1,2,4,5,6,7,8"/>
|
||||
<!--是否启用系统代理,若设置为false 则需要在程序手动指定代理地址 -->
|
||||
<add key="usedProxy" value="true"/>
|
||||
<!--开启内置的域名过滤,设置为false会解包所有https请求,cpu占用很高,建议在无法获取弹幕数据时调整 -->
|
||||
@@ -26,6 +30,10 @@
|
||||
<add key="roomIds" value=""/>
|
||||
<!--隐藏控制台-->
|
||||
<add key="hideConsole" value="false"/>
|
||||
<!--弹幕文件日志-->
|
||||
<add key="barrageFileLog" value="true"/>
|
||||
<!--显示窗体-->
|
||||
<add key="showWindow" value="false"/>
|
||||
</appSettings>
|
||||
<runtime>
|
||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
|
||||
@@ -71,6 +71,11 @@ namespace BarrageGrab
|
||||
/// </summary>
|
||||
public ConcurrentDictionary<string, RoomInfo> RoomInfoCache { get; } = new ConcurrentDictionary<string, RoomInfo>();
|
||||
|
||||
/// <summary>
|
||||
/// 添加房间缓存时触发
|
||||
/// </summary>
|
||||
public event EventHandler<RoomCacheEventArgs> OnCache;
|
||||
|
||||
/// <summary>
|
||||
/// 添加WebRoomid-房间ID 映射
|
||||
/// </summary>
|
||||
@@ -84,12 +89,21 @@ namespace BarrageGrab
|
||||
}
|
||||
else
|
||||
{
|
||||
RoomInfoCache.TryAdd(roomid, new RoomInfo()
|
||||
var info = new RoomInfo()
|
||||
{
|
||||
RoomId = roomid,
|
||||
WebRoomId = webrid,
|
||||
Title = "房间" + webrid
|
||||
});
|
||||
};
|
||||
var succ = RoomInfoCache.TryAdd(roomid,info);
|
||||
if (succ)
|
||||
{
|
||||
OnCache?.Invoke(this, new RoomCacheEventArgs()
|
||||
{
|
||||
Model = 0,
|
||||
RoomInfo = info
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -105,10 +119,23 @@ namespace BarrageGrab
|
||||
if (RoomInfoCache.ContainsKey(roomid))
|
||||
{
|
||||
RoomInfoCache[roomid] = roomInfo;
|
||||
OnCache?.Invoke(this, new RoomCacheEventArgs()
|
||||
{
|
||||
Model = 1,
|
||||
RoomInfo = roomInfo
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
RoomInfoCache.TryAdd(roomid, roomInfo);
|
||||
var succ = RoomInfoCache.TryAdd(roomid, roomInfo);
|
||||
if (succ)
|
||||
{
|
||||
OnCache?.Invoke(this,new RoomCacheEventArgs()
|
||||
{
|
||||
Model = 0,
|
||||
RoomInfo = roomInfo
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -135,7 +162,17 @@ namespace BarrageGrab
|
||||
if (RoomInfoCache.TryGetValue(roomid, out value)) return value;
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public class RoomCacheEventArgs : EventArgs
|
||||
{
|
||||
public RoomInfo RoomInfo { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 0:添加,1更新,2删除
|
||||
/// </summary>
|
||||
public int Model { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,6 +6,8 @@ using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using BarrageGrab.Modles.JsonEntity;
|
||||
using static System.Configuration.ConfigurationManager;
|
||||
using System.Drawing;
|
||||
|
||||
namespace BarrageGrab
|
||||
{
|
||||
internal class Appsetting
|
||||
@@ -22,21 +24,37 @@ namespace BarrageGrab
|
||||
WsProt = int.Parse(AppSettings["wsListenPort"]);
|
||||
PrintBarrage = AppSettings["printBarrage"].ToLower() == "true";
|
||||
ProxyPort = int.Parse(AppSettings["proxyPort"]);
|
||||
PrintFilter = Enum.GetValues(typeof(PackMsgType)).Cast<int>().ToArray();
|
||||
PrintFilter = Enum.GetValues(typeof(PackMsgType)).Cast<int>().Where(w=>w>0).ToArray();
|
||||
PushFilter = Enum.GetValues(typeof(PackMsgType)).Cast<int>().Where(w => w > 0).ToArray();
|
||||
LogFilter = Enum.GetValues(typeof(PackMsgType)).Cast<int>().Where(w => w > 0).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();
|
||||
UsedProxy = bool.Parse(AppSettings["usedProxy"].Trim());
|
||||
UsedProxy = bool.Parse(AppSettings["usedProxy"].Trim());
|
||||
ListenAny = bool.Parse(AppSettings["listenAny"].Trim());
|
||||
UpstreamProxy = AppSettings["upstreamProxy"].Trim();
|
||||
HideConsole = bool.Parse(AppSettings["hideConsole"].Trim());
|
||||
BarrageLog = bool.Parse(AppSettings["barrageFileLog"].Trim());
|
||||
ShowWindow = bool.Parse(AppSettings["showWindow"].Trim());
|
||||
|
||||
var printFilter = AppSettings["printFilter"].Trim().ToLower();
|
||||
if (printFilter != "all")
|
||||
var pushFilter = AppSettings["pushFilter"].Trim().ToLower();
|
||||
var logFilter = AppSettings["logFilter"].Trim().ToLower();
|
||||
if (!string.IsNullOrWhiteSpace(printFilter))
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(printFilter)) PrintFilter = new int[0];
|
||||
else PrintFilter = printFilter.Split(',').Select(x => int.Parse(x)).ToArray();
|
||||
}
|
||||
if (!string.IsNullOrWhiteSpace(pushFilter))
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(pushFilter)) PushFilter = new int[0];
|
||||
else PushFilter = pushFilter.Split(',').Select(x => int.Parse(x)).ToArray();
|
||||
}
|
||||
if (!string.IsNullOrWhiteSpace(logFilter))
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(logFilter)) LogFilter = new int[0];
|
||||
else LogFilter = logFilter.Split(',').Select(x => int.Parse(x)).ToArray();
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@@ -45,6 +63,40 @@ namespace BarrageGrab
|
||||
}
|
||||
}
|
||||
|
||||
public void Save()
|
||||
{
|
||||
Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
|
||||
|
||||
config.AppSettings.Settings["wsListenPort"].Value = WsProt.ToString();
|
||||
config.AppSettings.Settings["printBarrage"].Value = PrintBarrage.ToString().ToLower();
|
||||
config.AppSettings.Settings["printFilter"].Value = string.Join("", PrintFilter);
|
||||
config.AppSettings.Settings["pushFilter"].Value = string.Join("", PushFilter);
|
||||
config.AppSettings.Settings["logFilter"].Value = string.Join("", LogFilter);
|
||||
config.AppSettings.Settings["upstreamProxy"].Value = UpstreamProxy;
|
||||
config.AppSettings.Settings["listenAny"].Value = ListenAny.ToString().ToLower();
|
||||
config.AppSettings.Settings["hideConsole"].Value = HideConsole.ToString().ToLower();
|
||||
config.AppSettings.Settings["barrageFileLog"].Value = HideConsole.ToString().ToLower();
|
||||
|
||||
config.Save(ConfigurationSaveMode.Modified);
|
||||
ConfigurationManager.RefreshSection(config.AppSettings.SectionInformation.Name);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 弹幕颜色映射
|
||||
/// </summary>
|
||||
public Dictionary<PackMsgType, Tuple<ConsoleColor, Color>> ColorMap = new Dictionary<PackMsgType, Tuple<ConsoleColor, Color>>()
|
||||
{
|
||||
{ PackMsgType.弹幕消息, Tuple.Create(ConsoleColor.White, Color.White) },
|
||||
{ PackMsgType.点赞消息, Tuple.Create(ConsoleColor.Cyan, Color.Cyan) },
|
||||
{ PackMsgType.进直播间, Tuple.Create(ConsoleColor.Green, Color.Green) },
|
||||
{ PackMsgType.关注消息, Tuple.Create(ConsoleColor.Yellow, Color.Yellow) },
|
||||
{ PackMsgType.礼物消息, Tuple.Create(ConsoleColor.Red, Color.Red) },
|
||||
{ PackMsgType.直播间统计, Tuple.Create(ConsoleColor.Magenta, Color.Magenta) },
|
||||
{ PackMsgType.粉丝团消息, Tuple.Create(ConsoleColor.Blue, Color.Blue) },
|
||||
{ PackMsgType.直播间分享, Tuple.Create(ConsoleColor.DarkBlue, Color.DarkBlue) },
|
||||
{ PackMsgType.下播, Tuple.Create(ConsoleColor.DarkCyan, Color.DarkCyan) }
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// 使用系统代理
|
||||
/// </summary>
|
||||
@@ -58,17 +110,17 @@ namespace BarrageGrab
|
||||
/// <summary>
|
||||
/// 端口号
|
||||
/// </summary>
|
||||
public int WsProt { get; private set; } = 8888;
|
||||
public int WsProt { get; set; } = 8888;
|
||||
|
||||
/// <summary>
|
||||
/// true:监听在0.0.0.0,接受任意Ip连接,false:监听在127.0.0.1,仅接受本机连接
|
||||
/// </summary>
|
||||
public bool ListenAny { get; private set; } = true;
|
||||
public bool ListenAny { get; set; } = true;
|
||||
|
||||
/// <summary>
|
||||
/// 控制台打印消息开关
|
||||
/// </summary>
|
||||
public bool PrintBarrage { get; private set; }
|
||||
public bool PrintBarrage { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 代理端口
|
||||
@@ -78,7 +130,17 @@ namespace BarrageGrab
|
||||
/// <summary>
|
||||
/// 控制台输出过滤器
|
||||
/// </summary>
|
||||
public int[] PrintFilter { get; private set; }
|
||||
public int[] PrintFilter { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 推送弹幕过滤器
|
||||
/// </summary>
|
||||
public int[] PushFilter { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 弹幕日志过滤器
|
||||
/// </summary>
|
||||
public int[] LogFilter { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 监听的房间号
|
||||
@@ -98,11 +160,21 @@ namespace BarrageGrab
|
||||
/// <summary>
|
||||
/// 上游代理地址
|
||||
/// </summary>
|
||||
public string UpstreamProxy { get; private set; }
|
||||
public string UpstreamProxy { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 隐藏控制台
|
||||
/// </summary>
|
||||
public bool HideConsole { get; private set; }
|
||||
public bool HideConsole { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 弹幕日志
|
||||
/// </summary>
|
||||
public bool BarrageLog { get; set; } = false;
|
||||
|
||||
/// <summary>
|
||||
/// 显示窗体
|
||||
/// </summary>
|
||||
public bool ShowWindow { get; private set; } = false;
|
||||
}
|
||||
}
|
||||
|
||||
Generated
-394
@@ -1,394 +0,0 @@
|
||||
namespace BarrageGrab
|
||||
{
|
||||
partial class FormView
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.richTextBox1 = new System.Windows.Forms.RichTextBox();
|
||||
this.cbx_bgtype_1 = new System.Windows.Forms.CheckBox();
|
||||
this.cbx_bgtype_5 = new System.Windows.Forms.CheckBox();
|
||||
this.cbx_bgtype_2 = new System.Windows.Forms.CheckBox();
|
||||
this.cbx_bgtype_3 = new System.Windows.Forms.CheckBox();
|
||||
this.cbx_bgtype_4 = new System.Windows.Forms.CheckBox();
|
||||
this.cbx_bgtype_6 = new System.Windows.Forms.CheckBox();
|
||||
this.cbx_bgtype_7 = new System.Windows.Forms.CheckBox();
|
||||
this.cbx_bgtype_8 = new System.Windows.Forms.CheckBox();
|
||||
this.cbx_bgtype_9 = new System.Windows.Forms.CheckBox();
|
||||
this.label2 = new System.Windows.Forms.Label();
|
||||
this.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel();
|
||||
this.panel1 = new System.Windows.Forms.Panel();
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.listBox1 = new System.Windows.Forms.ListBox();
|
||||
this.cbx_enableProxy = new System.Windows.Forms.CheckBox();
|
||||
this.label3 = new System.Windows.Forms.Label();
|
||||
this.panel2 = new System.Windows.Forms.Panel();
|
||||
this.panel3 = new System.Windows.Forms.Panel();
|
||||
this.label5 = new System.Windows.Forms.Label();
|
||||
this.nud_wsport = new System.Windows.Forms.NumericUpDown();
|
||||
this.cbx_loopback = new System.Windows.Forms.CheckBox();
|
||||
this.label4 = new System.Windows.Forms.Label();
|
||||
this.txb_upstreamProxy = new System.Windows.Forms.TextBox();
|
||||
this.cbx_barrageLog = new System.Windows.Forms.CheckBox();
|
||||
this.flowLayoutPanel1.SuspendLayout();
|
||||
this.panel1.SuspendLayout();
|
||||
this.panel2.SuspendLayout();
|
||||
this.panel3.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.nud_wsport)).BeginInit();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// richTextBox1
|
||||
//
|
||||
this.richTextBox1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||
this.richTextBox1.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.richTextBox1.Location = new System.Drawing.Point(15, 0);
|
||||
this.richTextBox1.Name = "richTextBox1";
|
||||
this.richTextBox1.Size = new System.Drawing.Size(715, 260);
|
||||
this.richTextBox1.TabIndex = 0;
|
||||
this.richTextBox1.Text = "";
|
||||
//
|
||||
// cbx_bgtype_1
|
||||
//
|
||||
this.cbx_bgtype_1.AutoSize = true;
|
||||
this.cbx_bgtype_1.Location = new System.Drawing.Point(3, 13);
|
||||
this.cbx_bgtype_1.Name = "cbx_bgtype_1";
|
||||
this.cbx_bgtype_1.Size = new System.Drawing.Size(59, 19);
|
||||
this.cbx_bgtype_1.TabIndex = 0;
|
||||
this.cbx_bgtype_1.Text = "消息";
|
||||
this.cbx_bgtype_1.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// cbx_bgtype_5
|
||||
//
|
||||
this.cbx_bgtype_5.AutoSize = true;
|
||||
this.cbx_bgtype_5.Location = new System.Drawing.Point(3, 38);
|
||||
this.cbx_bgtype_5.Name = "cbx_bgtype_5";
|
||||
this.cbx_bgtype_5.Size = new System.Drawing.Size(59, 19);
|
||||
this.cbx_bgtype_5.TabIndex = 1;
|
||||
this.cbx_bgtype_5.Text = "礼物";
|
||||
this.cbx_bgtype_5.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// cbx_bgtype_2
|
||||
//
|
||||
this.cbx_bgtype_2.AutoSize = true;
|
||||
this.cbx_bgtype_2.Location = new System.Drawing.Point(3, 63);
|
||||
this.cbx_bgtype_2.Name = "cbx_bgtype_2";
|
||||
this.cbx_bgtype_2.Size = new System.Drawing.Size(59, 19);
|
||||
this.cbx_bgtype_2.TabIndex = 2;
|
||||
this.cbx_bgtype_2.Text = "点赞";
|
||||
this.cbx_bgtype_2.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// cbx_bgtype_3
|
||||
//
|
||||
this.cbx_bgtype_3.AutoSize = true;
|
||||
this.cbx_bgtype_3.Location = new System.Drawing.Point(3, 88);
|
||||
this.cbx_bgtype_3.Name = "cbx_bgtype_3";
|
||||
this.cbx_bgtype_3.Size = new System.Drawing.Size(59, 19);
|
||||
this.cbx_bgtype_3.TabIndex = 3;
|
||||
this.cbx_bgtype_3.Text = "进房";
|
||||
this.cbx_bgtype_3.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// cbx_bgtype_4
|
||||
//
|
||||
this.cbx_bgtype_4.AutoSize = true;
|
||||
this.cbx_bgtype_4.Location = new System.Drawing.Point(3, 113);
|
||||
this.cbx_bgtype_4.Name = "cbx_bgtype_4";
|
||||
this.cbx_bgtype_4.Size = new System.Drawing.Size(59, 19);
|
||||
this.cbx_bgtype_4.TabIndex = 4;
|
||||
this.cbx_bgtype_4.Text = "关注";
|
||||
this.cbx_bgtype_4.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// cbx_bgtype_6
|
||||
//
|
||||
this.cbx_bgtype_6.AutoSize = true;
|
||||
this.cbx_bgtype_6.Location = new System.Drawing.Point(3, 138);
|
||||
this.cbx_bgtype_6.Name = "cbx_bgtype_6";
|
||||
this.cbx_bgtype_6.Size = new System.Drawing.Size(59, 19);
|
||||
this.cbx_bgtype_6.TabIndex = 5;
|
||||
this.cbx_bgtype_6.Text = "统计";
|
||||
this.cbx_bgtype_6.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// cbx_bgtype_7
|
||||
//
|
||||
this.cbx_bgtype_7.AutoSize = true;
|
||||
this.cbx_bgtype_7.Location = new System.Drawing.Point(3, 163);
|
||||
this.cbx_bgtype_7.Name = "cbx_bgtype_7";
|
||||
this.cbx_bgtype_7.Size = new System.Drawing.Size(59, 19);
|
||||
this.cbx_bgtype_7.TabIndex = 6;
|
||||
this.cbx_bgtype_7.Text = "粉团";
|
||||
this.cbx_bgtype_7.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// cbx_bgtype_8
|
||||
//
|
||||
this.cbx_bgtype_8.AutoSize = true;
|
||||
this.cbx_bgtype_8.Location = new System.Drawing.Point(3, 188);
|
||||
this.cbx_bgtype_8.Name = "cbx_bgtype_8";
|
||||
this.cbx_bgtype_8.Size = new System.Drawing.Size(59, 19);
|
||||
this.cbx_bgtype_8.TabIndex = 7;
|
||||
this.cbx_bgtype_8.Text = "分享";
|
||||
this.cbx_bgtype_8.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// cbx_bgtype_9
|
||||
//
|
||||
this.cbx_bgtype_9.AutoSize = true;
|
||||
this.cbx_bgtype_9.Location = new System.Drawing.Point(3, 213);
|
||||
this.cbx_bgtype_9.Name = "cbx_bgtype_9";
|
||||
this.cbx_bgtype_9.Size = new System.Drawing.Size(59, 19);
|
||||
this.cbx_bgtype_9.TabIndex = 8;
|
||||
this.cbx_bgtype_9.Text = "下播";
|
||||
this.cbx_bgtype_9.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// label2
|
||||
//
|
||||
this.label2.AutoSize = true;
|
||||
this.label2.Location = new System.Drawing.Point(839, 9);
|
||||
this.label2.Name = "label2";
|
||||
this.label2.Size = new System.Drawing.Size(105, 15);
|
||||
this.label2.TabIndex = 3;
|
||||
this.label2.Text = "🚀 代理抓取中";
|
||||
//
|
||||
// flowLayoutPanel1
|
||||
//
|
||||
this.flowLayoutPanel1.Controls.Add(this.cbx_bgtype_1);
|
||||
this.flowLayoutPanel1.Controls.Add(this.cbx_bgtype_5);
|
||||
this.flowLayoutPanel1.Controls.Add(this.cbx_bgtype_2);
|
||||
this.flowLayoutPanel1.Controls.Add(this.cbx_bgtype_3);
|
||||
this.flowLayoutPanel1.Controls.Add(this.cbx_bgtype_4);
|
||||
this.flowLayoutPanel1.Controls.Add(this.cbx_bgtype_6);
|
||||
this.flowLayoutPanel1.Controls.Add(this.cbx_bgtype_7);
|
||||
this.flowLayoutPanel1.Controls.Add(this.cbx_bgtype_8);
|
||||
this.flowLayoutPanel1.Controls.Add(this.cbx_bgtype_9);
|
||||
this.flowLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Left;
|
||||
this.flowLayoutPanel1.Location = new System.Drawing.Point(15, 0);
|
||||
this.flowLayoutPanel1.Name = "flowLayoutPanel1";
|
||||
this.flowLayoutPanel1.Padding = new System.Windows.Forms.Padding(0, 10, 0, 0);
|
||||
this.flowLayoutPanel1.Size = new System.Drawing.Size(79, 260);
|
||||
this.flowLayoutPanel1.TabIndex = 4;
|
||||
//
|
||||
// panel1
|
||||
//
|
||||
this.panel1.Controls.Add(this.flowLayoutPanel1);
|
||||
this.panel1.Controls.Add(this.richTextBox1);
|
||||
this.panel1.Dock = System.Windows.Forms.DockStyle.Bottom;
|
||||
this.panel1.Location = new System.Drawing.Point(0, 263);
|
||||
this.panel1.Name = "panel1";
|
||||
this.panel1.Padding = new System.Windows.Forms.Padding(15, 0, 5, 0);
|
||||
this.panel1.Size = new System.Drawing.Size(735, 260);
|
||||
this.panel1.TabIndex = 5;
|
||||
//
|
||||
// label1
|
||||
//
|
||||
this.label1.AutoSize = true;
|
||||
this.label1.Location = new System.Drawing.Point(249, 9);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Size = new System.Drawing.Size(37, 15);
|
||||
this.label1.TabIndex = 6;
|
||||
this.label1.Text = "配置";
|
||||
//
|
||||
// listBox1
|
||||
//
|
||||
this.listBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.listBox1.FormattingEnabled = true;
|
||||
this.listBox1.ItemHeight = 15;
|
||||
this.listBox1.Location = new System.Drawing.Point(18, 41);
|
||||
this.listBox1.Name = "listBox1";
|
||||
this.listBox1.Size = new System.Drawing.Size(228, 199);
|
||||
this.listBox1.TabIndex = 7;
|
||||
//
|
||||
// cbx_enableProxy
|
||||
//
|
||||
this.cbx_enableProxy.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.cbx_enableProxy.AutoSize = true;
|
||||
this.cbx_enableProxy.Location = new System.Drawing.Point(634, 8);
|
||||
this.cbx_enableProxy.Name = "cbx_enableProxy";
|
||||
this.cbx_enableProxy.Size = new System.Drawing.Size(89, 19);
|
||||
this.cbx_enableProxy.TabIndex = 8;
|
||||
this.cbx_enableProxy.Text = "启用抓取";
|
||||
this.cbx_enableProxy.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// label3
|
||||
//
|
||||
this.label3.AutoSize = true;
|
||||
this.label3.Location = new System.Drawing.Point(15, 9);
|
||||
this.label3.Name = "label3";
|
||||
this.label3.Size = new System.Drawing.Size(121, 15);
|
||||
this.label3.TabIndex = 9;
|
||||
this.label3.Text = "房间缓存列表(0)";
|
||||
//
|
||||
// panel2
|
||||
//
|
||||
this.panel2.Controls.Add(this.cbx_barrageLog);
|
||||
this.panel2.Controls.Add(this.panel3);
|
||||
this.panel2.Controls.Add(this.label1);
|
||||
this.panel2.Controls.Add(this.listBox1);
|
||||
this.panel2.Controls.Add(this.cbx_enableProxy);
|
||||
this.panel2.Controls.Add(this.label3);
|
||||
this.panel2.Dock = System.Windows.Forms.DockStyle.Top;
|
||||
this.panel2.Location = new System.Drawing.Point(0, 0);
|
||||
this.panel2.Name = "panel2";
|
||||
this.panel2.Size = new System.Drawing.Size(735, 257);
|
||||
this.panel2.TabIndex = 10;
|
||||
//
|
||||
// panel3
|
||||
//
|
||||
this.panel3.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.panel3.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||
this.panel3.Controls.Add(this.txb_upstreamProxy);
|
||||
this.panel3.Controls.Add(this.label5);
|
||||
this.panel3.Controls.Add(this.nud_wsport);
|
||||
this.panel3.Controls.Add(this.cbx_loopback);
|
||||
this.panel3.Controls.Add(this.label4);
|
||||
this.panel3.Location = new System.Drawing.Point(252, 41);
|
||||
this.panel3.Name = "panel3";
|
||||
this.panel3.Size = new System.Drawing.Size(471, 199);
|
||||
this.panel3.TabIndex = 13;
|
||||
//
|
||||
// label5
|
||||
//
|
||||
this.label5.AutoSize = true;
|
||||
this.label5.Cursor = System.Windows.Forms.Cursors.Arrow;
|
||||
this.label5.Location = new System.Drawing.Point(3, 64);
|
||||
this.label5.Name = "label5";
|
||||
this.label5.Size = new System.Drawing.Size(112, 15);
|
||||
this.label5.TabIndex = 13;
|
||||
this.label5.Text = "上游代理地址:";
|
||||
//
|
||||
// nud_wsport
|
||||
//
|
||||
this.nud_wsport.Location = new System.Drawing.Point(113, 16);
|
||||
this.nud_wsport.Maximum = new decimal(new int[] {
|
||||
65534,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
this.nud_wsport.Minimum = new decimal(new int[] {
|
||||
1000,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
this.nud_wsport.Name = "nud_wsport";
|
||||
this.nud_wsport.Size = new System.Drawing.Size(84, 25);
|
||||
this.nud_wsport.TabIndex = 11;
|
||||
this.nud_wsport.Value = new decimal(new int[] {
|
||||
1000,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
//
|
||||
// cbx_loopback
|
||||
//
|
||||
this.cbx_loopback.AutoSize = true;
|
||||
this.cbx_loopback.Location = new System.Drawing.Point(219, 19);
|
||||
this.cbx_loopback.Name = "cbx_loopback";
|
||||
this.cbx_loopback.Size = new System.Drawing.Size(74, 19);
|
||||
this.cbx_loopback.TabIndex = 12;
|
||||
this.cbx_loopback.Text = "仅回环";
|
||||
this.cbx_loopback.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// label4
|
||||
//
|
||||
this.label4.AutoSize = true;
|
||||
this.label4.Location = new System.Drawing.Point(9, 21);
|
||||
this.label4.Name = "label4";
|
||||
this.label4.Size = new System.Drawing.Size(98, 15);
|
||||
this.label4.TabIndex = 10;
|
||||
this.label4.Text = "WS服务端口:";
|
||||
//
|
||||
// txb_upstreamProxy
|
||||
//
|
||||
this.txb_upstreamProxy.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||
this.txb_upstreamProxy.Location = new System.Drawing.Point(113, 60);
|
||||
this.txb_upstreamProxy.Name = "txb_upstreamProxy";
|
||||
this.txb_upstreamProxy.Size = new System.Drawing.Size(180, 25);
|
||||
this.txb_upstreamProxy.TabIndex = 14;
|
||||
//
|
||||
// cbx_barrageLog
|
||||
//
|
||||
this.cbx_barrageLog.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.cbx_barrageLog.AutoSize = true;
|
||||
this.cbx_barrageLog.Location = new System.Drawing.Point(532, 8);
|
||||
this.cbx_barrageLog.Name = "cbx_barrageLog";
|
||||
this.cbx_barrageLog.Size = new System.Drawing.Size(89, 19);
|
||||
this.cbx_barrageLog.TabIndex = 14;
|
||||
this.cbx_barrageLog.Text = "弹幕日志";
|
||||
this.cbx_barrageLog.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// FormView
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 15F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(735, 523);
|
||||
this.Controls.Add(this.panel2);
|
||||
this.Controls.Add(this.panel1);
|
||||
this.Controls.Add(this.label2);
|
||||
this.MaximizeBox = false;
|
||||
this.Name = "FormView";
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
|
||||
this.Text = "FormView";
|
||||
this.flowLayoutPanel1.ResumeLayout(false);
|
||||
this.flowLayoutPanel1.PerformLayout();
|
||||
this.panel1.ResumeLayout(false);
|
||||
this.panel2.ResumeLayout(false);
|
||||
this.panel2.PerformLayout();
|
||||
this.panel3.ResumeLayout(false);
|
||||
this.panel3.PerformLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.nud_wsport)).EndInit();
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.RichTextBox richTextBox1;
|
||||
private System.Windows.Forms.CheckBox cbx_bgtype_5;
|
||||
private System.Windows.Forms.CheckBox cbx_bgtype_1;
|
||||
private System.Windows.Forms.CheckBox cbx_bgtype_6;
|
||||
private System.Windows.Forms.CheckBox cbx_bgtype_4;
|
||||
private System.Windows.Forms.CheckBox cbx_bgtype_3;
|
||||
private System.Windows.Forms.CheckBox cbx_bgtype_2;
|
||||
private System.Windows.Forms.CheckBox cbx_bgtype_7;
|
||||
private System.Windows.Forms.CheckBox cbx_bgtype_9;
|
||||
private System.Windows.Forms.CheckBox cbx_bgtype_8;
|
||||
private System.Windows.Forms.Label label2;
|
||||
private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel1;
|
||||
private System.Windows.Forms.Panel panel1;
|
||||
private System.Windows.Forms.Label label1;
|
||||
private System.Windows.Forms.ListBox listBox1;
|
||||
private System.Windows.Forms.CheckBox cbx_enableProxy;
|
||||
private System.Windows.Forms.Label label3;
|
||||
private System.Windows.Forms.Panel panel2;
|
||||
private System.Windows.Forms.Label label4;
|
||||
private System.Windows.Forms.Panel panel3;
|
||||
private System.Windows.Forms.Label label5;
|
||||
private System.Windows.Forms.NumericUpDown nud_wsport;
|
||||
private System.Windows.Forms.CheckBox cbx_loopback;
|
||||
private System.Windows.Forms.TextBox txb_upstreamProxy;
|
||||
private System.Windows.Forms.CheckBox cbx_barrageLog;
|
||||
}
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace BarrageGrab
|
||||
{
|
||||
public partial class FormView : Form
|
||||
{
|
||||
public FormView()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
Generated
+373
@@ -0,0 +1,373 @@
|
||||
namespace BarrageGrab
|
||||
{
|
||||
partial class FormView
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.rich_output = new System.Windows.Forms.RichTextBox();
|
||||
this.label2 = new System.Windows.Forms.Label();
|
||||
this.panel1 = new System.Windows.Forms.Panel();
|
||||
this.tab_filters = new System.Windows.Forms.TabControl();
|
||||
this.tabPage_Console = new System.Windows.Forms.TabPage();
|
||||
this.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel();
|
||||
this.tabPage_Ws = new System.Windows.Forms.TabPage();
|
||||
this.flowLayoutPanel2 = new System.Windows.Forms.FlowLayoutPanel();
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.list_roomCaches = new System.Windows.Forms.ListBox();
|
||||
this.cbx_enableProxy = new System.Windows.Forms.CheckBox();
|
||||
this.label3 = new System.Windows.Forms.Label();
|
||||
this.panel2 = new System.Windows.Forms.Panel();
|
||||
this.cbx_barrageLog = new System.Windows.Forms.CheckBox();
|
||||
this.panel3 = new System.Windows.Forms.Panel();
|
||||
this.btn_updateUpProxy = new System.Windows.Forms.Button();
|
||||
this.txb_upstreamProxy = new System.Windows.Forms.TextBox();
|
||||
this.label5 = new System.Windows.Forms.Label();
|
||||
this.label4 = new System.Windows.Forms.Label();
|
||||
this.txb_wsaddr = new System.Windows.Forms.TextBox();
|
||||
this.tabPage_Log = new System.Windows.Forms.TabPage();
|
||||
this.flowLayoutPanel3 = new System.Windows.Forms.FlowLayoutPanel();
|
||||
this.panel1.SuspendLayout();
|
||||
this.tab_filters.SuspendLayout();
|
||||
this.tabPage_Console.SuspendLayout();
|
||||
this.tabPage_Ws.SuspendLayout();
|
||||
this.panel2.SuspendLayout();
|
||||
this.panel3.SuspendLayout();
|
||||
this.tabPage_Log.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// rich_output
|
||||
//
|
||||
this.rich_output.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.rich_output.BackColor = System.Drawing.SystemColors.Desktop;
|
||||
this.rich_output.BorderStyle = System.Windows.Forms.BorderStyle.None;
|
||||
this.rich_output.Location = new System.Drawing.Point(90, 0);
|
||||
this.rich_output.Margin = new System.Windows.Forms.Padding(2);
|
||||
this.rich_output.Name = "rich_output";
|
||||
this.rich_output.ReadOnly = true;
|
||||
this.rich_output.Size = new System.Drawing.Size(592, 271);
|
||||
this.rich_output.TabIndex = 0;
|
||||
this.rich_output.Text = "";
|
||||
//
|
||||
// label2
|
||||
//
|
||||
this.label2.AutoSize = true;
|
||||
this.label2.Location = new System.Drawing.Point(629, 7);
|
||||
this.label2.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
|
||||
this.label2.Name = "label2";
|
||||
this.label2.Size = new System.Drawing.Size(83, 12);
|
||||
this.label2.TabIndex = 3;
|
||||
this.label2.Text = "🚀 代理抓取中";
|
||||
//
|
||||
// panel1
|
||||
//
|
||||
this.panel1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.panel1.Controls.Add(this.tab_filters);
|
||||
this.panel1.Controls.Add(this.rich_output);
|
||||
this.panel1.Location = new System.Drawing.Point(0, 202);
|
||||
this.panel1.Margin = new System.Windows.Forms.Padding(2);
|
||||
this.panel1.Name = "panel1";
|
||||
this.panel1.Padding = new System.Windows.Forms.Padding(0, 0, 5, 10);
|
||||
this.panel1.Size = new System.Drawing.Size(687, 281);
|
||||
this.panel1.TabIndex = 5;
|
||||
//
|
||||
// tab_filters
|
||||
//
|
||||
this.tab_filters.Alignment = System.Windows.Forms.TabAlignment.Left;
|
||||
this.tab_filters.Controls.Add(this.tabPage_Console);
|
||||
this.tab_filters.Controls.Add(this.tabPage_Ws);
|
||||
this.tab_filters.Controls.Add(this.tabPage_Log);
|
||||
this.tab_filters.Dock = System.Windows.Forms.DockStyle.Left;
|
||||
this.tab_filters.Location = new System.Drawing.Point(0, 0);
|
||||
this.tab_filters.Multiline = true;
|
||||
this.tab_filters.Name = "tab_filters";
|
||||
this.tab_filters.SelectedIndex = 0;
|
||||
this.tab_filters.Size = new System.Drawing.Size(89, 271);
|
||||
this.tab_filters.TabIndex = 10;
|
||||
//
|
||||
// tabPage_Console
|
||||
//
|
||||
this.tabPage_Console.Controls.Add(this.flowLayoutPanel1);
|
||||
this.tabPage_Console.Font = new System.Drawing.Font("SimSun", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
this.tabPage_Console.Location = new System.Drawing.Point(22, 4);
|
||||
this.tabPage_Console.Name = "tabPage_Console";
|
||||
this.tabPage_Console.Padding = new System.Windows.Forms.Padding(3);
|
||||
this.tabPage_Console.RightToLeft = System.Windows.Forms.RightToLeft.No;
|
||||
this.tabPage_Console.Size = new System.Drawing.Size(63, 263);
|
||||
this.tabPage_Console.TabIndex = 0;
|
||||
this.tabPage_Console.Text = "控制台";
|
||||
//
|
||||
// flowLayoutPanel1
|
||||
//
|
||||
this.flowLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.flowLayoutPanel1.Location = new System.Drawing.Point(3, 3);
|
||||
this.flowLayoutPanel1.Margin = new System.Windows.Forms.Padding(2);
|
||||
this.flowLayoutPanel1.Name = "flowLayoutPanel1";
|
||||
this.flowLayoutPanel1.Size = new System.Drawing.Size(57, 257);
|
||||
this.flowLayoutPanel1.TabIndex = 5;
|
||||
//
|
||||
// tabPage_Ws
|
||||
//
|
||||
this.tabPage_Ws.Controls.Add(this.flowLayoutPanel2);
|
||||
this.tabPage_Ws.Location = new System.Drawing.Point(22, 4);
|
||||
this.tabPage_Ws.Name = "tabPage_Ws";
|
||||
this.tabPage_Ws.Padding = new System.Windows.Forms.Padding(3);
|
||||
this.tabPage_Ws.Size = new System.Drawing.Size(63, 263);
|
||||
this.tabPage_Ws.TabIndex = 1;
|
||||
this.tabPage_Ws.Text = "推送 ";
|
||||
//
|
||||
// flowLayoutPanel2
|
||||
//
|
||||
this.flowLayoutPanel2.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.flowLayoutPanel2.Location = new System.Drawing.Point(3, 3);
|
||||
this.flowLayoutPanel2.Margin = new System.Windows.Forms.Padding(2);
|
||||
this.flowLayoutPanel2.Name = "flowLayoutPanel2";
|
||||
this.flowLayoutPanel2.Padding = new System.Windows.Forms.Padding(0, 8, 0, 0);
|
||||
this.flowLayoutPanel2.Size = new System.Drawing.Size(57, 257);
|
||||
this.flowLayoutPanel2.TabIndex = 6;
|
||||
//
|
||||
// label1
|
||||
//
|
||||
this.label1.AutoSize = true;
|
||||
this.label1.Location = new System.Drawing.Point(248, 7);
|
||||
this.label1.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Size = new System.Drawing.Size(29, 12);
|
||||
this.label1.TabIndex = 6;
|
||||
this.label1.Text = "配置";
|
||||
//
|
||||
// list_roomCaches
|
||||
//
|
||||
this.list_roomCaches.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.list_roomCaches.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||
this.list_roomCaches.FormattingEnabled = true;
|
||||
this.list_roomCaches.ItemHeight = 12;
|
||||
this.list_roomCaches.Location = new System.Drawing.Point(14, 33);
|
||||
this.list_roomCaches.Margin = new System.Windows.Forms.Padding(2);
|
||||
this.list_roomCaches.Name = "list_roomCaches";
|
||||
this.list_roomCaches.Size = new System.Drawing.Size(232, 158);
|
||||
this.list_roomCaches.TabIndex = 7;
|
||||
this.list_roomCaches.DoubleClick += new System.EventHandler(this.list_roomCaches_DoubleClick);
|
||||
//
|
||||
// cbx_enableProxy
|
||||
//
|
||||
this.cbx_enableProxy.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.cbx_enableProxy.AutoSize = true;
|
||||
this.cbx_enableProxy.Location = new System.Drawing.Point(558, 6);
|
||||
this.cbx_enableProxy.Margin = new System.Windows.Forms.Padding(2);
|
||||
this.cbx_enableProxy.Name = "cbx_enableProxy";
|
||||
this.cbx_enableProxy.Size = new System.Drawing.Size(120, 16);
|
||||
this.cbx_enableProxy.TabIndex = 8;
|
||||
this.cbx_enableProxy.Text = "启用系统代理抓取";
|
||||
this.cbx_enableProxy.UseVisualStyleBackColor = true;
|
||||
this.cbx_enableProxy.CheckedChanged += new System.EventHandler(this.cbx_enableProxy_CheckedChanged);
|
||||
//
|
||||
// label3
|
||||
//
|
||||
this.label3.AutoSize = true;
|
||||
this.label3.Location = new System.Drawing.Point(11, 7);
|
||||
this.label3.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
|
||||
this.label3.Name = "label3";
|
||||
this.label3.Size = new System.Drawing.Size(95, 12);
|
||||
this.label3.TabIndex = 9;
|
||||
this.label3.Text = "房间缓存列表(0)";
|
||||
//
|
||||
// panel2
|
||||
//
|
||||
this.panel2.Controls.Add(this.cbx_barrageLog);
|
||||
this.panel2.Controls.Add(this.panel3);
|
||||
this.panel2.Controls.Add(this.label1);
|
||||
this.panel2.Controls.Add(this.list_roomCaches);
|
||||
this.panel2.Controls.Add(this.cbx_enableProxy);
|
||||
this.panel2.Controls.Add(this.label3);
|
||||
this.panel2.Dock = System.Windows.Forms.DockStyle.Top;
|
||||
this.panel2.Location = new System.Drawing.Point(0, 0);
|
||||
this.panel2.Margin = new System.Windows.Forms.Padding(2);
|
||||
this.panel2.Name = "panel2";
|
||||
this.panel2.Padding = new System.Windows.Forms.Padding(0, 0, 0, 10);
|
||||
this.panel2.Size = new System.Drawing.Size(687, 198);
|
||||
this.panel2.TabIndex = 10;
|
||||
//
|
||||
// cbx_barrageLog
|
||||
//
|
||||
this.cbx_barrageLog.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.cbx_barrageLog.AutoSize = true;
|
||||
this.cbx_barrageLog.Location = new System.Drawing.Point(477, 6);
|
||||
this.cbx_barrageLog.Margin = new System.Windows.Forms.Padding(2);
|
||||
this.cbx_barrageLog.Name = "cbx_barrageLog";
|
||||
this.cbx_barrageLog.Size = new System.Drawing.Size(72, 16);
|
||||
this.cbx_barrageLog.TabIndex = 14;
|
||||
this.cbx_barrageLog.Text = "弹幕日志";
|
||||
this.cbx_barrageLog.UseVisualStyleBackColor = true;
|
||||
this.cbx_barrageLog.CheckedChanged += new System.EventHandler(this.cbx_barrageLog_CheckedChanged);
|
||||
//
|
||||
// panel3
|
||||
//
|
||||
this.panel3.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.panel3.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||
this.panel3.Controls.Add(this.txb_wsaddr);
|
||||
this.panel3.Controls.Add(this.btn_updateUpProxy);
|
||||
this.panel3.Controls.Add(this.txb_upstreamProxy);
|
||||
this.panel3.Controls.Add(this.label5);
|
||||
this.panel3.Controls.Add(this.label4);
|
||||
this.panel3.Location = new System.Drawing.Point(250, 33);
|
||||
this.panel3.Margin = new System.Windows.Forms.Padding(2);
|
||||
this.panel3.Name = "panel3";
|
||||
this.panel3.Size = new System.Drawing.Size(429, 159);
|
||||
this.panel3.TabIndex = 13;
|
||||
//
|
||||
// btn_updateUpProxy
|
||||
//
|
||||
this.btn_updateUpProxy.Location = new System.Drawing.Point(254, 48);
|
||||
this.btn_updateUpProxy.Name = "btn_updateUpProxy";
|
||||
this.btn_updateUpProxy.Size = new System.Drawing.Size(64, 23);
|
||||
this.btn_updateUpProxy.TabIndex = 15;
|
||||
this.btn_updateUpProxy.Text = "确定";
|
||||
this.btn_updateUpProxy.UseVisualStyleBackColor = true;
|
||||
this.btn_updateUpProxy.Click += new System.EventHandler(this.btn_updateUpProxy_Click);
|
||||
//
|
||||
// txb_upstreamProxy
|
||||
//
|
||||
this.txb_upstreamProxy.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||
this.txb_upstreamProxy.Location = new System.Drawing.Point(85, 48);
|
||||
this.txb_upstreamProxy.Margin = new System.Windows.Forms.Padding(2);
|
||||
this.txb_upstreamProxy.Name = "txb_upstreamProxy";
|
||||
this.txb_upstreamProxy.Size = new System.Drawing.Size(164, 21);
|
||||
this.txb_upstreamProxy.TabIndex = 14;
|
||||
//
|
||||
// label5
|
||||
//
|
||||
this.label5.AutoSize = true;
|
||||
this.label5.Cursor = System.Windows.Forms.Cursors.Arrow;
|
||||
this.label5.Location = new System.Drawing.Point(18, 52);
|
||||
this.label5.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
|
||||
this.label5.Name = "label5";
|
||||
this.label5.Size = new System.Drawing.Size(65, 12);
|
||||
this.label5.TabIndex = 13;
|
||||
this.label5.Text = "上游代理:";
|
||||
//
|
||||
// label4
|
||||
//
|
||||
this.label4.AutoSize = true;
|
||||
this.label4.Location = new System.Drawing.Point(7, 17);
|
||||
this.label4.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
|
||||
this.label4.Name = "label4";
|
||||
this.label4.Size = new System.Drawing.Size(77, 12);
|
||||
this.label4.TabIndex = 10;
|
||||
this.label4.Text = "WS服务端口:";
|
||||
//
|
||||
// txb_wsaddr
|
||||
//
|
||||
this.txb_wsaddr.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||
this.txb_wsaddr.Location = new System.Drawing.Point(85, 14);
|
||||
this.txb_wsaddr.Margin = new System.Windows.Forms.Padding(2);
|
||||
this.txb_wsaddr.Name = "txb_wsaddr";
|
||||
this.txb_wsaddr.ReadOnly = true;
|
||||
this.txb_wsaddr.Size = new System.Drawing.Size(164, 21);
|
||||
this.txb_wsaddr.TabIndex = 16;
|
||||
//
|
||||
// tabPage_Log
|
||||
//
|
||||
this.tabPage_Log.Controls.Add(this.flowLayoutPanel3);
|
||||
this.tabPage_Log.Location = new System.Drawing.Point(22, 4);
|
||||
this.tabPage_Log.Name = "tabPage_Log";
|
||||
this.tabPage_Log.Size = new System.Drawing.Size(63, 263);
|
||||
this.tabPage_Log.TabIndex = 2;
|
||||
this.tabPage_Log.Text = "日志 ";
|
||||
this.tabPage_Log.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// flowLayoutPanel3
|
||||
//
|
||||
this.flowLayoutPanel3.BackColor = System.Drawing.SystemColors.Control;
|
||||
this.flowLayoutPanel3.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.flowLayoutPanel3.Location = new System.Drawing.Point(0, 0);
|
||||
this.flowLayoutPanel3.Margin = new System.Windows.Forms.Padding(2);
|
||||
this.flowLayoutPanel3.Name = "flowLayoutPanel3";
|
||||
this.flowLayoutPanel3.Padding = new System.Windows.Forms.Padding(0, 8, 0, 0);
|
||||
this.flowLayoutPanel3.Size = new System.Drawing.Size(63, 263);
|
||||
this.flowLayoutPanel3.TabIndex = 7;
|
||||
//
|
||||
// FormView
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(687, 483);
|
||||
this.Controls.Add(this.panel2);
|
||||
this.Controls.Add(this.panel1);
|
||||
this.Controls.Add(this.label2);
|
||||
this.Margin = new System.Windows.Forms.Padding(2);
|
||||
this.MaximizeBox = false;
|
||||
this.Name = "FormView";
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
|
||||
this.Text = "抖音弹幕抓取推送";
|
||||
this.Load += new System.EventHandler(this.FormView_Load);
|
||||
this.panel1.ResumeLayout(false);
|
||||
this.tab_filters.ResumeLayout(false);
|
||||
this.tabPage_Console.ResumeLayout(false);
|
||||
this.tabPage_Ws.ResumeLayout(false);
|
||||
this.panel2.ResumeLayout(false);
|
||||
this.panel2.PerformLayout();
|
||||
this.panel3.ResumeLayout(false);
|
||||
this.panel3.PerformLayout();
|
||||
this.tabPage_Log.ResumeLayout(false);
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.RichTextBox rich_output;
|
||||
private System.Windows.Forms.Label label2;
|
||||
private System.Windows.Forms.Panel panel1;
|
||||
private System.Windows.Forms.Label label1;
|
||||
private System.Windows.Forms.ListBox list_roomCaches;
|
||||
private System.Windows.Forms.CheckBox cbx_enableProxy;
|
||||
private System.Windows.Forms.Label label3;
|
||||
private System.Windows.Forms.Panel panel2;
|
||||
private System.Windows.Forms.Label label4;
|
||||
private System.Windows.Forms.Panel panel3;
|
||||
private System.Windows.Forms.Label label5;
|
||||
private System.Windows.Forms.TextBox txb_upstreamProxy;
|
||||
private System.Windows.Forms.CheckBox cbx_barrageLog;
|
||||
private System.Windows.Forms.TabControl tab_filters;
|
||||
private System.Windows.Forms.TabPage tabPage_Console;
|
||||
private System.Windows.Forms.TabPage tabPage_Ws;
|
||||
private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel2;
|
||||
private System.Windows.Forms.Button btn_updateUpProxy;
|
||||
private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel1;
|
||||
private System.Windows.Forms.TextBox txb_wsaddr;
|
||||
private System.Windows.Forms.TabPage tabPage_Log;
|
||||
private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel3;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,238 @@
|
||||
using BarrageGrab.Forms;
|
||||
using BarrageGrab.Forms.Models;
|
||||
using BarrageGrab.Modles.JsonEntity;
|
||||
using BarrageGrab.Proxy;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace BarrageGrab
|
||||
{
|
||||
public partial class FormView : Form
|
||||
{
|
||||
static int printCount = 0;
|
||||
|
||||
WsBarrageService barServer = AppRuntime.WssService;
|
||||
WssBarrageGrab grab = AppRuntime.WssService.Grab;
|
||||
ISystemProxy proxy = AppRuntime.WssService.Grab.Proxy;
|
||||
|
||||
public FormView()
|
||||
{
|
||||
InitializeComponent();
|
||||
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()
|
||||
{
|
||||
var msgTypes = GetMsgTypes();
|
||||
foreach (TabPage page in this.tab_filters.TabPages)
|
||||
{
|
||||
page.Padding = new Padding(0)
|
||||
{
|
||||
Left = 5
|
||||
};
|
||||
page.Margin = new Padding(0);
|
||||
foreach (Control control in page.Controls)
|
||||
{
|
||||
var panel = control as FlowLayoutPanel;
|
||||
if (panel == null) continue;
|
||||
panel.Padding = new Padding(0);
|
||||
panel.Margin = new Padding(0);
|
||||
|
||||
foreach (var label in msgTypes)
|
||||
{
|
||||
var ck = new CheckBox()
|
||||
{
|
||||
Text = label.Value,
|
||||
Tag = label.Key,
|
||||
Parent = panel,
|
||||
Padding = new Padding(0),
|
||||
Margin = new Padding(0)
|
||||
};
|
||||
string type = "console";
|
||||
if (page == this.tabPage_Ws)
|
||||
{
|
||||
type = "ws";
|
||||
ck.Checked = Appsetting.Current.PushFilter.Contains(label.Key);
|
||||
}
|
||||
if (page == this.tabPage_Console)
|
||||
{
|
||||
type = "console";
|
||||
ck.Checked = Appsetting.Current.PrintFilter.Contains(label.Key);
|
||||
}
|
||||
if (page == this.tabPage_Log)
|
||||
{
|
||||
type = "log";
|
||||
ck.Checked = Appsetting.Current.LogFilter.Contains(label.Key);
|
||||
}
|
||||
ck.Name = $"cbx_bartype_{type}_{label.Key}";
|
||||
ck.CheckedChanged += Ck_CheckedChanged;
|
||||
panel.Controls.Add(ck);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void Ck_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
CheckBox cbx = sender as CheckBox;
|
||||
if (cbx == null) return;
|
||||
var selected = GetCheckedBarTypes((FlowLayoutPanel)cbx.Parent);
|
||||
if (cbx.Parent.Parent == this.tabPage_Console)
|
||||
{
|
||||
Appsetting.Current.PrintFilter = selected;
|
||||
}
|
||||
if (cbx.Parent.Parent == this.tabPage_Ws)
|
||||
{
|
||||
Appsetting.Current.PushFilter = selected;
|
||||
}
|
||||
if(cbx.Parent.Parent == this.tabPage_Log)
|
||||
{
|
||||
Appsetting.Current.LogFilter = selected;
|
||||
}
|
||||
Appsetting.Current.Save();
|
||||
}
|
||||
|
||||
private int[] GetCheckedBarTypes(FlowLayoutPanel panel)
|
||||
{
|
||||
List<int> list = new List<int>();
|
||||
foreach (Control ctr in panel.Controls)
|
||||
{
|
||||
var cbk = ctr as CheckBox;
|
||||
if (cbk == null) continue;
|
||||
if (cbk.Checked && cbk.Name.StartsWith("cbx_bartype_"))
|
||||
{
|
||||
list.Add((int)cbk.Tag);
|
||||
}
|
||||
}
|
||||
return list.OrderBy(o => o).ToArray();
|
||||
}
|
||||
|
||||
private Dictionary<int,string> GetMsgTypes()
|
||||
{
|
||||
var dic = new Dictionary<int, string>();
|
||||
Type enumType = typeof(PackMsgType);
|
||||
FieldInfo[] fields = enumType.GetFields(BindingFlags.Public | BindingFlags.Static);
|
||||
foreach (var field in fields)
|
||||
{
|
||||
DescriptionAttribute attribute = (DescriptionAttribute)field.GetCustomAttribute(typeof(DescriptionAttribute), false);
|
||||
int value = (int)field.GetValue(null);
|
||||
if (attribute != null && value>0)
|
||||
{
|
||||
dic.Add(value, attribute.Description);
|
||||
}
|
||||
}
|
||||
|
||||
return dic;
|
||||
}
|
||||
|
||||
private void RoomCaches_OnCache(object sender, AppRuntime.RoomCacheManager.RoomCacheEventArgs e)
|
||||
{
|
||||
this.Invoke(new Action(() =>
|
||||
{
|
||||
if (e.Model == 0)
|
||||
{
|
||||
var item = new RoomCacheItem(e.RoomInfo);
|
||||
this.label3.Text = $"房间缓存列表({AppRuntime.RoomCaches.RoomInfoCache.Count})";
|
||||
list_roomCaches.Items.Add(item);
|
||||
}
|
||||
}));
|
||||
}
|
||||
|
||||
private void FormView_Load(object sender, EventArgs e)
|
||||
{
|
||||
this.cbx_enableProxy.Checked = SystemProxy.ProxyIsOpen();
|
||||
}
|
||||
|
||||
private void Proxy_OnProxyStatus(object sender, Proxy.ProxyEventArgs.SystemProxyChangeEventArgs e)
|
||||
{
|
||||
if (this.Disposing || this.IsDisposed) return;
|
||||
this.Invoke(new Action(() =>
|
||||
{
|
||||
this.cbx_enableProxy.Checked = e.Open;
|
||||
}));
|
||||
}
|
||||
|
||||
private void WssService_OnPrint(object sender, WsBarrageService.PrintEventArgs e)
|
||||
{
|
||||
//将弹幕输出到richTextBox
|
||||
//颜色转换
|
||||
Color color = Appsetting.Current.ColorMap[e.MsgType].Item2;
|
||||
string msg = e.Message;
|
||||
|
||||
this.Invoke(new Action(() =>
|
||||
{
|
||||
//输出到richTextBox
|
||||
this.rich_output.SelectionColor = color;
|
||||
this.rich_output.AppendText(msg + "\n");
|
||||
this.rich_output.ScrollToCaret();
|
||||
}));
|
||||
|
||||
if (++printCount > 10000)
|
||||
{
|
||||
this.rich_output.Clear();
|
||||
printCount = 0;
|
||||
}
|
||||
}
|
||||
|
||||
private void cbx_enableProxy_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
var checker = (CheckBox)sender;
|
||||
if (checker.Checked)
|
||||
{
|
||||
barServer.Grab.Proxy.RegisterSystemProxy();
|
||||
}
|
||||
else
|
||||
{
|
||||
barServer.Grab.Proxy.CloseSystemProxy();
|
||||
}
|
||||
}
|
||||
|
||||
private void list_roomCaches_DoubleClick(object sender, EventArgs e)
|
||||
{
|
||||
// 获取双击的 ListBox 中的选中项
|
||||
var selectedItem = list_roomCaches.SelectedItem as RoomCacheItem;
|
||||
if (selectedItem == null) return;
|
||||
|
||||
var form = new RoomDetail(selectedItem.RoomInfo);
|
||||
form.ShowDialog();
|
||||
}
|
||||
|
||||
private void btn_updateUpProxy_Click(object sender, EventArgs e)
|
||||
{
|
||||
var text = this.txb_upstreamProxy.Text;
|
||||
try
|
||||
{
|
||||
proxy.SetUpstreamProxy(text);
|
||||
Appsetting.Current.UpstreamProxy = text;
|
||||
Appsetting.Current.Save();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
//弹窗提示错误
|
||||
MessageBox.Show(ex.Message,"设置失败");
|
||||
}
|
||||
}
|
||||
|
||||
private void cbx_barrageLog_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
var checker = (CheckBox)sender;
|
||||
Appsetting.Current.BarrageLog = checker.Checked;
|
||||
Appsetting.Current.Save();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
using BarrageGrab.Modles;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace BarrageGrab.Forms.Models
|
||||
{
|
||||
internal class RoomCacheItem
|
||||
{
|
||||
public RoomCacheItem(RoomInfo info)
|
||||
{
|
||||
this.RoomInfo = info;
|
||||
}
|
||||
/// <summary>
|
||||
/// 数据对象
|
||||
/// </summary>
|
||||
public RoomInfo RoomInfo { get; set; }
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
if (RoomInfo == null) return "NULL";
|
||||
return $"({RoomInfo.WebRoomId}){RoomInfo?.Owner?.Nickname??"-1"}";
|
||||
}
|
||||
}
|
||||
}
|
||||
Generated
+80
@@ -0,0 +1,80 @@
|
||||
namespace BarrageGrab.Forms
|
||||
{
|
||||
partial class RoomDetail
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.textBox1 = new System.Windows.Forms.TextBox();
|
||||
this.button1 = new System.Windows.Forms.Button();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// textBox1
|
||||
//
|
||||
this.textBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.textBox1.Location = new System.Drawing.Point(12, 12);
|
||||
this.textBox1.Multiline = true;
|
||||
this.textBox1.Name = "textBox1";
|
||||
this.textBox1.ReadOnly = true;
|
||||
this.textBox1.ScrollBars = System.Windows.Forms.ScrollBars.Both;
|
||||
this.textBox1.Size = new System.Drawing.Size(332, 246);
|
||||
this.textBox1.TabIndex = 0;
|
||||
//
|
||||
// button1
|
||||
//
|
||||
this.button1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.button1.Location = new System.Drawing.Point(12, 277);
|
||||
this.button1.Name = "button1";
|
||||
this.button1.Size = new System.Drawing.Size(75, 23);
|
||||
this.button1.TabIndex = 1;
|
||||
this.button1.Text = "复制";
|
||||
this.button1.UseVisualStyleBackColor = true;
|
||||
this.button1.Click += new System.EventHandler(this.button1_Click);
|
||||
//
|
||||
// RoomDetail
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(356, 312);
|
||||
this.Controls.Add(this.button1);
|
||||
this.Controls.Add(this.textBox1);
|
||||
this.Name = "RoomDetail";
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
|
||||
this.Text = "房间数据";
|
||||
this.Load += new System.EventHandler(this.RoomDetail_Load);
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.TextBox textBox1;
|
||||
private System.Windows.Forms.Button button1;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
using BarrageGrab.Modles;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace BarrageGrab.Forms
|
||||
{
|
||||
public partial class RoomDetail : Form
|
||||
{
|
||||
public RoomDetail(RoomInfo info)
|
||||
{
|
||||
InitializeComponent();
|
||||
//小驼峰
|
||||
var json = JsonConvert.SerializeObject(info,Formatting.Indented,new JsonSerializerSettings()
|
||||
{
|
||||
ContractResolver = new Newtonsoft.Json.Serialization.CamelCasePropertyNamesContractResolver()
|
||||
});
|
||||
|
||||
this.textBox1.Text = json;
|
||||
}
|
||||
|
||||
private void RoomDetail_Load(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void button1_Click(object sender, EventArgs e)
|
||||
{
|
||||
//复制到剪切板
|
||||
Clipboard.SetText(this.textBox1.Text);
|
||||
MessageBox.Show("复制成功");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
||||
+60
-1
@@ -4,11 +4,13 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using NLog;
|
||||
using BarrageGrab.Modles.JsonEntity;
|
||||
using System.IO;
|
||||
|
||||
namespace BarrageGrab
|
||||
{
|
||||
public static class Logger
|
||||
{
|
||||
{
|
||||
private static NLog.Config.ISetupBuilder builder = LogManager.Setup().LoadConfigurationFromFile("nlog.config");
|
||||
|
||||
private static readonly NLog.Logger logger = builder.GetLogger("*");
|
||||
@@ -53,5 +55,62 @@ namespace BarrageGrab
|
||||
{
|
||||
logger.Fatal(ex, message);
|
||||
}
|
||||
|
||||
public static void LogBarrage(PackMsgType type, Msg msg)
|
||||
{
|
||||
if (!Appsetting.Current.BarrageLog) return;
|
||||
if (type == PackMsgType.无) return;
|
||||
if (Appsetting.Current.LogFilter.Any() && !Appsetting.Current.LogFilter.Contains(type.GetHashCode())) return;
|
||||
|
||||
try
|
||||
{
|
||||
var dir = Path.Combine(AppContext.BaseDirectory, "logs", "弹幕日志");
|
||||
var room = AppRuntime.RoomCaches.GetCachedWebRoomInfo(msg.RoomId.ToString());
|
||||
var date = DateTime.Now.ToString("yyyy年MM月dd日直播");
|
||||
dir = Path.Combine(dir, $"({room.WebRoomId}){room?.Owner?.Nickname ?? "-1"}", date);
|
||||
if (!Directory.Exists(dir))
|
||||
{
|
||||
Directory.CreateDirectory(dir);
|
||||
}
|
||||
var path = Path.Combine(dir, type + ".txt");
|
||||
if (!File.Exists(path))
|
||||
{
|
||||
File.Create(path).Close();
|
||||
}
|
||||
var writer = new StreamWriter(path, true, Encoding.UTF8);
|
||||
var line = LogText(msg, type);
|
||||
writer.WriteLine(line);
|
||||
writer.Close();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogWarn("弹幕日志写入失败," + ex.Message);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private static string LogText(Msg msg, PackMsgType barType)
|
||||
{
|
||||
var rinfo = AppRuntime.RoomCaches.GetCachedWebRoomInfo(msg.RoomId.ToString());
|
||||
var text = $"{DateTime.Now.ToString("HH:mm:ss")} [{barType}]";
|
||||
|
||||
if (msg.User != null)
|
||||
{
|
||||
text += $" [{msg.User?.GenderToString()}] ";
|
||||
}
|
||||
|
||||
ConsoleColor color = Appsetting.Current.ColorMap[barType].Item1;
|
||||
var append = msg.Content;
|
||||
switch (barType)
|
||||
{
|
||||
case PackMsgType.弹幕消息: append = $"{msg?.User?.Nickname}: {msg.Content}"; break;
|
||||
case PackMsgType.下播: append = $"直播已结束"; break;
|
||||
default: break;
|
||||
}
|
||||
|
||||
text += append;
|
||||
return text;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,19 +1,31 @@
|
||||
namespace BarrageGrab.Modles.JsonEntity
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace BarrageGrab.Modles.JsonEntity
|
||||
{
|
||||
/// <summary>
|
||||
/// 弹幕消息类型
|
||||
/// </summary>
|
||||
public enum PackMsgType
|
||||
{
|
||||
无 = 0,
|
||||
[Description("无")]
|
||||
无 = 0,
|
||||
[Description("消息")]
|
||||
弹幕消息 = 1,
|
||||
[Description("点赞")]
|
||||
点赞消息 = 2,
|
||||
[Description("进房")]
|
||||
进直播间 = 3,
|
||||
[Description("关注")]
|
||||
关注消息 = 4,
|
||||
[Description("礼物")]
|
||||
礼物消息 = 5,
|
||||
[Description("统计")]
|
||||
直播间统计 = 6,
|
||||
[Description("粉团")]
|
||||
粉丝团消息 = 7,
|
||||
[Description("分享")]
|
||||
直播间分享 = 8,
|
||||
[Description("下播")]
|
||||
下播 = 9
|
||||
}
|
||||
|
||||
|
||||
@@ -519,7 +519,8 @@ namespace BarrageGrab.Modles
|
||||
}
|
||||
//var roomDataReg = new Regex(@"(?<=self\.__pace_f\.push\(\[1,""a:)\[.+?\](?=\\n?""\]\)[\s\n\r]*?<\/script>)");
|
||||
//var roomDataReg = new Regex(@"(?<=self\.__pace_f\.push\(\[1,\s*""0:)\[.+?\](?=\\n""?\]\)[\s\n\r]*?<\/script>)");
|
||||
var roomDataReg = new Regex(@"(?<=self\.__pace_f\.push\(\[1,\s*""9:)\[.+?\](?=\\n""?\]\)[\s\n\r]*?<\/script>)");
|
||||
//var roomDataReg = new Regex(@"(?<=self\.__pace_f\.push\(\[1,\s*""9:)\[.+?\](?=\\n""?\]\)[\s\n\r]*?<\/script>)");
|
||||
var roomDataReg = new Regex(@"(?<=self\.__pace_f\.push\(\[\d,\s*""\w:.+)\{\\""state.+?\}(?=\]\\n""\]\)[\s\n\r]*?<\/script>)");
|
||||
//字符串转义符号版本
|
||||
|
||||
var match = roomDataReg.Match(html);
|
||||
@@ -530,10 +531,10 @@ namespace BarrageGrab.Modles
|
||||
}
|
||||
var matchData = Regex.Unescape(match.Value);
|
||||
|
||||
JToken jsonObject = null;
|
||||
JObject jsonObject = null;
|
||||
try
|
||||
{
|
||||
jsonObject = JsonConvert.DeserializeObject<JArray>(matchData)[3];
|
||||
jsonObject = JObject.Parse(matchData);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
+32
-4
@@ -12,7 +12,7 @@ namespace BarrageGrab
|
||||
public class Program
|
||||
{
|
||||
static void Main(string[] args)
|
||||
{
|
||||
{
|
||||
if (CheckAlreadyRunning())
|
||||
{
|
||||
Console.WriteLine("已经有一个监听程序在运行,按任意键退出...");
|
||||
@@ -24,15 +24,31 @@ namespace BarrageGrab
|
||||
WinApi.DisableQuickEditMode();//禁用控制台快速编辑模式
|
||||
Console.Title = "抖音弹幕监听推送";
|
||||
AppRuntime.DisplayConsole(!Appsetting.Current.HideConsole);
|
||||
AppRuntime.WssService.Grab.Proxy.SetUpstreamProxy(Appsetting.Current.UpstreamProxy);
|
||||
|
||||
bool exited = false;
|
||||
bool formExited = false;
|
||||
AppRuntime.WssService.StartListen();
|
||||
|
||||
Console.ForegroundColor = ConsoleColor.Green;
|
||||
Console.WriteLine($"{AppRuntime.WssService.ServerLocation} 弹幕服务已启动...");
|
||||
Console.ForegroundColor = ConsoleColor.Gray;
|
||||
Console.Title = $"抖音弹幕监听推送 [{AppRuntime.WssService.ServerLocation}]";
|
||||
|
||||
FormView mainForm = null;
|
||||
|
||||
if (Appsetting.Current.ShowWindow)
|
||||
{
|
||||
var uiThread = new Thread(new ThreadStart(() =>
|
||||
{
|
||||
mainForm = new FormView();
|
||||
//开启消息循环
|
||||
System.Windows.Forms.Application.Run(mainForm);
|
||||
formExited = true;
|
||||
}));
|
||||
uiThread.SetApartmentState(ApartmentState.STA);
|
||||
uiThread.IsBackground = true;
|
||||
uiThread.Start();
|
||||
}
|
||||
|
||||
AppRuntime.WssService.OnClose += (s, e) =>
|
||||
{
|
||||
@@ -42,13 +58,25 @@ namespace BarrageGrab
|
||||
|
||||
while (!exited)
|
||||
{
|
||||
if (formExited && !exited)
|
||||
{
|
||||
AppRuntime.WssService.Close();
|
||||
}
|
||||
Thread.Sleep(500);
|
||||
}
|
||||
|
||||
Console.WriteLine("服务器已关闭...");
|
||||
|
||||
|
||||
//if (!mainForm.IsDisposed)
|
||||
//{
|
||||
// mainForm.Invoke(new Action(() =>
|
||||
// {
|
||||
// mainForm.Close();
|
||||
// }));
|
||||
//}
|
||||
|
||||
//退出程序,不显示 按任意键退出
|
||||
Environment.Exit(0);
|
||||
//Environment.Exit(0);
|
||||
}
|
||||
|
||||
private static WinApi.ControlCtrlDelegate cancelHandler = new WinApi.ControlCtrlDelegate((CtrlType) =>
|
||||
|
||||
@@ -11,6 +11,23 @@ namespace BarrageGrab.Proxy
|
||||
|
||||
event EventHandler<HttpResponseEventArgs> OnFetchResponse;
|
||||
|
||||
event EventHandler<SystemProxyChangeEventArgs> OnProxyStatus;
|
||||
|
||||
/// <summary>
|
||||
/// Http上游代理地址
|
||||
/// </summary>
|
||||
string HttpUpstreamProxy { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Https 上游代理地址
|
||||
/// </summary>
|
||||
string HttpsUpstreamProxy { get; }
|
||||
|
||||
/// <summary>
|
||||
/// 设置上游代理地址(http+https)
|
||||
/// </summary>
|
||||
void SetUpstreamProxy(string addr);
|
||||
|
||||
/// <summary>
|
||||
/// 关闭系统代理
|
||||
/// </summary>
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace BarrageGrab.Proxy.ProxyEventArgs
|
||||
{
|
||||
public class SystemProxyChangeEventArgs:EventArgs
|
||||
{
|
||||
/// <summary>
|
||||
/// True 以开启:False: 已关闭
|
||||
/// </summary>
|
||||
public bool Open { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,6 +31,10 @@ namespace BarrageGrab.Proxy
|
||||
const string BARRAGE_POOL_PATH = "/webcast/im/fetch";
|
||||
static ConsoleWriter console = new ConsoleWriter();
|
||||
|
||||
public override string HttpUpstreamProxy { get { return proxyServer?.UpStreamHttpProxy?.ToString()??""; } }
|
||||
|
||||
public override string HttpsUpstreamProxy { get { return proxyServer?.UpStreamHttpsProxy?.ToString()??""; } }
|
||||
|
||||
public TitaniumProxy()
|
||||
{
|
||||
//注册系统代理
|
||||
@@ -47,10 +51,28 @@ namespace BarrageGrab.Proxy
|
||||
{
|
||||
Console.WriteLine("正在进行证书安装,需要安装证书才可进行https解密,若有提示请确定");
|
||||
proxyServer.CertificateManager.CreateRootCertificate();
|
||||
}
|
||||
}
|
||||
|
||||
proxyServer.ServerCertificateValidationCallback += ProxyServer_ServerCertificateValidationCallback;
|
||||
proxyServer.BeforeResponse += ProxyServer_BeforeResponse;
|
||||
//proxyServer.AfterResponse += ProxyServer_AfterResponse;
|
||||
|
||||
explicitEndPoint = new ExplicitProxyEndPoint(IPAddress.Any, ProxyPort, true);
|
||||
explicitEndPoint.BeforeTunnelConnectRequest += ExplicitEndPoint_BeforeTunnelConnectRequest;
|
||||
proxyServer.AddEndPoint(explicitEndPoint);
|
||||
}
|
||||
|
||||
public override void SetUpstreamProxy(string upstreamProxyAddr)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(upstreamProxyAddr)) return;
|
||||
upstreamProxyAddr = upstreamProxyAddr.Trim();
|
||||
var reg = new Regex(@"[a-zA-Z0-9\.]+:\d+");
|
||||
if(!reg.IsMatch(upstreamProxyAddr))
|
||||
{
|
||||
throw new Exception("上游代理地址格式不正确,必须为ip:port格式");
|
||||
}
|
||||
//设置上游代理地址
|
||||
var upstreamProxyAddr = Appsetting.Current.UpstreamProxy;
|
||||
//var upstreamProxyAddr = Appsetting.Current.UpstreamProxy;
|
||||
if (!upstreamProxyAddr.IsNullOrWhiteSpace())
|
||||
{
|
||||
upStreamProxy = new ExternalProxy()
|
||||
@@ -62,15 +84,6 @@ namespace BarrageGrab.Proxy
|
||||
proxyServer.UpStreamHttpProxy = upStreamProxy;
|
||||
proxyServer.UpStreamHttpsProxy = upStreamProxy;
|
||||
}
|
||||
|
||||
proxyServer.ServerCertificateValidationCallback += ProxyServer_ServerCertificateValidationCallback;
|
||||
proxyServer.BeforeResponse += ProxyServer_BeforeResponse;
|
||||
//proxyServer.AfterResponse += ProxyServer_AfterResponse;
|
||||
|
||||
|
||||
explicitEndPoint = new ExplicitProxyEndPoint(IPAddress.Any, ProxyPort, true);
|
||||
explicitEndPoint.BeforeTunnelConnectRequest += ExplicitEndPoint_BeforeTunnelConnectRequest;
|
||||
proxyServer.AddEndPoint(explicitEndPoint);
|
||||
}
|
||||
|
||||
private async Task ProxyServer_BeforeResponse(object sender, SessionEventArgs e)
|
||||
|
||||
@@ -16,6 +16,7 @@ using System.IO.Compression;
|
||||
using System.IO;
|
||||
using BarrageGrab.Modles.JsonEntity;
|
||||
using BarrageGrab.Modles.ProtoEntity;
|
||||
using System.Drawing;
|
||||
|
||||
namespace BarrageGrab
|
||||
{
|
||||
@@ -23,7 +24,7 @@ namespace BarrageGrab
|
||||
/// 弹幕服务
|
||||
/// </summary>
|
||||
public class WsBarrageService
|
||||
{
|
||||
{
|
||||
WebSocketServer socketServer;
|
||||
Dictionary<string, UserState> socketList = new Dictionary<string, UserState>();
|
||||
//礼物计数缓存
|
||||
@@ -45,6 +46,16 @@ namespace BarrageGrab
|
||||
/// </summary>
|
||||
public string ServerLocation { get { return socketServer.Location; } }
|
||||
|
||||
/// <summary>
|
||||
/// 数据内核
|
||||
/// </summary>
|
||||
public WssBarrageGrab Grab { get { return grab; } }
|
||||
|
||||
/// <summary>
|
||||
/// 控制台打印事件
|
||||
/// </summary>
|
||||
public event EventHandler<PrintEventArgs> OnPrint;
|
||||
|
||||
public WsBarrageService()
|
||||
{
|
||||
#if DEBUG
|
||||
@@ -128,10 +139,7 @@ namespace BarrageGrab
|
||||
|
||||
static int count = 0;
|
||||
private void PrintMsg(Msg msg, PackMsgType barType)
|
||||
{
|
||||
if (!Appsetting.PrintBarrage) return;
|
||||
if (Appsetting.Current.PrintFilter.Any() && !Appsetting.Current.PrintFilter.Contains(barType.GetHashCode())) return;
|
||||
|
||||
{
|
||||
var rinfo = AppRuntime.RoomCaches.GetCachedWebRoomInfo(msg.RoomId.ToString());
|
||||
var roomName = (rinfo?.Owner?.Nickname ?? ("直播间" + (msg.WebRoomId == 0 ? msg.RoomId : msg.WebRoomId)));
|
||||
var text = $"{DateTime.Now.ToString("HH:mm:ss")} [{roomName}] [{barType}]";
|
||||
@@ -141,30 +149,39 @@ namespace BarrageGrab
|
||||
text += $" [{msg.User?.GenderToString()}] ";
|
||||
}
|
||||
|
||||
ConsoleColor color = ConsoleColor.White;
|
||||
ConsoleColor color = Appsetting.Current.ColorMap[barType].Item1;
|
||||
var append = msg.Content;
|
||||
switch (barType)
|
||||
{
|
||||
case PackMsgType.弹幕消息: color = ConsoleColor.White; append = $"{msg?.User?.Nickname}: {msg.Content}"; break;
|
||||
case PackMsgType.点赞消息: color = ConsoleColor.Cyan; break;
|
||||
case PackMsgType.进直播间: color = ConsoleColor.Green; break;
|
||||
case PackMsgType.关注消息: color = ConsoleColor.Yellow; break;
|
||||
case PackMsgType.礼物消息: color = ConsoleColor.Red; break;
|
||||
case PackMsgType.直播间统计: color = ConsoleColor.Magenta; break;
|
||||
case PackMsgType.粉丝团消息: color = ConsoleColor.Blue; break;
|
||||
case PackMsgType.直播间分享: color = ConsoleColor.DarkBlue; break;
|
||||
case PackMsgType.下播: color = ConsoleColor.DarkCyan; append = $"直播已结束"; break;
|
||||
case PackMsgType.弹幕消息:append = $"{msg?.User?.Nickname}: {msg.Content}"; break;
|
||||
case PackMsgType.下播:append = $"直播已结束"; break;
|
||||
default: break;
|
||||
}
|
||||
|
||||
text += append;
|
||||
|
||||
if (Appsetting.Current.BarrageLog)
|
||||
{
|
||||
Logger.LogBarrage(barType, msg);
|
||||
}
|
||||
|
||||
if (!Appsetting.PrintBarrage) return;
|
||||
if (Appsetting.Current.PrintFilter.Any() && !Appsetting.Current.PrintFilter.Contains(barType.GetHashCode())) return;
|
||||
|
||||
OnPrint?.Invoke(this, new PrintEventArgs()
|
||||
{
|
||||
Color = color,
|
||||
Message = text,
|
||||
MsgType = barType
|
||||
});
|
||||
|
||||
if (++count > 10000)
|
||||
{
|
||||
Console.Clear();
|
||||
Console.WriteLine("控制台已清理");
|
||||
count = 0;
|
||||
}
|
||||
console.WriteLine(text + "\n", color);
|
||||
console.WriteLine(text + "\n", color);
|
||||
}
|
||||
|
||||
//粉丝团
|
||||
@@ -528,6 +545,8 @@ namespace BarrageGrab
|
||||
public void Broadcast(BarrageMsgPack pack)
|
||||
{
|
||||
if (pack == null) return;
|
||||
if (Appsetting.Current.PushFilter.Any() && !Appsetting.Current.PushFilter.Contains(pack.Type.GetHashCode())) return;
|
||||
|
||||
var offLines = new List<string>();
|
||||
foreach (var item in socketList)
|
||||
{
|
||||
@@ -588,5 +607,14 @@ namespace BarrageGrab
|
||||
Socket = socket;
|
||||
}
|
||||
}
|
||||
|
||||
public class PrintEventArgs : EventArgs
|
||||
{
|
||||
public string Message { get; set; }
|
||||
|
||||
public ConsoleColor Color { get; set; }
|
||||
|
||||
public PackMsgType MsgType { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -280,7 +280,7 @@ namespace BarrageGrab
|
||||
break;
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
catch (Exception ex)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -139,12 +139,19 @@
|
||||
<ItemGroup>
|
||||
<Compile Include="AppRuntime.cs" />
|
||||
<Compile Include="Appsetting.cs" />
|
||||
<Compile Include="FormView.cs">
|
||||
<Compile Include="Forms\FormView.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="FormView.Designer.cs">
|
||||
<Compile Include="Forms\FormView.Designer.cs">
|
||||
<DependentUpon>FormView.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Forms\Models\RoomCacheItem.cs" />
|
||||
<Compile Include="Forms\RoomDetail.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Forms\RoomDetail.Designer.cs">
|
||||
<DependentUpon>RoomDetail.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Logger.cs" />
|
||||
<Compile Include="Modles\BusinessExecption.cs" />
|
||||
<Compile Include="Modles\JsonEntity\BarrageMessages.cs" />
|
||||
@@ -153,8 +160,9 @@
|
||||
<Compile Include="Modles\ProtoEntity\Wss.cs" />
|
||||
<Compile Include="Modles\RoomInfo.cs" />
|
||||
<Compile Include="ObjectExtension.cs" />
|
||||
<Compile Include="Proxy\EventArgs\HttpResponseEventArgs.cs" />
|
||||
<Compile Include="Proxy\EventArgs\WsMessageEventArgs.cs" />
|
||||
<Compile Include="Proxy\ProxyEventArgs\HttpResponseEventArgs.cs" />
|
||||
<Compile Include="Proxy\ProxyEventArgs\SystemProxyChangeEventArgs.cs" />
|
||||
<Compile Include="Proxy\ProxyEventArgs\WsMessageEventArgs.cs" />
|
||||
<Compile Include="Proxy\ISystemProxy.cs" />
|
||||
<Compile Include="Program.cs" />
|
||||
<Compile Include="Proxy\SystemProxy.cs" />
|
||||
@@ -190,9 +198,12 @@
|
||||
</BootstrapperPackage>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="FormView.resx">
|
||||
<EmbeddedResource Include="Forms\FormView.resx">
|
||||
<DependentUpon>FormView.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Forms\RoomDetail.resx">
|
||||
<DependentUpon>RoomDetail.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
||||
Reference in New Issue
Block a user