添加更多指令支持;

添加Form页面
This commit is contained in:
小白猿
2023-11-14 20:29:18 +08:00
parent 3c090e0e91
commit ba46b2e533
13 changed files with 693 additions and 21 deletions
+2
View File
@@ -24,6 +24,8 @@
<add key="hostNameFilter" value="" />
<!--要进行过滤的房间ID,不填代表监听所有,多项使用','分隔,浏览器进入直播间 F12 控制台输入 'window.localStorage.playRoom' 即可快速看到房间ID(不是地址栏中的那个) -->
<add key="roomIds" value="" />
<!--隐藏控制台-->
<add key="hideConsole" value="false" />
</appSettings>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
+7 -1
View File
@@ -29,6 +29,7 @@ namespace BarrageGrab
UsedProxy = bool.Parse(AppSettings["usedProxy"].Trim());
ListenAny = bool.Parse(AppSettings["listenAny"].Trim());
UpstreamProxy = AppSettings["upstreamProxy"].Trim();
HideConsole = bool.Parse(AppSettings["hideConsole"].Trim());
var printFilter = AppSettings["printFilter"].Trim().ToLower();
if (printFilter != "all")
@@ -97,6 +98,11 @@ namespace BarrageGrab
/// <summary>
/// 上游代理地址
/// </summary>
public string UpstreamProxy { get; set; }
public string UpstreamProxy { get; private set; }
/// <summary>
/// 隐藏控制台
/// </summary>
public bool HideConsole { get; private set; }
}
}
+394
View File
@@ -0,0 +1,394 @@
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;
}
}
+20
View File
@@ -0,0 +1,20 @@
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();
}
}
}
+120
View File
@@ -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>
+15
View File
@@ -6,6 +6,11 @@ using System.Threading.Tasks;
namespace BarrageGrab.Modles.JsonEntity
{
/*
* 例如发送 {"Cmd":1,"Data":true} 到ws连接地址 关闭程序
* 前往 http://wstool.jackxiang.com/ 在线ws测试
*/
public enum CommandCode
{
/// <summary>
@@ -17,6 +22,16 @@ namespace BarrageGrab.Modles.JsonEntity
/// 安全关闭程序
/// </summary>
Close = 1,
/// <summary>
/// 启用系统代理 Data:bool
/// </summary>
EnableProxy = 2,
/// <summary>
/// 是否显示控制台 Data:bool
/// </summary>
DisplayConsole = 3,
}
public class Command
+9
View File
@@ -24,6 +24,15 @@ namespace BarrageGrab
WinApi.DisableQuickEditMode();//禁用控制台快速编辑模式
Console.Title = "抖音弹幕监听推送";
if(Appsetting.Current.HideConsole)
{
var hWnd = WinApi.FindWindow(null, Console.Title);
if (hWnd != IntPtr.Zero)
{
WinApi.ShowWindow(hWnd,WinApi.CmdShow.SW_HIDE);
}
}
bool exited = false;
AppRuntime.WssService.StartListen();
AppRuntime.WssService.OnClose += (s, e) =>
+11 -1
View File
@@ -5,12 +5,22 @@ using BarrageGrab.Proxy.ProxyEventArgs;
namespace BarrageGrab.Proxy
{
internal interface ISystemProxy : IDisposable
public interface ISystemProxy : IDisposable
{
event EventHandler<WsMessageEventArgs> OnWebSocketData;
event EventHandler<HttpResponseEventArgs> OnFetchResponse;
/// <summary>
/// 关闭系统代理
/// </summary>
void CloseSystemProxy();
/// <summary>
/// 注册为系统代理
/// </summary>
void RegisterSystemProxy();
/// <summary>
/// 开始监听
/// </summary>
+3 -3
View File
@@ -91,9 +91,9 @@ namespace BarrageGrab.Proxy
}
/// <summary>
/// 注册系统代理
/// 注册为系统代理
/// </summary>
protected void RegisterSystemProxy()
public void RegisterSystemProxy()
{
RegistryKey registry = Registry.CurrentUser.OpenSubKey("Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings", true);
registry.SetValue("ProxyEnable", 1);
@@ -103,7 +103,7 @@ namespace BarrageGrab.Proxy
/// <summary>
/// 关闭系统代理
/// </summary>
protected void CloseSystemProxy()
public void CloseSystemProxy()
{
RegistryKey registry = Registry.CurrentUser.OpenSubKey("Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings", true);
registry.SetValue("ProxyEnable", 0);
+58
View File
@@ -29,6 +29,16 @@ namespace BarrageGrab
[DllImport("kernel32.dll", SetLastError = true)]
internal static extern bool SetConsoleMode(IntPtr hConsoleHandle, uint mode);
///If the function fails, the return value is NULL.</returns>
[DllImport("user32.dll")]
public static extern IntPtr FindWindow(string lpClassName, string lpWindowName);
[DllImport("User32.dll", EntryPoint = "ShowWindow")]
public static extern bool ShowWindow(IntPtr hWnd, CmdShow nCmdShow);
/// <summary>
/// 启用控制台快速编辑
/// </summary>
@@ -52,5 +62,53 @@ namespace BarrageGrab
mode &= ~ENABLE_QUICK_EDIT_MODE;
SetConsoleMode(hStdin, mode);
}
public enum CmdShow : int
{
SW_HIDE = 0,
SW_SHOWNORMAL = 1,
SW_SHOWMINIMIZED = 2,
/// <summary>
/// Activates the window and displays it as a maximized window.
/// </summary>
SW_SHOWMAXIMIZED = 3,
/// <summary>
/// Displays a window in its most recent size and position. This value is similar to SW_SHOWNORMAL, except that the window is not activated.
/// </summary>
SW_SHOWNOACTIVATE = 4,
/// <summary>
/// Activates the window and displays it in its current size and position.
/// </summary>
SW_SHOW = 5,
/// <summary>
/// Minimizes the specified window and activates the next top-level window in the Z order.
/// </summary>
SW_MINIMIZE = 6,
/// <summary>
/// Displays the window as a minimized window. This value is similar to SW_SHOWMINIMIZED, except the window is not activated.
/// </summary>
SW_SHOWMINNOACTIVE = 7,
/// <summary>
/// Displays the window in its current size and position. This value is similar to SW_SHOW, except that the window is not activated.
/// </summary>
SW_SHOWNA = 8,
/// <summary>
/// Activates and displays the window. If the window is minimized or maximized, the system restores it to its original size and position. An application should specify this flag when restoring a minimized window.
/// </summary>
SW_RESTORE = 9,
/// <summary>
/// Sets the show state based on the SW_ value specified in the STARTUPINFO structure passed to the CreateProcess function by the program that started the application.
/// </summary>
SW_SHOWDEFAULT = 10,
/// <summary>
/// Minimizes a window, even if the thread that owns the window is not responding. This flag should only be used when minimizing windows from a different thread.
/// </summary>
SW_FORCEMINIMIZE = 11
}
}
}
+23 -3
View File
@@ -19,7 +19,6 @@ using BarrageGrab.Modles.ProtoEntity;
namespace BarrageGrab
{
/// <summary>
/// 弹幕服务
/// </summary>
@@ -181,7 +180,7 @@ namespace BarrageGrab
var msgType = PackMsgType.粉丝团消息;
PrintMsg(enty, msgType);
Broadcast(new BarrageMsgPack(enty.ToJson(), msgType,e.Process));
Broadcast(new BarrageMsgPack(enty.ToJson(), msgType, e.Process));
}
//统计消息
@@ -479,9 +478,30 @@ namespace BarrageGrab
var cmdPack = JsonConvert.DeserializeObject<Command>(message);
if (cmdPack == null) return;
if (cmdPack.Cmd == CommandCode.Close)
switch (cmdPack.Cmd)
{
case CommandCode.Close:
this.Close();
break;
case CommandCode.EnableProxy:
{
var enable = (bool)cmdPack.Data;
if (enable)
this.grab.Proxy.RegisterSystemProxy();
else
this.grab.Proxy.CloseSystemProxy();
break;
}
case CommandCode.DisplayConsole:
{
var display = (bool)cmdPack.Data;
var hand = WinApi.FindWindow(null, Console.Title);
if (hand != IntPtr.Zero)
{
WinApi.ShowWindow(hand, display ? WinApi.CmdShow.SW_SHOW : WinApi.CmdShow.SW_HIDE);
}
break;
}
}
}
catch (Exception) { }
+5
View File
@@ -65,6 +65,11 @@ namespace BarrageGrab
/// </summary>
public event EventHandler<RoomMessageEventArgs<FansclubMessage>> OnFansclubMessage;
/// <summary>
/// 代理
/// </summary>
public ISystemProxy Proxy { get => proxy; }
public WssBarrageGrab()
{
proxy.OnWebSocketData += Proxy_OnWebSocketData;
+13
View File
@@ -102,6 +102,7 @@
</Reference>
<Reference Include="System.Configuration" />
<Reference Include="System.Core" />
<Reference Include="System.Drawing" />
<Reference Include="System.IO.Compression" />
<Reference Include="System.Memory, Version=4.0.1.2, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Memory.4.5.5\lib\net461\System.Memory.dll</HintPath>
@@ -123,6 +124,7 @@
<HintPath>..\packages\System.Threading.Tasks.Extensions.4.5.4\lib\net461\System.Threading.Tasks.Extensions.dll</HintPath>
</Reference>
<Reference Include="System.Web.Extensions" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
@@ -136,6 +138,12 @@
<ItemGroup>
<Compile Include="AppRuntime.cs" />
<Compile Include="Appsetting.cs" />
<Compile Include="FormView.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="FormView.Designer.cs">
<DependentUpon>FormView.cs</DependentUpon>
</Compile>
<Compile Include="JsonEntity\Command.cs" />
<Compile Include="Logger.cs" />
<Compile Include="Modles\BusinessExecption.cs" />
@@ -182,5 +190,10 @@
<Install>false</Install>
</BootstrapperPackage>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="FormView.resx">
<DependentUpon>FormView.cs</DependentUpon>
</EmbeddedResource>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>