Compare commits

..

60 Commits
2.35 ... 2.42

Author SHA1 Message Date
2dust
ea1a471c42 Update AssemblyInfo.cs 2019-09-30 10:11:53 +08:00
2dust
6043d74bd0 Update MainForm.cs 2019-09-30 10:11:50 +08:00
2dust
1bd2944074 Update BaseForm.cs 2019-09-30 10:11:48 +08:00
2dust
02a3b25963 up 2019-09-24 08:10:27 +08:00
2dust
cfb93a9ff2 Update PACServerHandle.cs 2019-09-23 22:02:20 +08:00
2dust
1943757f43 remove pacB 2019-09-23 17:23:39 +08:00
2dust
f41fe6d7a3 Update HttpWebServerB.cs 2019-09-22 18:54:34 +08:00
2dust
b53ce37b0a Update PACServerHandle.cs 2019-09-22 18:54:30 +08:00
2dust
9fd56605f9 Update StatisticsHandler.cs 2019-09-20 13:36:42 +08:00
2dust
19ad24c2d5 Update PACServerHandle.cs 2019-09-20 13:18:43 +08:00
2dust
1dc1d4dccd Update StatisticsHandler.cs 2019-09-20 13:18:38 +08:00
2dust
a4174805f6 Merge pull request #80 from Undefined-User/dev
fix PAC
2019-09-20 07:53:29 +08:00
Undefined
aa5f00e67b fix PAC 2019-09-19 15:41:30 +08:00
2dust
b921dd3610 Update AssemblyInfo.cs 2019-09-18 13:37:25 +08:00
2dust
1526b2435a Update PACServerHandle.cs 2019-09-18 13:37:22 +08:00
2dust
486b0920af Update HttpWebServerB.cs 2019-09-18 13:37:20 +08:00
2dust
59a6e1862c Update HttpWebServer.cs 2019-09-18 13:37:16 +08:00
2dust
8ddddb66df Update HttpWebServerB.cs 2019-09-11 11:24:09 +08:00
2dust
55d540d556 Update HttpWebServer.cs 2019-09-11 11:24:07 +08:00
2dust
a2cf1cef16 fix ui 2019-09-11 09:42:58 +08:00
2dust
01fdb08dd3 up tls 2019-09-11 09:23:33 +08:00
2dust
a8f1a992c5 Update MainForm.cs 2019-09-02 11:08:19 +08:00
2dust
1bbc73f963 Update ListViewFlickerFree.cs 2019-09-02 11:08:15 +08:00
2dust
2676ce0357 up 2019-09-01 20:14:02 +08:00
2dust
b22bb90d2d fix state 2019-08-30 16:24:43 +08:00
2dust
d0ca8b2996 up grpc state 2019-08-30 10:22:28 +08:00
2dust
3154df1bde Update StatisticsHandler.cs 2019-08-29 17:30:44 +08:00
2dust
3cdff624ba Merge pull request #46 from CGQAQ/dev
try 放在循环内,有异常不会退出循环。捕获漏网之鱼(syste.memory.dll)
2019-08-28 13:14:06 +08:00
CGQAQ
3cd80a20bb try 放在循环内,有异常不会退出循环。有个漏网之鱼(syste.memory.dll) 2019-08-28 09:43:29 +08:00
2dust
8986a96100 Merge pull request #45 from CGQAQ/dev
只能先这样了
2019-08-28 08:05:49 +08:00
CGQAQ
612ad30660 2019-08-27 18:40:15 +08:00
CGQAQ
bc6517626e 只能先这样了
grpc_csharp_ext.x86.dll 和 grpc_csharp_ext.x64dll 没办法引用,所有只能放到output目录里了
2019-08-27 18:29:41 +08:00
2dust
99e9425942 Merge pull request #44 from CGQAQ/dev
统计切换为grpc
2019-08-27 15:58:21 +08:00
CGQAQ
d555081820 统计切换为grpc 2019-08-27 15:51:15 +08:00
2dust
a3f42e1e25 Merge pull request #43 from CGQAQ/dev
去重加入host
2019-08-27 13:06:58 +08:00
CGQAQ
52b31fba1e delete useless code due to remove auto reboot 2019-08-27 12:17:58 +08:00
CGQAQ
328c0be6e9 Update Utils.cs 2019-08-27 12:16:18 +08:00
CGQAQ
65d2db55f8 Merge remote-tracking branch 'upstream/master' into dev 2019-08-27 12:10:28 +08:00
2dust
54bebd9a6b up speed 2019-08-27 09:02:20 +08:00
2dust
dcd050eee1 Update v2rayN.csproj 2019-08-26 17:32:17 +08:00
2dust
7d5dcc307e up 2019-08-26 17:31:19 +08:00
CGQAQ
7459ada9c0 去重加入host
现在判定两个server是不是一样的要看address port path 和 host
2019-08-26 17:20:49 +08:00
2dust
f9c3003cc9 Merge pull request #40 from CGQAQ/master
一些修改
2019-08-26 16:26:09 +08:00
CGQAQ
c1354600c7 一些修改
1. 需要重启的设置保存会自动重启
2. 去重逻辑更新 address port path
3. 一些重构和小修改
2019-08-26 16:21:08 +08:00
2dust
86b45d18af Merge pull request #39 from CGQAQ/master
修复v2rayN有几率无法退出问题
2019-08-26 13:41:38 +08:00
CGQAQ
26c9cd4d27 Update StatisticsHandler.cs
如果调用kill的时候进程已经退出,就会导致v2rayN程序无法退出,先判断该进程是否已经退出再kill,修复该问题
2019-08-26 13:37:52 +08:00
2dust
1be22a1a2c Merge pull request #36 from CGQAQ/master
【新功能】实时网速显示和历史流量统计,测速快捷键
2019-08-26 13:06:41 +08:00
CGQAQ
83e7ad9360 fix infinite loop thread hang there causes v2rayN hang in the background
修复死循环线程导致v2rayN在用户点击退出仍挂在后台
2019-08-26 09:32:45 +08:00
CGQAQ
fe015b0227 fix number may exceed 1024
修复网速可能超过1024的问题,比如1500 Byte 应该是 1.x KB
2019-08-25 23:30:00 +08:00
CGQAQ
2861bff5a0 Add one click deduplicate feature
添加一键删除重复服务器功能
2019-08-25 22:43:28 +08:00
CGQAQ
f036f12925 Update Utils.cs 2019-08-25 10:07:51 +08:00
CGQAQ
56bb63a012 add Statistics(netspeed, traffic data amount) 2019-08-25 09:33:38 +08:00
CGQAQ
f1e9737080 basically completed 2019-08-24 21:32:33 +08:00
CGQAQ
649f0af6ec add Hotkeys
添加测速快捷键
2019-08-23 18:07:25 +08:00
CGQAQ
025a4491ed Add ping and speedtest hotkeys
增加测速快捷键
2019-08-23 15:51:37 +08:00
CGQAQ
197d8f1ace Merge pull request #1 from 2dust/master
sync
2019-08-23 14:08:18 +08:00
2dust
f51e651410 Update V2rayConfigHandler.cs 2019-08-23 13:27:05 +08:00
2dust
a091616790 up trimex 2019-08-23 11:01:22 +08:00
2dust
150fa91ff3 Merge pull request #31 from CGQAQ/master
fix potential problems about not doing null checking
2019-08-23 10:14:43 +08:00
CGQAQ
33a25d8b49 fix potential problems about not doing null checking 2019-08-23 10:07:20 +08:00
54 changed files with 3361 additions and 3049 deletions

3
.gitignore vendored
View File

@@ -2,13 +2,14 @@
# 此 .gitignore 文件已由 Microsoft(R) Visual Studio 自动创建。
################################################################################
/v2rayN/.vs/v2rayN/v15
/v2rayN/.vs/
/v2rayN/v2rayN/bin/Debug/app.publish
/v2rayN/v2rayN/bin/Debug
/v2rayN/v2rayN/obj/Debug
/v2rayN/.vs/v2rayN/DesignTimeBuild
/v2rayN/v2rayN/bin/Release
/v2rayN/v2rayN/obj/Release
/v2rayN/packages
.vs/ProjectSettings.json
.vs/slnx.sqlite
.vs/VSWorkspaceState.json

View File

@@ -1,4 +1,5 @@
using System;
using System.Drawing;
using System.Windows.Forms;
using v2rayN.Mode;
@@ -35,5 +36,52 @@ namespace v2rayN.Forms
Utils.SaveLog($"Loading custom icon failed: {e.Message}");
}
}
protected Icon GetNotifyIcon()
{
try
{
var index = config.sysAgentEnabled ? config.listenerType : 0;
if (index <= 0)
{
return this.Icon;
}
var color = (new Color[] { Color.Red, Color.Orange, Color.Yellow, Color.Green })[index - 1];
var text = index.ToString();
var width = 128;
var height = 128;
//Create bitmap, kind of canvas
Bitmap bitmap = new Bitmap(width, height);
//var drawFont = new Font(FontFamily.Families[0], 64f, FontStyle.Bold);
//var drawBrush = new SolidBrush(color);
var pen = new Pen(color, 24);
var graphics = Graphics.FromImage(bitmap);
//graphics.TextRenderingHint = System.Drawing.Text.TextRenderingHint.SingleBitPerPixel;
graphics.DrawIcon(this.Icon, 0, 0);
graphics.DrawEllipse(pen, new Rectangle(0, 0, width, height));
//graphics.DrawString(text, drawFont, drawBrush, width / 4, height / 8);
//To Save icon to disk
bitmap.Save(Utils.GetPath("temp_icon.ico"), System.Drawing.Imaging.ImageFormat.Icon);
Icon createdIcon = Icon.FromHandle(bitmap.GetHicon());
//drawFont.Dispose();
//drawBrush.Dispose();
pen.Dispose();
graphics.Dispose();
bitmap.Dispose();
return createdIcon;
}
catch (Exception ex)
{
Utils.SaveLog(ex.Message, ex);
return this.Icon;
}
}
}
}

View File

@@ -0,0 +1,56 @@
using System.Drawing;
using System.Windows.Forms;
namespace v2rayN.Forms
{
class ListViewFlickerFree : ListView
{
public ListViewFlickerFree()
{
SetStyle(ControlStyles.OptimizedDoubleBuffer
| ControlStyles.AllPaintingInWmPaint
, true);
UpdateStyles();
}
public void AutoResizeColumns()
{
try
{
int count = this.Columns.Count;
int MaxWidth = 0;
Graphics graphics = this.CreateGraphics();
Font font = this.Font;
ListView.ListViewItemCollection items = this.Items;
string str;
int width;
this.AutoResizeColumns(ColumnHeaderAutoResizeStyle.HeaderSize);
for (int i = 0; i < count; i++)
{
str = this.Columns[i].Text;
MaxWidth = this.Columns[i].Width;
foreach (ListViewItem item in items)
{
str = item.SubItems[i].Text;
width = (int)graphics.MeasureString(str, font).Width;
if (width > MaxWidth)
{
MaxWidth = width;
}
}
if (i == 0)
{
this.Columns[i].Width = MaxWidth;
}
this.Columns[i].Width = MaxWidth;
}
}
catch { }
}
}
}

View File

@@ -31,7 +31,7 @@
this.components = new System.ComponentModel.Container();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MainForm));
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
this.lvServers = new System.Windows.Forms.ListView();
this.lvServers = new v2rayN.Forms.ListViewFlickerFree();
this.cmsLv = new System.Windows.Forms.ContextMenuStrip(this.components);
this.menuAddVmessServer = new System.Windows.Forms.ToolStripMenuItem();
this.menuAddShadowsocksServer = new System.Windows.Forms.ToolStripMenuItem();
@@ -41,6 +41,7 @@
this.menuScanScreen = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator();
this.menuRemoveServer = new System.Windows.Forms.ToolStripMenuItem();
this.menuRemoveDuplicateServer = new System.Windows.Forms.ToolStripMenuItem();
this.menuCopyServer = new System.Windows.Forms.ToolStripMenuItem();
this.menuSetDefaultServer = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator3 = new System.Windows.Forms.ToolStripSeparator();
@@ -82,10 +83,14 @@
this.toolSslSocksPortLab = new System.Windows.Forms.ToolStripStatusLabel();
this.toolSslSocksPort = new System.Windows.Forms.ToolStripStatusLabel();
this.toolSslBlank1 = new System.Windows.Forms.ToolStripStatusLabel();
this.toolSslHttpPortLab = new System.Windows.Forms.ToolStripStatusLabel();
this.toolSslHttpPort = new System.Windows.Forms.ToolStripStatusLabel();
this.toolSslBlank2 = new System.Windows.Forms.ToolStripStatusLabel();
this.toolSslPacPortLab = new System.Windows.Forms.ToolStripStatusLabel();
this.toolSslPacPort = new System.Windows.Forms.ToolStripStatusLabel();
this.toolSslBlank3 = new System.Windows.Forms.ToolStripStatusLabel();
this.toolSslServerSpeed = new System.Windows.Forms.ToolStripStatusLabel();
this.toolSslBlank4 = new System.Windows.Forms.ToolStripStatusLabel();
this.panel1 = new System.Windows.Forms.Panel();
this.tsMain = new System.Windows.Forms.ToolStrip();
this.toolStripSeparator4 = new System.Windows.Forms.ToolStripSeparator();
@@ -111,8 +116,6 @@
this.tsbPromotion = new System.Windows.Forms.ToolStripButton();
this.toolStripSeparator11 = new System.Windows.Forms.ToolStripSeparator();
this.tsbClose = new System.Windows.Forms.ToolStripButton();
this.toolSslHttpPortLab = new System.Windows.Forms.ToolStripStatusLabel();
this.toolSslPacPortLab = new System.Windows.Forms.ToolStripStatusLabel();
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
this.splitContainer1.Panel1.SuspendLayout();
this.splitContainer1.Panel2.SuspendLayout();
@@ -133,20 +136,23 @@
//
// splitContainer1.Panel1
//
resources.ApplyResources(this.splitContainer1.Panel1, "splitContainer1.Panel1");
this.splitContainer1.Panel1.Controls.Add(this.lvServers);
//
// splitContainer1.Panel2
//
resources.ApplyResources(this.splitContainer1.Panel2, "splitContainer1.Panel2");
this.splitContainer1.Panel2.Controls.Add(this.qrCodeControl);
this.splitContainer1.SplitterMoved += new System.Windows.Forms.SplitterEventHandler(this.splitContainer1_SplitterMoved);
//
// lvServers
//
this.lvServers.ContextMenuStrip = this.cmsLv;
resources.ApplyResources(this.lvServers, "lvServers");
this.lvServers.ContextMenuStrip = this.cmsLv;
this.lvServers.FullRowSelect = true;
this.lvServers.GridLines = true;
this.lvServers.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.Nonclickable;
this.lvServers.HideSelection = false;
this.lvServers.Items.AddRange(new System.Windows.Forms.ListViewItem[] {
((System.Windows.Forms.ListViewItem)(resources.GetObject("lvServers.Items")))});
this.lvServers.MultiSelect = false;
@@ -159,6 +165,7 @@
//
// cmsLv
//
resources.ApplyResources(this.cmsLv, "cmsLv");
this.cmsLv.ImageScalingSize = new System.Drawing.Size(20, 20);
this.cmsLv.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.menuAddVmessServer,
@@ -169,6 +176,7 @@
this.menuScanScreen,
this.toolStripSeparator1,
this.menuRemoveServer,
this.menuRemoveDuplicateServer,
this.menuCopyServer,
this.menuSetDefaultServer,
this.toolStripSeparator3,
@@ -187,153 +195,158 @@
this.menuExport2SubContent});
this.cmsLv.Name = "cmsLv";
this.cmsLv.OwnerItem = this.tsbServer;
resources.ApplyResources(this.cmsLv, "cmsLv");
//
// menuAddVmessServer
//
this.menuAddVmessServer.Name = "menuAddVmessServer";
resources.ApplyResources(this.menuAddVmessServer, "menuAddVmessServer");
this.menuAddVmessServer.Name = "menuAddVmessServer";
this.menuAddVmessServer.Click += new System.EventHandler(this.menuAddVmessServer_Click);
//
// menuAddShadowsocksServer
//
this.menuAddShadowsocksServer.Name = "menuAddShadowsocksServer";
resources.ApplyResources(this.menuAddShadowsocksServer, "menuAddShadowsocksServer");
this.menuAddShadowsocksServer.Name = "menuAddShadowsocksServer";
this.menuAddShadowsocksServer.Click += new System.EventHandler(this.menuAddShadowsocksServer_Click);
//
// menuAddSocksServer
//
this.menuAddSocksServer.Name = "menuAddSocksServer";
resources.ApplyResources(this.menuAddSocksServer, "menuAddSocksServer");
this.menuAddSocksServer.Name = "menuAddSocksServer";
this.menuAddSocksServer.Click += new System.EventHandler(this.menuAddSocksServer_Click);
//
// menuAddCustomServer
//
this.menuAddCustomServer.Name = "menuAddCustomServer";
resources.ApplyResources(this.menuAddCustomServer, "menuAddCustomServer");
this.menuAddCustomServer.Name = "menuAddCustomServer";
this.menuAddCustomServer.Click += new System.EventHandler(this.menuAddCustomServer_Click);
//
// menuAddServers
//
this.menuAddServers.Name = "menuAddServers";
resources.ApplyResources(this.menuAddServers, "menuAddServers");
this.menuAddServers.Name = "menuAddServers";
this.menuAddServers.Click += new System.EventHandler(this.menuAddServers_Click);
//
// menuScanScreen
//
this.menuScanScreen.Name = "menuScanScreen";
resources.ApplyResources(this.menuScanScreen, "menuScanScreen");
this.menuScanScreen.Name = "menuScanScreen";
this.menuScanScreen.Click += new System.EventHandler(this.menuScanScreen_Click);
//
// toolStripSeparator1
//
this.toolStripSeparator1.Name = "toolStripSeparator1";
resources.ApplyResources(this.toolStripSeparator1, "toolStripSeparator1");
this.toolStripSeparator1.Name = "toolStripSeparator1";
//
// menuRemoveServer
//
this.menuRemoveServer.Name = "menuRemoveServer";
resources.ApplyResources(this.menuRemoveServer, "menuRemoveServer");
this.menuRemoveServer.Name = "menuRemoveServer";
this.menuRemoveServer.Click += new System.EventHandler(this.menuRemoveServer_Click);
//
// menuRemoveDuplicateServer
//
resources.ApplyResources(this.menuRemoveDuplicateServer, "menuRemoveDuplicateServer");
this.menuRemoveDuplicateServer.Name = "menuRemoveDuplicateServer";
this.menuRemoveDuplicateServer.Click += new System.EventHandler(this.menuRemoveDuplicateServer_Click);
//
// menuCopyServer
//
this.menuCopyServer.Name = "menuCopyServer";
resources.ApplyResources(this.menuCopyServer, "menuCopyServer");
this.menuCopyServer.Name = "menuCopyServer";
this.menuCopyServer.Click += new System.EventHandler(this.menuCopyServer_Click);
//
// menuSetDefaultServer
//
this.menuSetDefaultServer.Name = "menuSetDefaultServer";
resources.ApplyResources(this.menuSetDefaultServer, "menuSetDefaultServer");
this.menuSetDefaultServer.Name = "menuSetDefaultServer";
this.menuSetDefaultServer.Click += new System.EventHandler(this.menuSetDefaultServer_Click);
//
// toolStripSeparator3
//
this.toolStripSeparator3.Name = "toolStripSeparator3";
resources.ApplyResources(this.toolStripSeparator3, "toolStripSeparator3");
this.toolStripSeparator3.Name = "toolStripSeparator3";
//
// menuMoveTop
//
this.menuMoveTop.Name = "menuMoveTop";
resources.ApplyResources(this.menuMoveTop, "menuMoveTop");
this.menuMoveTop.Name = "menuMoveTop";
this.menuMoveTop.Click += new System.EventHandler(this.menuMoveTop_Click);
//
// menuMoveUp
//
this.menuMoveUp.Name = "menuMoveUp";
resources.ApplyResources(this.menuMoveUp, "menuMoveUp");
this.menuMoveUp.Name = "menuMoveUp";
this.menuMoveUp.Click += new System.EventHandler(this.menuMoveUp_Click);
//
// menuMoveDown
//
this.menuMoveDown.Name = "menuMoveDown";
resources.ApplyResources(this.menuMoveDown, "menuMoveDown");
this.menuMoveDown.Name = "menuMoveDown";
this.menuMoveDown.Click += new System.EventHandler(this.menuMoveDown_Click);
//
// menuMoveBottom
//
this.menuMoveBottom.Name = "menuMoveBottom";
resources.ApplyResources(this.menuMoveBottom, "menuMoveBottom");
this.menuMoveBottom.Name = "menuMoveBottom";
this.menuMoveBottom.Click += new System.EventHandler(this.menuMoveBottom_Click);
//
// menuSelectAll
//
this.menuSelectAll.Name = "menuSelectAll";
resources.ApplyResources(this.menuSelectAll, "menuSelectAll");
this.menuSelectAll.Name = "menuSelectAll";
this.menuSelectAll.Click += new System.EventHandler(this.menuSelectAll_Click);
//
// toolStripSeparator9
//
this.toolStripSeparator9.Name = "toolStripSeparator9";
resources.ApplyResources(this.toolStripSeparator9, "toolStripSeparator9");
this.toolStripSeparator9.Name = "toolStripSeparator9";
//
// menuPingServer
//
this.menuPingServer.Name = "menuPingServer";
resources.ApplyResources(this.menuPingServer, "menuPingServer");
this.menuPingServer.Name = "menuPingServer";
this.menuPingServer.Click += new System.EventHandler(this.menuPingServer_Click);
//
// menuSpeedServer
//
this.menuSpeedServer.Name = "menuSpeedServer";
resources.ApplyResources(this.menuSpeedServer, "menuSpeedServer");
this.menuSpeedServer.Name = "menuSpeedServer";
this.menuSpeedServer.Click += new System.EventHandler(this.menuSpeedServer_Click);
//
// toolStripSeparator6
//
this.toolStripSeparator6.Name = "toolStripSeparator6";
resources.ApplyResources(this.toolStripSeparator6, "toolStripSeparator6");
this.toolStripSeparator6.Name = "toolStripSeparator6";
//
// menuExport2ClientConfig
//
this.menuExport2ClientConfig.Name = "menuExport2ClientConfig";
resources.ApplyResources(this.menuExport2ClientConfig, "menuExport2ClientConfig");
this.menuExport2ClientConfig.Name = "menuExport2ClientConfig";
this.menuExport2ClientConfig.Click += new System.EventHandler(this.menuExport2ClientConfig_Click);
//
// menuExport2ServerConfig
//
this.menuExport2ServerConfig.Name = "menuExport2ServerConfig";
resources.ApplyResources(this.menuExport2ServerConfig, "menuExport2ServerConfig");
this.menuExport2ServerConfig.Name = "menuExport2ServerConfig";
this.menuExport2ServerConfig.Click += new System.EventHandler(this.menuExport2ServerConfig_Click);
//
// menuExport2ShareUrl
//
this.menuExport2ShareUrl.Name = "menuExport2ShareUrl";
resources.ApplyResources(this.menuExport2ShareUrl, "menuExport2ShareUrl");
this.menuExport2ShareUrl.Name = "menuExport2ShareUrl";
this.menuExport2ShareUrl.Click += new System.EventHandler(this.menuExport2ShareUrl_Click);
//
// menuExport2SubContent
//
this.menuExport2SubContent.Name = "menuExport2SubContent";
resources.ApplyResources(this.menuExport2SubContent, "menuExport2SubContent");
this.menuExport2SubContent.Name = "menuExport2SubContent";
this.menuExport2SubContent.Click += new System.EventHandler(this.menuExport2SubContent_Click);
//
// tsbServer
//
resources.ApplyResources(this.tsbServer, "tsbServer");
this.tsbServer.DropDown = this.cmsLv;
this.tsbServer.Image = global::v2rayN.Properties.Resources.server;
resources.ApplyResources(this.tsbServer, "tsbServer");
this.tsbServer.Name = "tsbServer";
//
// qrCodeControl
@@ -343,14 +356,14 @@
//
// notifyMain
//
this.notifyMain.ContextMenuStrip = this.cmsMain;
resources.ApplyResources(this.notifyMain, "notifyMain");
this.notifyMain.ContextMenuStrip = this.cmsMain;
this.notifyMain.MouseClick += new System.Windows.Forms.MouseEventHandler(this.notifyMain_MouseClick);
//
// cmsMain
//
this.cmsMain.ImageScalingSize = new System.Drawing.Size(20, 20);
resources.ApplyResources(this.cmsMain, "cmsMain");
this.cmsMain.ImageScalingSize = new System.Drawing.Size(20, 20);
this.cmsMain.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.menuSysAgentEnabled,
this.menuSysAgentMode,
@@ -367,76 +380,76 @@
//
// menuSysAgentEnabled
//
this.menuSysAgentEnabled.Name = "menuSysAgentEnabled";
resources.ApplyResources(this.menuSysAgentEnabled, "menuSysAgentEnabled");
this.menuSysAgentEnabled.Name = "menuSysAgentEnabled";
this.menuSysAgentEnabled.Click += new System.EventHandler(this.menuSysAgentEnabled_Click);
//
// menuSysAgentMode
//
resources.ApplyResources(this.menuSysAgentMode, "menuSysAgentMode");
this.menuSysAgentMode.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.menuGlobal,
this.menuGlobalPAC,
this.menuKeep,
this.menuKeepPAC});
this.menuSysAgentMode.Name = "menuSysAgentMode";
resources.ApplyResources(this.menuSysAgentMode, "menuSysAgentMode");
//
// menuGlobal
//
this.menuGlobal.Name = "menuGlobal";
resources.ApplyResources(this.menuGlobal, "menuGlobal");
this.menuGlobal.Name = "menuGlobal";
this.menuGlobal.Click += new System.EventHandler(this.menuGlobal_Click);
//
// menuGlobalPAC
//
this.menuGlobalPAC.Name = "menuGlobalPAC";
resources.ApplyResources(this.menuGlobalPAC, "menuGlobalPAC");
this.menuGlobalPAC.Name = "menuGlobalPAC";
this.menuGlobalPAC.Click += new System.EventHandler(this.menuGlobalPAC_Click);
//
// menuKeep
//
this.menuKeep.Name = "menuKeep";
resources.ApplyResources(this.menuKeep, "menuKeep");
this.menuKeep.Name = "menuKeep";
this.menuKeep.Click += new System.EventHandler(this.menuKeep_Click);
//
// menuKeepPAC
//
this.menuKeepPAC.Name = "menuKeepPAC";
resources.ApplyResources(this.menuKeepPAC, "menuKeepPAC");
this.menuKeepPAC.Name = "menuKeepPAC";
this.menuKeepPAC.Click += new System.EventHandler(this.menuKeepPAC_Click);
//
// menuServers
//
this.menuServers.Name = "menuServers";
resources.ApplyResources(this.menuServers, "menuServers");
this.menuServers.Name = "menuServers";
//
// menuAddServers2
//
this.menuAddServers2.Name = "menuAddServers2";
resources.ApplyResources(this.menuAddServers2, "menuAddServers2");
this.menuAddServers2.Name = "menuAddServers2";
this.menuAddServers2.Click += new System.EventHandler(this.menuAddServers_Click);
//
// menuScanScreen2
//
this.menuScanScreen2.Name = "menuScanScreen2";
resources.ApplyResources(this.menuScanScreen2, "menuScanScreen2");
this.menuScanScreen2.Name = "menuScanScreen2";
this.menuScanScreen2.Click += new System.EventHandler(this.menuScanScreen_Click);
//
// menuCopyPACUrl
//
this.menuCopyPACUrl.Name = "menuCopyPACUrl";
resources.ApplyResources(this.menuCopyPACUrl, "menuCopyPACUrl");
this.menuCopyPACUrl.Name = "menuCopyPACUrl";
this.menuCopyPACUrl.Click += new System.EventHandler(this.menuCopyPACUrl_Click);
//
// toolStripSeparator2
//
this.toolStripSeparator2.Name = "toolStripSeparator2";
resources.ApplyResources(this.toolStripSeparator2, "toolStripSeparator2");
this.toolStripSeparator2.Name = "toolStripSeparator2";
//
// menuExit
//
this.menuExit.Name = "menuExit";
resources.ApplyResources(this.menuExit, "menuExit");
this.menuExit.Name = "menuExit";
this.menuExit.Click += new System.EventHandler(this.menuExit_Click);
//
// bgwPing
@@ -453,30 +466,31 @@
//
// groupBox1
//
this.groupBox1.Controls.Add(this.splitContainer1);
resources.ApplyResources(this.groupBox1, "groupBox1");
this.groupBox1.Controls.Add(this.splitContainer1);
this.groupBox1.Name = "groupBox1";
this.groupBox1.TabStop = false;
//
// groupBox2
//
resources.ApplyResources(this.groupBox2, "groupBox2");
this.groupBox2.Controls.Add(this.txtMsgBox);
this.groupBox2.Controls.Add(this.ssMain);
resources.ApplyResources(this.groupBox2, "groupBox2");
this.groupBox2.Name = "groupBox2";
this.groupBox2.TabStop = false;
//
// txtMsgBox
//
resources.ApplyResources(this.txtMsgBox, "txtMsgBox");
this.txtMsgBox.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(41)))), ((int)(((byte)(49)))), ((int)(((byte)(52)))));
this.txtMsgBox.BorderStyle = System.Windows.Forms.BorderStyle.None;
resources.ApplyResources(this.txtMsgBox, "txtMsgBox");
this.txtMsgBox.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(224)))), ((int)(((byte)(226)))), ((int)(((byte)(228)))));
this.txtMsgBox.Name = "txtMsgBox";
this.txtMsgBox.ReadOnly = true;
//
// ssMain
//
resources.ApplyResources(this.ssMain, "ssMain");
this.ssMain.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.toolSslSocksPortLab,
this.toolSslSocksPort,
@@ -486,49 +500,71 @@
this.toolSslBlank2,
this.toolSslPacPortLab,
this.toolSslPacPort,
this.toolSslBlank3});
resources.ApplyResources(this.ssMain, "ssMain");
this.toolSslBlank3,
this.toolSslServerSpeed,
this.toolSslBlank4});
this.ssMain.Name = "ssMain";
this.ssMain.ItemClicked += new System.Windows.Forms.ToolStripItemClickedEventHandler(this.ssMain_ItemClicked);
//
// toolSslSocksPortLab
//
this.toolSslSocksPortLab.Name = "toolSslSocksPortLab";
resources.ApplyResources(this.toolSslSocksPortLab, "toolSslSocksPortLab");
this.toolSslSocksPortLab.Name = "toolSslSocksPortLab";
//
// toolSslSocksPort
//
this.toolSslSocksPort.Name = "toolSslSocksPort";
resources.ApplyResources(this.toolSslSocksPort, "toolSslSocksPort");
this.toolSslSocksPort.Name = "toolSslSocksPort";
//
// toolSslBlank1
//
this.toolSslBlank1.Name = "toolSslBlank1";
resources.ApplyResources(this.toolSslBlank1, "toolSslBlank1");
this.toolSslBlank1.Name = "toolSslBlank1";
this.toolSslBlank1.Spring = true;
//
// toolSslHttpPortLab
//
resources.ApplyResources(this.toolSslHttpPortLab, "toolSslHttpPortLab");
this.toolSslHttpPortLab.Name = "toolSslHttpPortLab";
//
// toolSslHttpPort
//
this.toolSslHttpPort.Name = "toolSslHttpPort";
resources.ApplyResources(this.toolSslHttpPort, "toolSslHttpPort");
this.toolSslHttpPort.Name = "toolSslHttpPort";
//
// toolSslBlank2
//
this.toolSslBlank2.Name = "toolSslBlank2";
resources.ApplyResources(this.toolSslBlank2, "toolSslBlank2");
this.toolSslBlank2.Name = "toolSslBlank2";
this.toolSslBlank2.Spring = true;
//
// toolSslPacPortLab
//
resources.ApplyResources(this.toolSslPacPortLab, "toolSslPacPortLab");
this.toolSslPacPortLab.Name = "toolSslPacPortLab";
//
// toolSslPacPort
//
this.toolSslPacPort.Name = "toolSslPacPort";
resources.ApplyResources(this.toolSslPacPort, "toolSslPacPort");
this.toolSslPacPort.Name = "toolSslPacPort";
//
// toolSslBlank3
//
this.toolSslBlank3.Name = "toolSslBlank3";
resources.ApplyResources(this.toolSslBlank3, "toolSslBlank3");
this.toolSslBlank3.Name = "toolSslBlank3";
this.toolSslBlank3.Spring = true;
//
// toolSslServerSpeed
//
resources.ApplyResources(this.toolSslServerSpeed, "toolSslServerSpeed");
this.toolSslServerSpeed.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text;
this.toolSslServerSpeed.Name = "toolSslServerSpeed";
//
// toolSslBlank4
//
resources.ApplyResources(this.toolSslBlank4, "toolSslBlank4");
this.toolSslBlank4.Name = "toolSslBlank4";
//
// panel1
//
resources.ApplyResources(this.panel1, "panel1");
@@ -536,6 +572,7 @@
//
// tsMain
//
resources.ApplyResources(this.tsMain, "tsMain");
this.tsMain.ImageScalingSize = new System.Drawing.Size(32, 32);
this.tsMain.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.tsbServer,
@@ -552,51 +589,50 @@
this.tsbPromotion,
this.toolStripSeparator11,
this.tsbClose});
resources.ApplyResources(this.tsMain, "tsMain");
this.tsMain.Name = "tsMain";
//
// toolStripSeparator4
//
this.toolStripSeparator4.Name = "toolStripSeparator4";
resources.ApplyResources(this.toolStripSeparator4, "toolStripSeparator4");
this.toolStripSeparator4.Name = "toolStripSeparator4";
//
// tsbSub
//
resources.ApplyResources(this.tsbSub, "tsbSub");
this.tsbSub.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.tsbSubSetting,
this.tsbSubUpdate});
this.tsbSub.Image = global::v2rayN.Properties.Resources.sub;
resources.ApplyResources(this.tsbSub, "tsbSub");
this.tsbSub.Name = "tsbSub";
//
// tsbSubSetting
//
this.tsbSubSetting.Name = "tsbSubSetting";
resources.ApplyResources(this.tsbSubSetting, "tsbSubSetting");
this.tsbSubSetting.Name = "tsbSubSetting";
this.tsbSubSetting.Click += new System.EventHandler(this.tsbSubSetting_Click);
//
// tsbSubUpdate
//
this.tsbSubUpdate.Name = "tsbSubUpdate";
resources.ApplyResources(this.tsbSubUpdate, "tsbSubUpdate");
this.tsbSubUpdate.Name = "tsbSubUpdate";
this.tsbSubUpdate.Click += new System.EventHandler(this.tsbSubUpdate_Click);
//
// toolStripSeparator8
//
this.toolStripSeparator8.Name = "toolStripSeparator8";
resources.ApplyResources(this.toolStripSeparator8, "toolStripSeparator8");
this.toolStripSeparator8.Name = "toolStripSeparator8";
//
// tsbOptionSetting
//
this.tsbOptionSetting.Image = global::v2rayN.Properties.Resources.option;
resources.ApplyResources(this.tsbOptionSetting, "tsbOptionSetting");
this.tsbOptionSetting.Image = global::v2rayN.Properties.Resources.option;
this.tsbOptionSetting.Name = "tsbOptionSetting";
this.tsbOptionSetting.Click += new System.EventHandler(this.tsbOptionSetting_Click);
//
// toolStripSeparator5
//
this.toolStripSeparator5.Name = "toolStripSeparator5";
resources.ApplyResources(this.toolStripSeparator5, "toolStripSeparator5");
this.toolStripSeparator5.Name = "toolStripSeparator5";
//
// tsbReload
//
@@ -606,95 +642,95 @@
//
// toolStripSeparator7
//
this.toolStripSeparator7.Name = "toolStripSeparator7";
resources.ApplyResources(this.toolStripSeparator7, "toolStripSeparator7");
this.toolStripSeparator7.Name = "toolStripSeparator7";
//
// tsbCheckUpdate
//
resources.ApplyResources(this.tsbCheckUpdate, "tsbCheckUpdate");
this.tsbCheckUpdate.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.tsbCheckUpdateN,
this.tsbCheckUpdateCore,
this.tsbCheckUpdatePACList,
this.tsbCheckClearPACList});
this.tsbCheckUpdate.Image = global::v2rayN.Properties.Resources.checkupdate;
resources.ApplyResources(this.tsbCheckUpdate, "tsbCheckUpdate");
this.tsbCheckUpdate.Name = "tsbCheckUpdate";
//
// tsbCheckUpdateN
//
this.tsbCheckUpdateN.Name = "tsbCheckUpdateN";
resources.ApplyResources(this.tsbCheckUpdateN, "tsbCheckUpdateN");
this.tsbCheckUpdateN.Name = "tsbCheckUpdateN";
this.tsbCheckUpdateN.Click += new System.EventHandler(this.tsbCheckUpdateN_Click);
//
// tsbCheckUpdateCore
//
this.tsbCheckUpdateCore.Name = "tsbCheckUpdateCore";
resources.ApplyResources(this.tsbCheckUpdateCore, "tsbCheckUpdateCore");
this.tsbCheckUpdateCore.Name = "tsbCheckUpdateCore";
this.tsbCheckUpdateCore.Click += new System.EventHandler(this.tsbCheckUpdateCore_Click);
//
// tsbCheckUpdatePACList
//
this.tsbCheckUpdatePACList.Name = "tsbCheckUpdatePACList";
resources.ApplyResources(this.tsbCheckUpdatePACList, "tsbCheckUpdatePACList");
this.tsbCheckUpdatePACList.Name = "tsbCheckUpdatePACList";
this.tsbCheckUpdatePACList.Click += new System.EventHandler(this.tsbCheckUpdatePACList_Click);
//
// tsbCheckClearPACList
//
this.tsbCheckClearPACList.Name = "tsbCheckClearPACList";
resources.ApplyResources(this.tsbCheckClearPACList, "tsbCheckClearPACList");
this.tsbCheckClearPACList.Name = "tsbCheckClearPACList";
this.tsbCheckClearPACList.Click += new System.EventHandler(this.tsbCheckClearPACList_Click);
//
// toolStripSeparator10
//
this.toolStripSeparator10.Name = "toolStripSeparator10";
resources.ApplyResources(this.toolStripSeparator10, "toolStripSeparator10");
this.toolStripSeparator10.Name = "toolStripSeparator10";
//
// tsbHelp
//
resources.ApplyResources(this.tsbHelp, "tsbHelp");
this.tsbHelp.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.tsbAbout,
this.toolStripSeparator12,
this.tsbLanguageDef,
this.tsbLanguageZhHans});
this.tsbHelp.Image = global::v2rayN.Properties.Resources.help;
resources.ApplyResources(this.tsbHelp, "tsbHelp");
this.tsbHelp.Name = "tsbHelp";
//
// tsbAbout
//
this.tsbAbout.Name = "tsbAbout";
resources.ApplyResources(this.tsbAbout, "tsbAbout");
this.tsbAbout.Name = "tsbAbout";
this.tsbAbout.Click += new System.EventHandler(this.tsbAbout_Click);
//
// toolStripSeparator12
//
this.toolStripSeparator12.Name = "toolStripSeparator12";
resources.ApplyResources(this.toolStripSeparator12, "toolStripSeparator12");
this.toolStripSeparator12.Name = "toolStripSeparator12";
//
// tsbLanguageDef
//
this.tsbLanguageDef.Name = "tsbLanguageDef";
resources.ApplyResources(this.tsbLanguageDef, "tsbLanguageDef");
this.tsbLanguageDef.Name = "tsbLanguageDef";
this.tsbLanguageDef.Click += new System.EventHandler(this.tsbLanguageDef_Click);
//
// tsbLanguageZhHans
//
this.tsbLanguageZhHans.Name = "tsbLanguageZhHans";
resources.ApplyResources(this.tsbLanguageZhHans, "tsbLanguageZhHans");
this.tsbLanguageZhHans.Name = "tsbLanguageZhHans";
this.tsbLanguageZhHans.Click += new System.EventHandler(this.tsbLanguageZhHans_Click);
//
// tsbPromotion
//
resources.ApplyResources(this.tsbPromotion, "tsbPromotion");
this.tsbPromotion.ForeColor = System.Drawing.Color.Black;
this.tsbPromotion.Image = global::v2rayN.Properties.Resources.promotion;
resources.ApplyResources(this.tsbPromotion, "tsbPromotion");
this.tsbPromotion.Name = "tsbPromotion";
this.tsbPromotion.Click += new System.EventHandler(this.tsbPromotion_Click);
//
// toolStripSeparator11
//
this.toolStripSeparator11.Name = "toolStripSeparator11";
resources.ApplyResources(this.toolStripSeparator11, "toolStripSeparator11");
this.toolStripSeparator11.Name = "toolStripSeparator11";
//
// tsbClose
//
@@ -702,16 +738,6 @@
this.tsbClose.Name = "tsbClose";
this.tsbClose.Click += new System.EventHandler(this.tsbClose_Click);
//
// toolSslHttpPortLab
//
this.toolSslHttpPortLab.Name = "toolSslHttpPortLab";
resources.ApplyResources(this.toolSslHttpPortLab, "toolSslHttpPortLab");
//
// toolSslPacPortLab
//
this.toolSslPacPortLab.Name = "toolSslPacPortLab";
resources.ApplyResources(this.toolSslPacPortLab, "toolSslPacPortLab");
//
// MainForm
//
resources.ApplyResources(this, "$this");
@@ -726,6 +752,7 @@
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.MainForm_FormClosing);
this.Load += new System.EventHandler(this.MainForm_Load);
this.Shown += new System.EventHandler(this.MainForm_Shown);
this.VisibleChanged += new System.EventHandler(this.MainForm_VisibleChanged);
this.Resize += new System.EventHandler(this.MainForm_Resize);
this.splitContainer1.Panel1.ResumeLayout(false);
this.splitContainer1.Panel2.ResumeLayout(false);
@@ -750,7 +777,7 @@
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.GroupBox groupBox2;
private System.Windows.Forms.TextBox txtMsgBox;
private System.Windows.Forms.ListView lvServers;
private v2rayN.Forms.ListViewFlickerFree lvServers;
private System.Windows.Forms.NotifyIcon notifyMain;
private System.Windows.Forms.ContextMenuStrip cmsMain;
private System.Windows.Forms.ToolStripMenuItem menuExit;
@@ -830,6 +857,9 @@
private System.Windows.Forms.ToolStripStatusLabel toolSslSocksPortLab;
private System.Windows.Forms.ToolStripStatusLabel toolSslHttpPortLab;
private System.Windows.Forms.ToolStripStatusLabel toolSslPacPortLab;
private System.Windows.Forms.ToolStripStatusLabel toolSslServerSpeed;
private System.Windows.Forms.ToolStripStatusLabel toolSslBlank4;
private System.Windows.Forms.ToolStripMenuItem menuRemoveDuplicateServer;
}
}

View File

@@ -1,12 +1,12 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.IO.Compression;
using System.Text;
using System.Windows.Forms;
using v2rayN.Handler;
using v2rayN.HttpProxyHandler;
using v2rayN.Mode;
using System.Collections.Generic;
using System.IO;
namespace v2rayN.Forms
{
@@ -17,6 +17,7 @@ namespace v2rayN.Forms
private V2rayUpdateHandle v2rayUpdateHandle;
private V2rayUpdateHandle v2rayUpdateHandle2;
private List<int> lvSelecteds = new List<int>();
private StatisticsHandler statistics = null;
#region Window
@@ -31,6 +32,7 @@ namespace v2rayN.Forms
Application.ApplicationExit += (sender, args) =>
{
Utils.ClearTempPath();
statistics?.Close();
};
}
@@ -39,13 +41,82 @@ namespace v2rayN.Forms
ConfigHandler.LoadConfig(ref config);
v2rayHandler = new V2rayHandler();
v2rayHandler.ProcessEvent += v2rayHandler_ProcessEvent;
if (config.enableStatistics)
{
statistics = new StatisticsHandler(config, UpdateStatisticsHandler);
}
}
private void UpdateStatisticsHandler(ulong totalUp, ulong totalDown, ulong up, ulong down, List<Mode.ServerStatistics> statistics)
{
try
{
up /= (ulong)(config.statisticsFreshRate / 1000f);
down /= (ulong)(config.statisticsFreshRate / 1000f);
toolSslServerSpeed.Text = string.Format(
"{0}/s↑ | {1}/s↓",
Utils.HumanFy(up),
Utils.HumanFy(down)
);
List<string[]> datas = new List<string[]>();
for (int i = 0; i < config.vmess.Count; i++)
{
string totalUp_ = string.Empty,
totalDown_ = string.Empty,
todayUp_ = string.Empty,
todayDown_ = string.Empty;
var index = statistics.FindIndex(item_ => Utils.IsIdenticalServer(item_, new ServerStatistics(config.vmess[i].remarks, config.vmess[i].address, config.vmess[i].port, config.vmess[i].path, config.vmess[i].requestHost, 0, 0, 0, 0)));
if (index != -1)
{
totalUp_ = Utils.HumanFy(statistics[index].totalUp);
totalDown_ = Utils.HumanFy(statistics[index].totalDown);
todayUp_ = Utils.HumanFy(statistics[index].todayUp);
todayDown_ = Utils.HumanFy(statistics[index].todayDown);
}
datas.Add(new string[] { totalUp_, totalDown_, todayUp_, todayDown_ });
}
lvServers.Invoke((MethodInvoker)delegate
{
lvServers.SuspendLayout();
for (int i = 0; i < datas.Count; i++)
{
var indexStart = 9;
lvServers.Items[i].SubItems[indexStart++].Text = datas[i][0];
lvServers.Items[i].SubItems[indexStart++].Text = datas[i][1];
lvServers.Items[i].SubItems[indexStart++].Text = datas[i][2];
lvServers.Items[i].SubItems[indexStart++].Text = datas[i][3];
}
lvServers.ResumeLayout();
});
}
catch (Exception ex)
{
Utils.SaveLog(ex.Message, ex);
}
}
private void MainForm_VisibleChanged(object sender, EventArgs e)
{
if (statistics == null || !statistics.Enable) return;
if ((sender as Form).Visible)
{
statistics.UpdateUI = true;
}
else
{
statistics.UpdateUI = false;
}
}
private void MainForm_Shown(object sender, EventArgs e)
{
InitServersView();
RefreshServers();
lvServers.AutoResizeColumns();
LoadV2ray();
@@ -59,9 +130,17 @@ namespace v2rayN.Forms
{
e.Cancel = true;
statistics?.SaveToFile();
HideForm();
return;
}
if (e.CloseReason == CloseReason.ApplicationExitCall)
{
ConfigHandler.SaveConfig(ref config);
statistics?.SaveToFile();
statistics?.Close();
}
}
private void MainForm_Resize(object sender, EventArgs e)
@@ -80,7 +159,7 @@ namespace v2rayN.Forms
{
//config.uiItem.mainQRCodeWidth = splitContainer1.SplitterDistance;
}
private const int WM_QUERYENDSESSION = 0x0011;
protected override void WndProc(ref Message m)
{
@@ -88,7 +167,9 @@ namespace v2rayN.Forms
{
case WM_QUERYENDSESSION:
Utils.SaveLog("Windows shutdown UnsetProxy");
CloseV2ray();
//CloseV2ray();
ConfigHandler.ToJsonFile(config);
statistics?.SaveToFile();
ProxySetting.UnsetProxy();
m.Result = (IntPtr)1;
break;
@@ -132,8 +213,15 @@ namespace v2rayN.Forms
lvServers.Columns.Add(UIRes.I18N("LvEncryptionMethod"), 90, HorizontalAlignment.Left);
lvServers.Columns.Add(UIRes.I18N("LvTransportProtocol"), 70, HorizontalAlignment.Left);
lvServers.Columns.Add(UIRes.I18N("LvSubscription"), 50, HorizontalAlignment.Left);
lvServers.Columns.Add(UIRes.I18N("LvTestResults"), 100, HorizontalAlignment.Left);
lvServers.Columns.Add(UIRes.I18N("LvTestResults"), 70, HorizontalAlignment.Left);
if (statistics != null && statistics.Enable)
{
lvServers.Columns.Add(UIRes.I18N("LvTotalUploadDataAmount"), 70, HorizontalAlignment.Left);
lvServers.Columns.Add(UIRes.I18N("LvTotalDownloadDataAmount"), 70, HorizontalAlignment.Left);
lvServers.Columns.Add(UIRes.I18N("LvTodayUploadDataAmount"), 70, HorizontalAlignment.Left);
lvServers.Columns.Add(UIRes.I18N("LvTodayDownloadDataAmount"), 70, HorizontalAlignment.Left);
}
}
/// <summary>
@@ -146,14 +234,52 @@ namespace v2rayN.Forms
for (int k = 0; k < config.vmess.Count; k++)
{
string def = string.Empty;
string totalUp = string.Empty,
totalDown = string.Empty,
todayUp = string.Empty,
todayDown = string.Empty;
if (config.index.Equals(k))
{
def = "√";
}
VmessItem item = config.vmess[k];
ListViewItem lvItem = new ListViewItem(new string[]
ListViewItem lvItem = null;
if (statistics != null && statistics.Enable)
{
var index = statistics.Statistic.FindIndex(item_ => item_.address == item.address);
if (index != -1)
{
totalUp = Utils.HumanFy(statistics.Statistic[index].totalUp);
totalDown = Utils.HumanFy(statistics.Statistic[index].totalDown);
todayUp = Utils.HumanFy(statistics.Statistic[index].todayUp);
todayDown = Utils.HumanFy(statistics.Statistic[index].todayDown);
}
lvItem = new ListViewItem(new string[]
{
def,
((EConfigType)item.configType).ToString(),
item.remarks,
item.address,
item.port.ToString(),
//item.id,
//item.alterId.ToString(),
item.security,
item.network,
item.getSubRemarks(config),
item.testResult,
totalUp,
totalDown,
todayUp,
todayDown
});
}
else
{
lvItem = new ListViewItem(new string[]
{
def,
((EConfigType)item.configType).ToString(),
item.remarks,
@@ -165,8 +291,14 @@ namespace v2rayN.Forms
item.network,
item.getSubRemarks(config),
item.testResult
});
lvServers.Items.Add(lvItem);
//totalUp,
//totalDown,
//todayUp,
//todayDown,
});
}
if (lvItem != null) lvServers.Items.Add(lvItem);
}
//if (lvServers.Items.Count > 0)
@@ -241,22 +373,31 @@ namespace v2rayN.Forms
var localIP = "127.0.0.1";
toolSslSocksPort.Text =
toolSslHttpPort.Text =
toolSslPacPort.Text = "NONE";
toolSslPacPort.Text = "NONE";
toolSslSocksPort.Text = $"{localIP}:{config.inbound[0].localPort}";
if (config.sysAgentEnabled)
{
toolSslHttpPort.Text = $"{localIP}:{Global.sysAgentPort}";
if (config.listenerType == 2 || config.listenerType == 4)
{
toolSslPacPort.Text = $"{HttpProxyHandle.GetPacUrl()}";
if (PACServerHandle.IsRunning)
{
toolSslPacPort.Text = $"{HttpProxyHandle.GetPacUrl()}";
}
else
{
toolSslPacPort.Text = UIRes.I18N("StartPacFailed");
}
}
}
notifyMain.Icon = GetNotifyIcon();
}
private void ssMain_ItemClicked(object sender, ToolStripItemClickedEventArgs e)
{
if (!string.IsNullOrEmpty(e.ClickedItem.Text))
if (!Utils.IsNullOrEmpty(e.ClickedItem.Text))
{
Utils.SetClipboardData(e.ClickedItem.Text);
}
@@ -358,6 +499,12 @@ namespace v2rayN.Forms
case Keys.A:
menuSelectAll_Click(null, null);
break;
case Keys.T:
menuSpeedServer_Click(null, null);
break;
case Keys.P:
menuPingServer_Click(null, null);
break;
}
}
switch (e.KeyCode)
@@ -411,6 +558,22 @@ namespace v2rayN.Forms
}
private void menuRemoveDuplicateServer_Click(object sender, EventArgs e)
{
List<Mode.VmessItem> servers = null;
Utils.DedupServerList(config.vmess, out servers);
if (servers != null)
{
config.vmess = servers;
}
//刷新
RefreshServers();
LoadV2ray();
// save to config file
ConfigHandler.ToJsonFile(config);
}
private void menuCopyServer_Click(object sender, EventArgs e)
{
int index = GetLvSelectedIndex();
@@ -834,6 +997,9 @@ namespace v2rayN.Forms
this.Visible = false;
this.Close();
statistics?.Close();
//this.Dispose();
//System.Environment.Exit(System.Environment.ExitCode);
Application.Exit();
@@ -855,7 +1021,7 @@ namespace v2rayN.Forms
{
//this.WindowState = FormWindowState.Minimized;
this.Hide();
this.notifyMain.Icon = this.Icon;
//this.notifyMain.Icon = this.Icon;
this.notifyMain.Visible = true;
this.ShowInTaskbar = false;
@@ -883,6 +1049,7 @@ namespace v2rayN.Forms
}
catch
{
}
}
@@ -901,7 +1068,7 @@ namespace v2rayN.Forms
private void SetTestResult(int k, string txt)
{
config.vmess[k].testResult = txt;
lvServers.Items[k].SubItems[lvServers.Items[k].SubItems.Count - 1].Text = txt;
lvServers.Items[k].SubItems[8].Text = txt;
}
private void ClearTestResult()
{
@@ -1283,7 +1450,7 @@ namespace v2rayN.Forms
ShowForm();
string result = Convert.ToString(e.UserState);
if (string.IsNullOrEmpty(result))
if (Utils.IsNullOrEmpty(result))
{
UI.Show(UIRes.I18N("NoValidQRcodeFound"));
}
@@ -1320,8 +1487,8 @@ namespace v2rayN.Forms
for (int k = 1; k <= config.subItem.Count; k++)
{
string id = config.subItem[k - 1].id.Trim();
string url = config.subItem[k - 1].url.Trim();
string id = config.subItem[k - 1].id.TrimEx();
string url = config.subItem[k - 1].url.TrimEx();
string hashCode = $"{k}->";
if (config.subItem[k - 1].enabled == false)
{
@@ -1393,8 +1560,7 @@ namespace v2rayN.Forms
Utils.RegWriteValue(Global.MyRegPath, Global.MyRegKeyLanguage, value);
}
#endregion
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -163,6 +163,12 @@
<data name="menuRemoveServer.Text" xml:space="preserve">
<value>移除所选服务器(多选) (Delete)</value>
</data>
<data name="menuRemoveDuplicateServer.Size" type="System.Drawing.Size, System.Drawing">
<value>252, 22</value>
</data>
<data name="menuRemoveDuplicateServer.Text" xml:space="preserve">
<value>移除重复的服务器</value>
</data>
<data name="menuCopyServer.Size" type="System.Drawing.Size, System.Drawing">
<value>252, 22</value>
</data>
@@ -215,13 +221,13 @@
<value>252, 22</value>
</data>
<data name="menuPingServer.Text" xml:space="preserve">
<value>测试服务器延迟(多选)</value>
<value>测试服务器延迟(多选)(Ctrl+P)</value>
</data>
<data name="menuSpeedServer.Size" type="System.Drawing.Size, System.Drawing">
<value>252, 22</value>
</data>
<data name="menuSpeedServer.Text" xml:space="preserve">
<value>测试服务器速度(多选)</value>
<value>测试服务器速度(多选)(Ctrl+T)</value>
</data>
<data name="toolStripSeparator6.Size" type="System.Drawing.Size, System.Drawing">
<value>249, 6</value>
@@ -257,7 +263,7 @@
<value> 服务器 </value>
</data>
<data name="cmsLv.Size" type="System.Drawing.Size, System.Drawing">
<value>253, 468</value>
<value>253, 490</value>
</data>
<data name="lvServers.Items" mimetype="application/x-microsoft.net.object.binary.base64">
<value>
@@ -351,6 +357,9 @@
<data name="groupBox1.Text" xml:space="preserve">
<value>服务器列表</value>
</data>
<data name="toolSslServerSpeed.Text" xml:space="preserve">
<value>网速显示未启用</value>
</data>
<data name="groupBox2.Text" xml:space="preserve">
<value>信息</value>
</data>

View File

@@ -28,6 +28,7 @@
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(OptionSettingForm));
this.btnClose = new System.Windows.Forms.Button();
this.tabControl1 = new System.Windows.Forms.TabControl();
@@ -82,6 +83,11 @@
this.txtKcpmtu = new System.Windows.Forms.TextBox();
this.label6 = new System.Windows.Forms.Label();
this.tabPage7 = new System.Windows.Forms.TabPage();
this.cbFreshrate = new System.Windows.Forms.ComboBox();
this.tbCacheDays = new System.Windows.Forms.TextBox();
this.lbFreshrate = new System.Windows.Forms.Label();
this.lbCacheDays = new System.Windows.Forms.Label();
this.chkEnableStatistics = new System.Windows.Forms.CheckBox();
this.chkAllowLANConn = new System.Windows.Forms.CheckBox();
this.txturlGFWList = new System.Windows.Forms.TextBox();
this.label13 = new System.Windows.Forms.Label();
@@ -89,6 +95,7 @@
this.panel2 = new System.Windows.Forms.Panel();
this.btnOK = new System.Windows.Forms.Button();
this.panel1 = new System.Windows.Forms.Panel();
this.configBindingSource = new System.Windows.Forms.BindingSource(this.components);
this.tabControl1.SuspendLayout();
this.tabPage1.SuspendLayout();
this.groupBox1.SuspendLayout();
@@ -102,6 +109,7 @@
this.tabPage6.SuspendLayout();
this.tabPage7.SuspendLayout();
this.panel2.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.configBindingSource)).BeginInit();
this.SuspendLayout();
//
// btnClose
@@ -473,6 +481,11 @@
//
// tabPage7
//
this.tabPage7.Controls.Add(this.cbFreshrate);
this.tabPage7.Controls.Add(this.tbCacheDays);
this.tabPage7.Controls.Add(this.lbFreshrate);
this.tabPage7.Controls.Add(this.lbCacheDays);
this.tabPage7.Controls.Add(this.chkEnableStatistics);
this.tabPage7.Controls.Add(this.chkAllowLANConn);
this.tabPage7.Controls.Add(this.txturlGFWList);
this.tabPage7.Controls.Add(this.label13);
@@ -481,6 +494,34 @@
this.tabPage7.Name = "tabPage7";
this.tabPage7.UseVisualStyleBackColor = true;
//
// cbFreshrate
//
this.cbFreshrate.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cbFreshrate.FormattingEnabled = true;
resources.ApplyResources(this.cbFreshrate, "cbFreshrate");
this.cbFreshrate.Name = "cbFreshrate";
//
// tbCacheDays
//
resources.ApplyResources(this.tbCacheDays, "tbCacheDays");
this.tbCacheDays.Name = "tbCacheDays";
//
// lbFreshrate
//
resources.ApplyResources(this.lbFreshrate, "lbFreshrate");
this.lbFreshrate.Name = "lbFreshrate";
//
// lbCacheDays
//
resources.ApplyResources(this.lbCacheDays, "lbCacheDays");
this.lbCacheDays.Name = "lbCacheDays";
//
// chkEnableStatistics
//
resources.ApplyResources(this.chkEnableStatistics, "chkEnableStatistics");
this.chkEnableStatistics.Name = "chkEnableStatistics";
this.chkEnableStatistics.UseVisualStyleBackColor = true;
//
// chkAllowLANConn
//
resources.ApplyResources(this.chkAllowLANConn, "chkAllowLANConn");
@@ -522,6 +563,10 @@
resources.ApplyResources(this.panel1, "panel1");
this.panel1.Name = "panel1";
//
// configBindingSource
//
this.configBindingSource.DataSource = typeof(v2rayN.Mode.Config);
//
// OptionSettingForm
//
resources.ApplyResources(this, "$this");
@@ -553,6 +598,7 @@
this.tabPage7.ResumeLayout(false);
this.tabPage7.PerformLayout();
this.panel2.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.configBindingSource)).EndInit();
this.ResumeLayout(false);
}
@@ -619,5 +665,11 @@
private System.Windows.Forms.CheckBox chksniffingEnabled;
private System.Windows.Forms.CheckBox chksniffingEnabled2;
private System.Windows.Forms.Button btnSetDefRountingRule;
private System.Windows.Forms.CheckBox chkEnableStatistics;
private System.Windows.Forms.TextBox tbCacheDays;
private System.Windows.Forms.Label lbCacheDays;
private System.Windows.Forms.ComboBox cbFreshrate;
private System.Windows.Forms.Label lbFreshrate;
private System.Windows.Forms.BindingSource configBindingSource;
}
}

View File

@@ -1,7 +1,5 @@
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Text;
using System.Windows.Forms;
using v2rayN.Handler;
@@ -106,6 +104,37 @@ namespace v2rayN.Forms
chkAllowLANConn.Checked = config.allowLANConn;
var enableStatistics = config.enableStatistics;
chkEnableStatistics.Checked = enableStatistics;
tbCacheDays.Text = config.CacheDays.ToString();
var cbSource = new ComboItem[]
{
new ComboItem{ID = (int)Global.StatisticsFreshRate.quick, Text = UIRes.I18N("QuickFresh")},
new ComboItem{ID = (int)Global.StatisticsFreshRate.medium, Text = UIRes.I18N("MediumFresh")},
new ComboItem{ID = (int)Global.StatisticsFreshRate.slow, Text = UIRes.I18N("SlowFresh")},
};
cbFreshrate.DataSource = cbSource;
cbFreshrate.DisplayMember = "Text";
cbFreshrate.ValueMember = "ID";
switch(config.statisticsFreshRate)
{
case (int)Global.StatisticsFreshRate.quick:
cbFreshrate.SelectedItem = cbSource[0];
break;
case (int)Global.StatisticsFreshRate.medium:
cbFreshrate.SelectedItem = cbSource[1];
break;
case (int)Global.StatisticsFreshRate.slow:
cbFreshrate.SelectedItem = cbSource[2];
break;
}
}
private void btnOK_Click(object sender, EventArgs e)
@@ -148,14 +177,14 @@ namespace v2rayN.Forms
{
//日志
bool logEnabled = chklogEnabled.Checked;
string loglevel = cmbloglevel.Text.Trim();
string loglevel = cmbloglevel.Text.TrimEx();
//Mux
bool muxEnabled = chkmuxEnabled.Checked;
//本地监听
string localPort = txtlocalPort.Text.Trim();
string protocol = cmbprotocol.Text.Trim();
string localPort = txtlocalPort.Text.TrimEx();
string protocol = cmbprotocol.Text.TrimEx();
bool udpEnabled = chkudpEnabled.Checked;
bool sniffingEnabled = chksniffingEnabled.Checked;
if (Utils.IsNullOrEmpty(localPort) || !Utils.IsNumberic(localPort))
@@ -174,8 +203,8 @@ namespace v2rayN.Forms
config.inbound[0].sniffingEnabled = sniffingEnabled;
//本地监听2
string localPort2 = txtlocalPort2.Text.Trim();
string protocol2 = cmbprotocol2.Text.Trim();
string localPort2 = txtlocalPort2.Text.TrimEx();
string protocol2 = cmbprotocol2.Text.TrimEx();
bool udpEnabled2 = chkudpEnabled2.Checked;
bool sniffingEnabled2 = chksniffingEnabled2.Checked;
if (chkAllowIn2.Checked)
@@ -215,7 +244,7 @@ namespace v2rayN.Forms
config.muxEnabled = muxEnabled;
//remoteDNS
config.remoteDNS = txtremoteDNS.Text.Trim();
config.remoteDNS = txtremoteDNS.Text.TrimEx();
return 0;
}
@@ -230,9 +259,9 @@ namespace v2rayN.Forms
string domainStrategy = cmbdomainStrategy.Text;
string routingMode = cmbroutingMode.SelectedIndex.ToString();
string useragent = txtUseragent.Text.Trim();
string userdirect = txtUserdirect.Text.Trim();
string userblock = txtUserblock.Text.Trim();
string useragent = txtUseragent.Text.TrimEx();
string userdirect = txtUserdirect.Text.TrimEx();
string userblock = txtUserblock.Text.TrimEx();
config.domainStrategy = domainStrategy;
config.routingMode = routingMode;
@@ -250,12 +279,12 @@ namespace v2rayN.Forms
/// <returns></returns>
private int SaveKCP()
{
string mtu = txtKcpmtu.Text.Trim();
string tti = txtKcptti.Text.Trim();
string uplinkCapacity = txtKcpuplinkCapacity.Text.Trim();
string downlinkCapacity = txtKcpdownlinkCapacity.Text.Trim();
string readBufferSize = txtKcpreadBufferSize.Text.Trim();
string writeBufferSize = txtKcpwriteBufferSize.Text.Trim();
string mtu = txtKcpmtu.Text.TrimEx();
string tti = txtKcptti.Text.TrimEx();
string uplinkCapacity = txtKcpuplinkCapacity.Text.TrimEx();
string downlinkCapacity = txtKcpdownlinkCapacity.Text.TrimEx();
string readBufferSize = txtKcpreadBufferSize.Text.TrimEx();
string writeBufferSize = txtKcpwriteBufferSize.Text.TrimEx();
bool congestion = chkKcpcongestion.Checked;
if (Utils.IsNullOrEmpty(mtu) || !Utils.IsNumberic(mtu)
@@ -289,10 +318,30 @@ namespace v2rayN.Forms
Utils.SetAutoRun(chkAutoRun.Checked);
//自定义GFWList
config.urlGFWList = txturlGFWList.Text.Trim();
config.urlGFWList = txturlGFWList.Text.TrimEx();
config.allowLANConn = chkAllowLANConn.Checked;
var lastEnableStatistics = config.enableStatistics;
config.enableStatistics = chkEnableStatistics.Checked;
uint days = 0;
var valid = uint.TryParse(tbCacheDays.Text, out days);
if (!valid)
days = 7;
config.CacheDays = days;
config.statisticsFreshRate = (int)cbFreshrate.SelectedValue;
//if(lastEnableStatistics != config.enableStatistics)
//{
// /// https://stackoverflow.com/questions/779405/how-do-i-restart-my-c-sharp-winform-application
// // Shut down the current app instance.
// Application.Exit();
// // Restart the app passing "/restart [processId]" as cmd line args
// Process.Start(Application.ExecutablePath, "/restart " + Process.GetCurrentProcess().Id);
//}
return 0;
}
@@ -358,4 +407,10 @@ namespace v2rayN.Forms
labRoutingTips.Text = text;
}
}
class ComboItem
{
public int ID { get; set; }
public string Text { get; set; }
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -288,4 +288,13 @@
<data name="$this.Text" xml:space="preserve">
<value>参数设置</value>
</data>
<data name="chkEnableStatistics.Text" xml:space="preserve">
<value>启用统计实时网速显示和使用流量显示需要重启v2rayN客户端</value>
</data>
<data name="lbCacheDays.Text" xml:space="preserve">
<value>缓存天数0-30 0关闭缓存单独每天的数据使用情况</value>
</data>
<data name="lbFreshrate.Text" xml:space="preserve">
<value>统计刷新频率</value>
</data>
</root>

View File

@@ -26,7 +26,7 @@ namespace v2rayN.Forms
if (Index >= 0)
{
string url = ConfigHandler.GetVmessQRCode(config, Index);
if (string.IsNullOrEmpty(url))
if (Utils.IsNullOrEmpty(url))
{
picQRCode.Image = null;
txtUrl.Text = string.Empty;

View File

@@ -35,8 +35,8 @@ namespace v2rayN.Forms
{
if (subItem != null)
{
subItem.remarks = txtRemarks.Text.Trim();
subItem.url = txtUrl.Text.Trim();
subItem.remarks = txtRemarks.Text.TrimEx();
subItem.url = txtUrl.Text.TrimEx();
subItem.enabled = chkEnabled.Checked;
}
}

View File

@@ -95,6 +95,11 @@ namespace v2rayN
/// 阻止 tag值
/// </summary>
public const string blockTag = "block";
/// <summary>
///
/// </summary>
public const string StreamSecurity = "tls";
/// <summary>
/// vmess
@@ -141,6 +146,21 @@ namespace v2rayN
/// </summary>
public const string CustomIconName = "v2rayN.ico";
public const string InboundAPITagName = "api";
public const string InboundProxyTagName = "proxy";
public const string Loopback = "127.0.0.1";
public const string InboundAPIProtocal = "dokodemo-door";
public enum StatisticsFreshRate
{
quick = 1000,
medium = 2000,
slow = 3000
}
public const string StatisticLogDirectory = "Statistics";
public const string StatisticLogOverall = "overall.txt";
#endregion
#region
@@ -170,6 +190,11 @@ namespace v2rayN
/// </summary>
public static int pacPort { get; set; }
/// <summary>
///
/// </summary>
public static int statePort { get; set; }
#endregion

View File

@@ -40,6 +40,15 @@ namespace v2rayN.Handler
////默认监听端口
//config.pacPort = 8888;
// 默认缓存七天
config.CacheDays = 7;
// 默认不开启统计
config.enableStatistics = false;
// 默认中等刷新率
config.statisticsFreshRate = (int)Global.StatisticsFreshRate.medium;
}
//本地监听
@@ -152,14 +161,14 @@ namespace v2rayN.Handler
vmessItem.configVersion = 2;
vmessItem.configType = (int)EConfigType.Vmess;
vmessItem.address = vmessItem.address.Trim();
vmessItem.id = vmessItem.id.Trim();
vmessItem.security = vmessItem.security.Trim();
vmessItem.network = vmessItem.network.Trim();
vmessItem.headerType = vmessItem.headerType.Trim();
vmessItem.requestHost = vmessItem.requestHost.Trim();
vmessItem.path = vmessItem.path.Trim();
vmessItem.streamSecurity = vmessItem.streamSecurity.Trim();
vmessItem.address = vmessItem.address.TrimEx();
vmessItem.id = vmessItem.id.TrimEx();
vmessItem.security = vmessItem.security.TrimEx();
vmessItem.network = vmessItem.network.TrimEx();
vmessItem.headerType = vmessItem.headerType.TrimEx();
vmessItem.requestHost = vmessItem.requestHost.TrimEx();
vmessItem.path = vmessItem.path.TrimEx();
vmessItem.streamSecurity = vmessItem.streamSecurity.TrimEx();
if (index >= 0)
{
@@ -328,7 +337,7 @@ namespace v2rayN.Handler
{
VmessQRCode vmessQRCode = new VmessQRCode();
vmessQRCode.v = vmessItem.configVersion.ToString();
vmessQRCode.ps = vmessItem.remarks.Trim(); //备注也许很长 ;
vmessQRCode.ps = vmessItem.remarks.TrimEx(); //备注也许很长 ;
vmessQRCode.add = vmessItem.address;
vmessQRCode.port = vmessItem.port.ToString();
vmessQRCode.id = vmessItem.id;
@@ -566,9 +575,9 @@ namespace v2rayN.Handler
vmessItem.configVersion = 2;
vmessItem.configType = (int)EConfigType.Shadowsocks;
vmessItem.address = vmessItem.address.Trim();
vmessItem.id = vmessItem.id.Trim();
vmessItem.security = vmessItem.security.Trim();
vmessItem.address = vmessItem.address.TrimEx();
vmessItem.id = vmessItem.id.TrimEx();
vmessItem.security = vmessItem.security.TrimEx();
if (index >= 0)
{
@@ -607,7 +616,7 @@ namespace v2rayN.Handler
vmessItem.configVersion = 2;
vmessItem.configType = (int)EConfigType.Socks;
vmessItem.address = vmessItem.address.Trim();
vmessItem.address = vmessItem.address.TrimEx();
if (index >= 0)
{

View File

@@ -0,0 +1,446 @@
using Grpc.Core;
using System;
using System.Collections.Generic;
using System.IO;
using System.Net;
using System.Net.Sockets;
using System.Threading;
using v2rayN.Mode;
using v2rayN.Protos.Statistics;
namespace v2rayN.Handler
{
class StatisticsHandler
{
private Mode.Config config_;
private Channel channel_;
private StatsService.StatsServiceClient client_;
private Thread workThread_;
Action<ulong, ulong, ulong, ulong, List<Mode.ServerStatistics>> updateFunc_;
private bool enabled_;
public bool Enable
{
get
{
return enabled_;
}
set
{
enabled_ = value;
}
}
public bool UpdateUI;
public ulong TotalUp
{
get; private set;
}
public ulong TotalDown
{
get; private set;
}
public List<Mode.ServerStatistics> Statistic
{
get; set;
}
public ulong Up
{
get; private set;
}
public ulong Down
{
get; private set;
}
private string logPath_;
private bool exitFlag_; // true to close workThread_
public StatisticsHandler(Mode.Config config, Action<ulong, ulong, ulong, ulong, List<Mode.ServerStatistics>> update)
{
config_ = config;
enabled_ = config.enableStatistics;
UpdateUI = false;
updateFunc_ = update;
logPath_ = Utils.GetPath(Global.StatisticLogDirectory);
Statistic = new List<Mode.ServerStatistics>();
exitFlag_ = false;
DeleteExpiredLog();
foreach (var server in config.vmess)
{
var statistic = new ServerStatistics(server.remarks, server.address, server.port, server.path, server.requestHost, 0, 0, 0, 0);
Statistic.Add(statistic);
}
LoadFromFile();
GrpcInit();
workThread_ = new Thread(new ThreadStart(Run));
workThread_.Start();
}
private void GrpcInit()
{
if (channel_ == null)
{
Global.statePort = GetFreePort();
channel_ = new Channel($"127.0.0.1:{Global.statePort}", ChannelCredentials.Insecure);
channel_.ConnectAsync();
client_ = new StatsService.StatsServiceClient(channel_);
}
}
public void Close()
{
try
{
exitFlag_ = true;
channel_.ShutdownAsync();
}
catch (Exception ex)
{
Utils.SaveLog(ex.Message, ex);
}
}
public void Run()
{
while (!exitFlag_)
{
try
{
if (enabled_ && channel_.State == ChannelState.Ready)
{
QueryStatsResponse res = null;
try
{
res = client_.QueryStats(new QueryStatsRequest() { Pattern = "", Reset = true });
}
catch (Exception ex)
{
Utils.SaveLog(ex.Message, ex);
}
if (res != null)
{
var addr = config_.address();
var port = config_.port();
var path = config_.path();
var cur = Statistic.FindIndex(item => item.address == addr && item.port == port && item.path == path);
ulong up = 0,
down = 0;
//TODO: parse output
ParseOutput(res.Stat, out up, out down);
Up = up;
Down = down;
TotalUp += up;
TotalDown += down;
if (cur != -1)
{
Statistic[cur].todayUp += up;
Statistic[cur].todayDown += down;
Statistic[cur].totalUp += up;
Statistic[cur].totalDown += down;
}
if (UpdateUI)
updateFunc_(TotalUp, TotalDown, Up, Down, Statistic);
}
}
Thread.Sleep(config_.statisticsFreshRate);
channel_.ConnectAsync();
}
catch (Exception ex)
{
Utils.SaveLog(ex.Message, ex);
}
}
}
public void ParseOutput(Google.Protobuf.Collections.RepeatedField<Stat> source, out ulong up, out ulong down)
{
up = 0; down = 0;
try
{
foreach (var stat in source)
{
var name = stat.Name;
var value = stat.Value;
var nStr = name.Split(">>>".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
var type = "";
name = name.Trim();
name = nStr[1];
type = nStr[3];
if (name == Global.InboundProxyTagName)
{
if (type == "uplink")
{
up = (ulong)value;
}
else if (type == "downlink")
{
down = (ulong)value;
}
}
}
}
catch (Exception ex)
{
Utils.SaveLog(ex.Message, ex);
}
}
public void SaveToFile()
{
if (!Directory.Exists(logPath_))
{
Directory.CreateDirectory(logPath_);
}
// 总流量统计文件
var overallPath = Path.Combine(logPath_, Global.StatisticLogOverall);
if (!File.Exists(overallPath))
{
File.Create(overallPath);
}
try
{
using (var overallWriter = new StreamWriter(overallPath))
{
double up_amount, down_amount;
string up_unit, down_unit;
Utils.ToHumanReadable(TotalUp, out up_amount, out up_unit);
Utils.ToHumanReadable(TotalDown, out down_amount, out down_unit);
overallWriter.WriteLine($"LastUpdate {DateTime.Now.ToString("yyyy-MM-dd")} {DateTime.Now.ToLongTimeString()}");
overallWriter.WriteLine($"UP {string.Format("{0:f2}", up_amount)}{up_unit} {TotalUp}");
overallWriter.WriteLine($"DOWN {string.Format("{0:f2}", down_amount)}{down_unit} {TotalDown}");
foreach (var s in Statistic)
{
overallWriter.WriteLine($"* {s.name} {s.address} {s.port} {s.path} {s.host} {s.totalUp} {s.totalDown}");
}
}
}
catch (Exception ex)
{
Utils.SaveLog(ex.Message, ex);
}
// 当天流量记录文件
var dailyPath = Path.Combine(logPath_, $"{DateTime.Now.ToString("yyyy-MM-dd")}.txt");
if (!File.Exists(dailyPath))
{
File.Create(dailyPath);
}
try
{
using (var dailyWriter = new StreamWriter(dailyPath))
{
dailyWriter.WriteLine($"LastUpdate {DateTime.Now.ToString("yyyy-MM-dd")} {DateTime.Now.ToLongTimeString()}");
foreach (var s in Statistic)
{
dailyWriter.WriteLine($"* {s.name} {s.address} {s.port} {s.path} {s.host} {s.todayUp} {s.todayDown}");
}
}
}
catch (Exception ex)
{
Utils.SaveLog(ex.Message, ex);
}
}
public void LoadFromFile()
{
if (!Directory.Exists(logPath_)) return;
// 总流量统计文件
///
/// 文件结构
/// LastUpdate [date] [time]
/// UP [readable string] [amount]
/// DOWN [readable string] [amount]
/// 每行每个数据空格分隔
try
{
Utils.SaveLog(logPath_ + Global.StatisticLogOverall);
var overallPath = Path.Combine(logPath_, Global.StatisticLogOverall);
if (File.Exists(overallPath))
{
using (var overallReader = new StreamReader(overallPath))
{
while (!overallReader.EndOfStream)
{
var line = overallReader.ReadLine();
if (line.StartsWith("LastUpdate"))
{
}
else if (line.StartsWith("UP"))
{
var datas = line.Split(' ');
if (datas.Length < 3) return;
TotalUp = ulong.Parse(datas[2]);
}
else if (line.StartsWith("DOWN"))
{
var datas = line.Split(' ');
if (datas.Length < 3) return;
TotalDown = ulong.Parse(datas[2]);
}
else if (line.StartsWith("*"))
{
var datas = line.Split(' ');
if (datas.Length < 8) return;
var name = datas[1];
var address = datas[2];
var port = int.Parse(datas[3]);
var path = datas[4];
var host = datas[5];
var totalUp = ulong.Parse(datas[6]);
var totalDown = ulong.Parse(datas[7]);
var temp = new ServerStatistics(name, address, port, path, host, 0, 0, 0, 0);
var index = Statistic.FindIndex(item => Utils.IsIdenticalServer(item, temp));
if (index != -1)
{
Statistic[index].totalUp = totalUp;
Statistic[index].totalDown = totalDown;
}
else
{
var s = new Mode.ServerStatistics(name, address, port, path, host, totalUp, totalDown, 0, 0);
Statistic.Add(s);
}
}
}
}
}
}
catch (Exception ex)
{
Utils.SaveLog(ex.Message, ex);
}
try
{
Utils.SaveLog(logPath_ + $"{DateTime.Now.ToString("yyyy-MM-dd")}.txt");
var dailyPath = Path.Combine(logPath_, $"{DateTime.Now.ToString("yyyy-MM-dd")}.txt");
if (File.Exists(dailyPath))
{
using (var dailyReader = new StreamReader(dailyPath))
{
while (!dailyReader.EndOfStream)
{
var line = dailyReader.ReadLine();
if (line.StartsWith("LastUpdate"))
{
}
else if (line.StartsWith("*"))
{
var datas = line.Split(' ');
if (datas.Length < 8) return;
var name = datas[1];
var address = datas[2];
var port = int.Parse(datas[3]);
var path = datas[4];
var host = datas[5];
var todayUp = ulong.Parse(datas[6]);
var todayDown = ulong.Parse(datas[7]);
var temp = new ServerStatistics(name, address, port, path, host, 0, 0, 0, 0);
var index = Statistic.FindIndex(item => Utils.IsIdenticalServer(item, temp));
if (index != -1)
{
Statistic[index].todayUp = todayUp;
Statistic[index].todayDown = todayDown;
}
else
{
var s = new Mode.ServerStatistics(name, address, port, path, host, 0, 0, todayUp, todayDown);
Statistic.Add(s);
}
}
}
}
}
}
catch (Exception ex)
{
Utils.SaveLog(ex.Message, ex);
}
}
private void DeleteExpiredLog()
{
try
{
if (!Directory.Exists(logPath_)) return;
var dirInfo = new DirectoryInfo(logPath_);
var files = dirInfo.GetFiles();
foreach (var file in files)
{
if (file.Name == "overall.txt") continue;
var name = file.Name.Split('.')[0];
var ft = DateTime.Parse(name);
var ct = DateTime.Now;
var dur = ct - ft;
if (dur.Days > config_.CacheDays)
{
file.Delete();
}
}
}
catch (Exception ex)
{
Utils.SaveLog(ex.Message, ex);
}
}
private int GetFreePort()
{
int defaultPort = 28123;
try
{
// TCP stack please do me a favor
TcpListener l = new TcpListener(IPAddress.Loopback, 0);
l.Start();
var port = ((IPEndPoint)l.LocalEndpoint).Port;
l.Stop();
return port;
}
catch (Exception ex)
{
// in case access denied
Utils.SaveLog(ex.Message, ex);
return defaultPort;
}
}
}
}

View File

@@ -4,6 +4,7 @@ using System.IO;
using v2rayN.Mode;
using System.Net;
using System.Text;
using System.Linq;
namespace v2rayN.Handler
{
@@ -78,6 +79,9 @@ namespace v2rayN.Handler
//dns
dns(config, ref v2rayConfig);
// TODO: 统计配置
statistic(config, ref v2rayConfig);
Utils.ToJsonFile(v2rayConfig, fileName);
msg = string.Format(UIRes.I18N("SuccessfulConfiguration"), config.getSummary());
@@ -235,7 +239,7 @@ namespace v2rayN.Handler
for (int k = 0; k < userRule.Count; k++)
{
string url = userRule[k].Trim();
string url = userRule[k].TrimEx();
if (Utils.IsNullOrEmpty(url))
{
continue;
@@ -400,8 +404,8 @@ namespace v2rayN.Handler
serversItem.address = config.address();
serversItem.port = config.port();
if (!string.IsNullOrEmpty(config.security())
&& !string.IsNullOrEmpty(config.id()))
if (!Utils.IsNullOrEmpty(config.security())
&& !Utils.IsNullOrEmpty(config.id()))
{
var socksUsersItem = new SocksUsersItem();
socksUsersItem.user = config.security();
@@ -439,7 +443,7 @@ namespace v2rayN.Handler
var host = config.requestHost();
//if tls
if (config.streamSecurity() == "tls")
if (config.streamSecurity() == Global.StreamSecurity)
{
streamSettings.security = config.streamSecurity();
@@ -613,6 +617,53 @@ namespace v2rayN.Handler
return 0;
}
public static int statistic(Config config, ref V2rayConfig v2rayConfig)
{
if (config.enableStatistics)
{
var tag = Global.InboundAPITagName;
var apiObj = new Mode.API();
var policyObj = new Mode.Policy();
var policySystemSetting = new Mode.SystemPolicy();
string[] services = { "StatsService" };
v2rayConfig.stats = new Stats();
apiObj.tag = tag;
apiObj.services = services.ToList();
v2rayConfig.api = apiObj;
policySystemSetting.statsInboundDownlink = true;
policySystemSetting.statsInboundUplink = true;
policyObj.system = policySystemSetting;
v2rayConfig.policy = policyObj;
if (!v2rayConfig.inbounds.Exists(item => { return item.tag == tag; }))
{
var apiInbound = new Mode.Inbounds();
var apiInboundSettings = new Mode.Inboundsettings();
apiInbound.tag = tag;
apiInbound.listen = Global.Loopback;
apiInbound.port = Global.statePort;
apiInbound.protocol = Global.InboundAPIProtocal;
apiInboundSettings.address = Global.Loopback;
apiInbound.settings = apiInboundSettings;
v2rayConfig.inbounds.Add(apiInbound);
}
if (!v2rayConfig.routing.rules.Exists(item => { return item.outboundTag == tag; }))
{
var apiRoutingRule = new Mode.RulesItem();
apiRoutingRule.inboundTag = tag;
apiRoutingRule.outboundTag = tag;
apiRoutingRule.type = "field";
v2rayConfig.routing.rules.Add(apiRoutingRule);
}
}
return 0;
}
/// <summary>
/// 生成v2ray的客户端配置文件(自定义配置)
/// </summary>
@@ -913,6 +964,13 @@ namespace v2rayN.Handler
}
}
//tls
if (outbound.streamSettings != null
&& outbound.streamSettings.security != null
&& outbound.streamSettings.security == Global.StreamSecurity)
{
vmessItem.streamSecurity = Global.StreamSecurity;
}
}
catch
{
@@ -1050,6 +1108,14 @@ namespace v2rayN.Handler
vmessItem.requestHost = Utils.List2String(inbound.streamSettings.httpSettings.host);
}
}
//tls
if (inbound.streamSettings != null
&& inbound.streamSettings.security != null
&& inbound.streamSettings.security == Global.StreamSecurity)
{
vmessItem.streamSecurity = Global.StreamSecurity;
}
}
catch
{
@@ -1073,7 +1139,7 @@ namespace v2rayN.Handler
try
{
//载入配置文件
string result = clipboardData.Trim();// Utils.GetClipboardData();
string result = clipboardData.TrimEx();// Utils.GetClipboardData();
if (Utils.IsNullOrEmpty(result))
{
msg = UIRes.I18N("FailedReadConfiguration");
@@ -1104,17 +1170,26 @@ namespace v2rayN.Handler
vmessItem.network = Global.DefaultNetwork;
vmessItem.headerType = Global.None;
vmessItem.configVersion = Utils.ToInt(vmessQRCode.v);
vmessItem.remarks = vmessQRCode.ps;
vmessItem.address = vmessQRCode.add;
vmessItem.remarks = Utils.ToString(vmessQRCode.ps);
vmessItem.address = Utils.ToString(vmessQRCode.add);
vmessItem.port = Utils.ToInt(vmessQRCode.port);
vmessItem.id = vmessQRCode.id;
vmessItem.id = Utils.ToString(vmessQRCode.id);
vmessItem.alterId = Utils.ToInt(vmessQRCode.aid);
vmessItem.network = vmessQRCode.net;
vmessItem.headerType = vmessQRCode.type;
vmessItem.requestHost = vmessQRCode.host;
vmessItem.path = vmessQRCode.path;
vmessItem.streamSecurity = vmessQRCode.tls;
if (!Utils.IsNullOrEmpty(vmessQRCode.net))
{
vmessItem.network = vmessQRCode.net;
}
if (!Utils.IsNullOrEmpty(vmessQRCode.type))
{
vmessItem.headerType = vmessQRCode.type;
}
vmessItem.requestHost = Utils.ToString(vmessQRCode.host);
vmessItem.path = Utils.ToString(vmessQRCode.path);
vmessItem.streamSecurity = Utils.ToString(vmessQRCode.tls);
}
ConfigHandler.UpgradeServerVersion(ref vmessItem);

View File

@@ -12,7 +12,7 @@ namespace v2rayN.HttpProxyHandler
{
private static string GetTimestamp(DateTime value)
{
return value.ToString("yyyyMMddHHmmssfff");
return value.ToString("MMddHHmmssfff");
}
public static void ReSetPACProxy(Config config)

View File

@@ -8,9 +8,9 @@ namespace v2rayN.HttpProxyHandler
public class HttpWebServer
{
private HttpListener _listener;
private Func<HttpListenerRequest, string> _responderMethod;
private Func<string, string> _responderMethod;
public HttpWebServer(string[] prefixes, Func<HttpListenerRequest, string> method)
public HttpWebServer(string[] prefixes, Func<string, string> method)
{
try
{
@@ -39,10 +39,11 @@ namespace v2rayN.HttpProxyHandler
catch (Exception ex)
{
Utils.SaveLog(ex.Message, ex);
throw;
}
}
public HttpWebServer(Func<HttpListenerRequest, string> method, params string[] prefixes)
public HttpWebServer(Func<string, string> method, params string[] prefixes)
: this(prefixes, method) { }
public void Run()
@@ -59,8 +60,9 @@ namespace v2rayN.HttpProxyHandler
var ctx = c as HttpListenerContext;
try
{
string rstr = _responderMethod(ctx.Request);
byte[] buf = Encoding.UTF8.GetBytes(rstr);
string address = ctx.Request.LocalEndPoint.Address.ToString();
string rstr = _responderMethod(address);
byte[] buf = Encoding.ASCII.GetBytes(rstr);
ctx.Response.StatusCode = 200;
ctx.Response.ContentType = "application/x-ns-proxy-autoconfig";
ctx.Response.ContentLength64 = buf.Length;

View File

@@ -1,132 +0,0 @@
using System;
using System.IO;
using System.Net;
using System.Net.Sockets;
using System.Text;
using System.Threading;
namespace v2rayN.HttpProxyHandler
{
public class HttpWebServerB
{
private int port;
private TcpListener listener;
private Func<TcpClient, string> _responderMethod;
public HttpWebServerB(int port, Func<TcpClient, string> method)
{
try
{
this.port = port;
this._responderMethod = method;
listener = new TcpListener(new IPEndPoint(IPAddress.Any, port));
listener.Server.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReuseAddress, true);
listener.Start();
}
catch (Exception ex)
{
Utils.SaveLog(ex.Message, ex);
}
Utils.SaveLog("WebserverB running...");
AsyncCallback callback = null;
listener.BeginAcceptTcpClient(callback = ((ares) =>
{
try
{
if (listener != null)
{
TcpClient tcpClient = listener.EndAcceptTcpClient(ares);
listener.BeginAcceptTcpClient(callback, null);
if (tcpClient != null && _responderMethod != null)
{
string pac = _responderMethod(tcpClient);
NetworkStream netStream = tcpClient.GetStream();
if (netStream.CanRead)
{
// Reads NetworkStream into a byte buffer.
byte[] bytes = new byte[tcpClient.ReceiveBufferSize];
// Read can return anything from 0 to numBytesToRead.
// This method blocks until at least one byte is read.
netStream.Read(bytes, 0, (int)tcpClient.ReceiveBufferSize);
// Returns the data received from the host to the console.
string returndata = Encoding.UTF8.GetString(bytes);
if (!string.IsNullOrEmpty(returndata)
&& returndata.IndexOf("/pac/") >= 0
&& netStream.CanWrite)
{
BinaryWriter writer = new BinaryWriter(netStream);
//writeSuccess(writer, pac);
Byte[] sendBytes = Encoding.UTF8.GetBytes(writeSuccess(pac));
writer.Write(sendBytes, 0, sendBytes.Length);
writer.Flush();
writer.Close();
}
}
netStream.Close();
tcpClient.Close();
}
}
}
catch (Exception ex)
{
Utils.SaveLog(ex.Message, ex);
}
//Console.WriteLine("Client connected completed");
}), null);
}
public void Stop()
{
if (listener != null)
{
listener.Stop();
listener = null;
}
}
//private static void writeSuccess(BinaryWriter writer, string pac)
//{
// writer.Write("HTTP/1.0 200 OK");
// writer.Write(Environment.NewLine);
// writer.Write("Content-Type:application/x-ns-proxy-autoconfig; charset=UTF-8");
// writer.Write(Environment.NewLine);
// writer.Write("Content-Length: " + pac.Length);
// writer.Write(Environment.NewLine);
// writer.Write(Environment.NewLine);
// writer.Write(pac);
// writer.Flush();
//}
private static string writeSuccess(string pac)
{
StringBuilder sb = new StringBuilder();
string content_type = "application/x-ns-proxy-autoconfig";
sb.Append("HTTP/1.0 200 OK");
sb.AppendLine();
sb.Append(String.Format("Content-Type:{0};charset=utf-8", content_type));
sb.AppendLine();
//sb.Append("Connection: close");
//sb.AppendLine();
sb.Append(pac);
sb.AppendLine();
return sb.ToString();
}
}
}

View File

@@ -17,21 +17,33 @@ namespace v2rayN.HttpProxyHandler
{
private static int pacPort = 0;
private static HttpWebServer server;
private static HttpWebServerB serverB;
public static void Init(Config config)
public static bool IsRunning
{
if (Utils.IsAdministrator())
get
{
InitServer("127.0.0.1");
}
else
{
InitServerB("127.0.0.1");
return (server != null && pacPort > 0);
}
}
public static void InitServer(string address)
public static void Init(Config config)
{
if (InitServer("*"))
{
pacPort = Global.pacPort;
}
else if (InitServer("127.0.0.1"))
{
pacPort = Global.pacPort;
}
else
{
Utils.SaveLog("Webserver init failed ");
pacPort = 0;
}
}
private static bool InitServer(string address)
{
try
{
@@ -45,13 +57,13 @@ namespace v2rayN.HttpProxyHandler
if (server == null)
{
string prefixes = string.Format("http://{0}:{1}/pac/", "+", Global.pacPort);
string prefixes = string.Format("http://{0}:{1}/pac/", address, Global.pacPort);
Utils.SaveLog("Webserver prefixes " + prefixes);
HttpWebServer ws = new HttpWebServer(SendResponse, prefixes);
ws.Run();
server = new HttpWebServer(SendResponse, prefixes);
server.Run();
pacPort = Global.pacPort;
//pacPort = Global.pacPort;
}
}
Utils.SaveLog("Webserver at " + address);
@@ -59,41 +71,15 @@ namespace v2rayN.HttpProxyHandler
catch (Exception ex)
{
Utils.SaveLog("Webserver InitServer " + ex.Message);
return false;
}
return true;
}
public static void InitServerB(string address)
public static string SendResponse(string address)
{
try
{
if (pacPort != Global.pacPort)
{
if (serverB != null)
{
serverB.Stop();
serverB = null;
}
if (serverB == null)
{
serverB = new HttpWebServerB(Global.pacPort, SendResponse);
pacPort = Global.pacPort;
}
}
Utils.SaveLog("Webserver at " + address);
}
catch (Exception ex)
{
Utils.SaveLog("Webserver InitServer " + ex.Message);
}
}
public static string SendResponse(HttpListenerRequest request)
{
try
{
string address = request.LocalEndPoint.Address.ToString();
var pac = GetPacList(address);
return pac;
}
@@ -103,27 +89,6 @@ namespace v2rayN.HttpProxyHandler
return ex.Message;
}
}
public static string SendResponse(TcpClient tcpClient)
{
try
{
var address = ((IPEndPoint)tcpClient.Client.LocalEndPoint).Address.ToString();
var pac = GetPacList(address);
Console.WriteLine("SendResponse addr " + address);
//Utils.SaveLog("SendResponse addr " + address);
return pac;
}
catch (Exception ex)
{
Utils.SaveLog(ex.Message, ex);
}
return "";
}
public static void Stop()
{
@@ -159,6 +124,7 @@ namespace v2rayN.HttpProxyHandler
//}
}
private static string GetPacList(string address)
{
var port = Global.sysAgentPort;
@@ -182,8 +148,10 @@ namespace v2rayN.HttpProxyHandler
return pac;
}
catch
{ }
{
}
return "No pac content";
}
}
}

View File

@@ -19,7 +19,7 @@ namespace v2rayN.HttpProxyHandler
{
InternetPerConnOptionList list = new InternetPerConnOptionList();
int optionCount = string.IsNullOrEmpty(strProxy) ? 1 : (string.IsNullOrEmpty(exceptions) ? 2 : 3);
int optionCount = Utils.IsNullOrEmpty(strProxy) ? 1 : (Utils.IsNullOrEmpty(exceptions) ? 2 : 3);
InternetConnectionOption[] options = new InternetConnectionOption[optionCount];
// USE a proxy server ...
options[0].m_Option = PerConnOption.INTERNET_PER_CONN_FLAGS;

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -91,6 +91,32 @@ namespace v2rayN.Mode
/// </summary>
public bool allowLANConn { get; set; }
/// <summary>
/// 启用实时网速和流量统计
/// </summary>
public bool enableStatistics { get; set; }
/// <summary>
/// 视图刷新率
/// </summary>
public int statisticsFreshRate { get; set; }
/// <summary>
/// 统计数据缓存天数 [0, 30]
/// * 0 关闭单独每天使用流量的缓存
/// * 无论如何不会关闭总流量的缓存
/// </summary>
private uint cacheDays;
public uint CacheDays {
get { return cacheDays; }
set
{
if (value < 0) cacheDays = 0;
else if (value > 30) cacheDays = 30;
else cacheDays = value;
}
}
/// <summary>
/// 自定义远程DNS
/// </summary>
@@ -112,7 +138,7 @@ namespace v2rayN.Mode
{
return string.Empty;
}
return vmess[index].address.Trim();
return vmess[index].address.TrimEx();
}
public int port()
@@ -130,7 +156,7 @@ namespace v2rayN.Mode
{
return string.Empty;
}
return vmess[index].id.Trim();
return vmess[index].id.TrimEx();
}
public int alterId()
@@ -148,7 +174,7 @@ namespace v2rayN.Mode
{
return string.Empty;
}
return vmess[index].security.Trim();
return vmess[index].security.TrimEx();
}
public string remarks()
@@ -157,7 +183,7 @@ namespace v2rayN.Mode
{
return string.Empty;
}
return vmess[index].remarks.Trim();
return vmess[index].remarks.TrimEx();
}
public string network()
{
@@ -165,7 +191,7 @@ namespace v2rayN.Mode
{
return Global.DefaultNetwork;
}
return vmess[index].network.Trim();
return vmess[index].network.TrimEx();
}
public string headerType()
{
@@ -173,7 +199,7 @@ namespace v2rayN.Mode
{
return Global.None;
}
return vmess[index].headerType.Replace(" ", "").Trim();
return vmess[index].headerType.Replace(" ", "").TrimEx();
}
public string requestHost()
{
@@ -181,7 +207,7 @@ namespace v2rayN.Mode
{
return string.Empty;
}
return vmess[index].requestHost.Replace(" ", "").Trim();
return vmess[index].requestHost.Replace(" ", "").TrimEx();
}
public string path()
{
@@ -189,7 +215,7 @@ namespace v2rayN.Mode
{
return string.Empty;
}
return vmess[index].path.Replace(" ", "").Trim();
return vmess[index].path.Replace(" ", "").TrimEx();
}
public string streamSecurity()
{

View File

@@ -0,0 +1,35 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace v2rayN.Mode
{
class ServerStatistics
{
public string name;
public string address;
public int port;
public string path;
public string host;
public ulong totalUp;
public ulong totalDown;
public ulong todayUp;
public ulong todayDown;
public ServerStatistics() { }
public ServerStatistics(string name, string addr, int port, string path, string host, ulong totalUp, ulong totalDown, ulong todayUp, ulong todayDown)
{
this.name = name;
this.address = addr;
this.port = port;
this.path = path;
this.host = host;
this.totalUp = totalUp;
this.totalDown = totalDown;
this.todayUp = todayUp;
this.todayDown = todayDown;
}
}
}

View File

@@ -21,6 +21,17 @@ namespace v2rayN.Mode
/// </summary>
public List<Outbounds> outbounds { get; set; }
/// <summary>
/// 统计需要, 空对象
/// </summary>
public Stats stats { get; set; }
/// </summary>
public API api { get; set; }
/// </summary>
public Policy policy;
/// <summary>
/// DNS 配置
/// </summary>
@@ -31,6 +42,25 @@ namespace v2rayN.Mode
public Routing routing { get; set; }
}
public class Stats { };
public class API
{
public string tag { get; set; }
public List<string> services { get; set; }
}
public class Policy
{
public SystemPolicy system;
}
public class SystemPolicy
{
public bool statsInboundUplink;
public bool statsInboundDownlink;
}
public class Log
{
/// <summary>
@@ -49,6 +79,7 @@ namespace v2rayN.Mode
public class Inbounds
{
public string tag { get; set; }
/// <summary>
///
/// </summary>
@@ -92,6 +123,11 @@ namespace v2rayN.Mode
/// </summary>
public string ip { get; set; }
/// <summary>
/// api 使用
/// </summary>
public string address { get; set; }
/// <summary>
///
/// </summary>
@@ -273,6 +309,8 @@ namespace v2rayN.Mode
///
/// </summary>
public string port { get; set; }
public string inboundTag { get; set; }
/// <summary>
///
/// </summary>

View File

@@ -49,5 +49,5 @@ namespace v2rayN.Mode
/// 底层传输安全
/// </summary>
public string tls { get; set; } = string.Empty;
}
}
}

View File

@@ -28,6 +28,7 @@ namespace v2rayN
AppDomain.CurrentDomain.AssemblyResolve += CurrentDomain_AssemblyResolve;
Process instance = RunningInstance();
if (instance == null)
{
@@ -43,7 +44,7 @@ namespace v2rayN
}
else
{
UI.Show("v2rayN is already running(v2rayN已经运行)");
UI.Show($"v2rayN is already running(v2rayN已经运行)");
}
}
@@ -51,7 +52,7 @@ namespace v2rayN
{
try
{
string resourceName = "v2rayN." + new AssemblyName(args.Name).Name + ".dll";
string resourceName = "v2rayN.LIB." + new AssemblyName(args.Name).Name + ".dll";
using (var stream = Assembly.GetExecutingAssembly().GetManifestResourceStream(resourceName))
{
if (stream == null)

View File

@@ -33,4 +33,4 @@ using System.Runtime.InteropServices;
// 方法是按如下所示使用“*”:
//[assembly: AssemblyVersion("1.0.*")]
//[assembly: AssemblyVersion("1.0.0")]
[assembly: AssemblyFileVersion("2.35")]
[assembly: AssemblyFileVersion("2.42")]

View File

@@ -0,0 +1,53 @@
syntax = "proto3";
package v2ray.core.app.stats.command;
option csharp_namespace = "v2rayN.Protos.Statistics";
message GetStatsRequest {
// Name of the stat counter.
string name = 1;
// Whether or not to reset the counter to fetching its value.
bool reset = 2;
}
message Stat {
string name = 1;
int64 value = 2;
}
message GetStatsResponse {
Stat stat = 1;
}
message QueryStatsRequest {
string pattern = 1;
bool reset = 2;
}
message QueryStatsResponse {
repeated Stat stat = 1;
}
message SysStatsRequest {
}
message SysStatsResponse {
uint32 NumGoroutine = 1;
uint32 NumGC = 2;
uint64 Alloc = 3;
uint64 TotalAlloc = 4;
uint64 Sys = 5;
uint64 Mallocs = 6;
uint64 Frees = 7;
uint64 LiveObjects = 8;
uint64 PauseTotalNs = 9;
uint32 Uptime = 10;
}
service StatsService {
rpc GetStats(GetStatsRequest) returns (GetStatsResponse) {}
rpc QueryStats(QueryStatsRequest) returns (QueryStatsResponse) {}
rpc GetSysStats(SysStatsRequest) returns (SysStatsResponse) {}
}
message Config {}

View File

@@ -19,7 +19,7 @@ namespace v2rayN.Resx {
// 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
// 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen
// (以 /str 作为命令选项),或重新生成 VS 项目。
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class ResUI {
@@ -47,7 +47,7 @@ namespace v2rayN.Resx {
}
/// <summary>
/// 使用此强类型资源类,为所有资源查找
/// 重写当前线程的 CurrentUICulture 属性
/// 重写当前线程的 CurrentUICulture 属性。
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
@@ -105,6 +105,15 @@ namespace v2rayN.Resx {
}
}
/// <summary>
/// 查找类似 DOWN 的本地化字符串。
/// </summary>
internal static string downloadSpeed {
get {
return ResourceManager.GetString("downloadSpeed", resourceCulture);
}
}
/// <summary>
/// 查找类似 Whether to download? {0} 的本地化字符串。
/// </summary>
@@ -321,6 +330,42 @@ namespace v2rayN.Resx {
}
}
/// <summary>
/// 查找类似 Today download traffic 的本地化字符串。
/// </summary>
internal static string LvTodayDownloadDataAmount {
get {
return ResourceManager.GetString("LvTodayDownloadDataAmount", resourceCulture);
}
}
/// <summary>
/// 查找类似 Today upload traffic 的本地化字符串。
/// </summary>
internal static string LvTodayUploadDataAmount {
get {
return ResourceManager.GetString("LvTodayUploadDataAmount", resourceCulture);
}
}
/// <summary>
/// 查找类似 Total download traffic 的本地化字符串。
/// </summary>
internal static string LvTotalDownloadDataAmount {
get {
return ResourceManager.GetString("LvTotalDownloadDataAmount", resourceCulture);
}
}
/// <summary>
/// 查找类似 Total upload traffic 的本地化字符串。
/// </summary>
internal static string LvTotalUploadDataAmount {
get {
return ResourceManager.GetString("LvTotalUploadDataAmount", resourceCulture);
}
}
/// <summary>
/// 查找类似 Transport 的本地化字符串。
/// </summary>
@@ -330,6 +375,15 @@ namespace v2rayN.Resx {
}
}
/// <summary>
/// 查找类似 MediumFresh 的本地化字符串。
/// </summary>
internal static string MediumFresh {
get {
return ResourceManager.GetString("MediumFresh", resourceCulture);
}
}
/// <summary>
/// 查找类似 Clear original subscription content 的本地化字符串。
/// </summary>
@@ -582,6 +636,15 @@ namespace v2rayN.Resx {
}
}
/// <summary>
/// 查找类似 QuickFresh 的本地化字符串。
/// </summary>
internal static string QuickFresh {
get {
return ResourceManager.GetString("QuickFresh", resourceCulture);
}
}
/// <summary>
/// 查找类似 Are you sure to remove the server? 的本地化字符串。
/// </summary>
@@ -609,6 +672,15 @@ namespace v2rayN.Resx {
}
}
/// <summary>
/// 查找类似 SlowFresh 的本地化字符串。
/// </summary>
internal static string SlowFresh {
get {
return ResourceManager.GetString("SlowFresh", resourceCulture);
}
}
/// <summary>
/// 查找类似 Note: After this function relies on the Http global proxy test, please manually adjust the Http global proxy and active node! 的本地化字符串。
/// </summary>
@@ -618,6 +690,15 @@ namespace v2rayN.Resx {
}
}
/// <summary>
/// 查找类似 PAC failed to start. Pls with an administrator. 的本地化字符串。
/// </summary>
internal static string StartPacFailed {
get {
return ResourceManager.GetString("StartPacFailed", resourceCulture);
}
}
/// <summary>
/// 查找类似 Start service ({0})...... 的本地化字符串。
/// </summary>

View File

@@ -319,4 +319,31 @@
<data name="MsgUpdateV2rayCoreSuccessfullyMore" xml:space="preserve">
<value>Update V2rayCore successfully! Restarting service...</value>
</data>
<data name="MediumFresh" xml:space="preserve">
<value>MediumFresh</value>
</data>
<data name="QuickFresh" xml:space="preserve">
<value>QuickFresh</value>
</data>
<data name="SlowFresh" xml:space="preserve">
<value>SlowFresh</value>
</data>
<data name="downloadSpeed" xml:space="preserve">
<value>DOWN</value>
</data>
<data name="LvTodayDownloadDataAmount" xml:space="preserve">
<value>Today download traffic</value>
</data>
<data name="LvTodayUploadDataAmount" xml:space="preserve">
<value>Today upload traffic</value>
</data>
<data name="LvTotalDownloadDataAmount" xml:space="preserve">
<value>Total download traffic</value>
</data>
<data name="LvTotalUploadDataAmount" xml:space="preserve">
<value>Total upload traffic</value>
</data>
<data name="StartPacFailed" xml:space="preserve">
<value>PAC failed to start. Pls with an administrator.</value>
</data>
</root>

View File

@@ -319,4 +319,31 @@
<data name="MsgUpdateV2rayCoreSuccessfullyMore" xml:space="preserve">
<value>更新V2rayCore成功正在重启服务...</value>
</data>
<data name="MediumFresh" xml:space="preserve">
<value>中等</value>
</data>
<data name="QuickFresh" xml:space="preserve">
<value>快</value>
</data>
<data name="SlowFresh" xml:space="preserve">
<value>慢</value>
</data>
<data name="downloadSpeed" xml:space="preserve">
<value>下载</value>
</data>
<data name="LvTodayDownloadDataAmount" xml:space="preserve">
<value>今日下载</value>
</data>
<data name="LvTodayUploadDataAmount" xml:space="preserve">
<value>今日上传</value>
</data>
<data name="LvTotalDownloadDataAmount" xml:space="preserve">
<value>总下载</value>
</data>
<data name="LvTotalUploadDataAmount" xml:space="preserve">
<value>总上传</value>
</data>
<data name="StartPacFailed" xml:space="preserve">
<value>PAC服务启动失败,请用管理员启动</value>
</data>
</root>

View File

@@ -1,25 +1,33 @@
{
{
"log": {
"access": "",
"error": "",
"loglevel": "error"
},
"log": {
"access": "Vaccess.log",
"error": "Verror.log",
"loglevel": "warning"
},
"inbounds": [{
"port": 10808,
"protocol": "socks",
"listen": "127.0.0.1",
"settings": {
"auth": "noauth",
"udp": true
},
"sniffing": {
"enabled": true,
"destOverride": [
"http",
"tls"
]
"inbounds": [
{
"tag": "proxy",
"port": 10808,
"protocol": "socks",
"listen": "127.0.0.1",
"settings": {
"auth": "noauth",
"udp": true
},
"sniffing": {
"enabled": true,
"destOverride": [
"http",
"tls"
]
}
}
}],
],
"outbounds": [{
"tag": "proxy",
"protocol": "vmess",
@@ -66,6 +74,12 @@
],
"routing": {
"domainStrategy": "IPIfNonMatch",
"rules": []
"rules": [
{
"inboundTag": "api",
"outboundTag": "api",
"type": "field"
}
]
}
}

View File

@@ -43,5 +43,10 @@ namespace v2rayN
yield return line;
}
}
public static string TrimEx(this string value)
{
return value == null ? string.Empty : value.Trim();
}
}
}

View File

@@ -212,7 +212,7 @@ namespace v2rayN
{
try
{
plainText = plainText.Trim()
plainText = plainText.TrimEx()
.Replace("\n", "")
.Replace("\r\n", "")
.Replace("\r", "")
@@ -250,6 +250,89 @@ namespace v2rayN
}
}
public static string ToString(object obj)
{
try
{
return (obj == null ? string.Empty : obj.ToString());
}
catch
{
return string.Empty;
}
}
/// <summary>
/// byte 转成 有两位小数点的 方便阅读的数据
/// 比如 2.50 MB
/// </summary>
/// <param name="amount">bytes</param>
/// <param name="result">转换之后的数据</param>
/// <param name="unit">单位</param>
public static void ToHumanReadable(ulong amount, out double result, out string unit)
{
var factor = 1024u;
var KBs = amount / factor;
if (KBs > 0)
{
// multi KB
var MBs = KBs / factor;
if (MBs > 0)
{
// multi MB
var GBs = MBs / factor;
if (GBs > 0)
{
// multi GB
var TBs = GBs / factor;
if (TBs > 0)
{
// 你是魔鬼吗? 用这么多流量
result = TBs + GBs % factor / (factor + 0.0);
unit = "TB";
return;
}
result = GBs + MBs % factor / (factor + 0.0);
unit = "GB";
return;
}
result = MBs + KBs % factor / (factor + 0.0);
unit = "MB";
return;
}
result = KBs + amount % factor / (factor + 0.0);
unit = "KB";
return;
}
else
{
result = amount;
unit = "B";
}
}
public static string HumanFy(ulong amount)
{
double result;
string unit;
ToHumanReadable(amount, out result, out unit);
return $"{string.Format("{0:f1}", result)}{unit}";
}
public static void DedupServerList(List<Mode.VmessItem> source, out List<Mode.VmessItem> result)
{
var list = new List<Mode.VmessItem>();
foreach (var item in source)
{
if (!list.Exists(i => item.address == i.address && item.port == i.port && item.path == i.path))
{
list.Add(item);
}
}
result = list;
}
#endregion
@@ -304,7 +387,7 @@ namespace v2rayN
}
//清除要验证字符串中的空格
//ip = ip.Trim();
//ip = ip.TrimEx();
//可能是CIDR
if (ip.IndexOf(@"/") > 0)
{
@@ -340,7 +423,7 @@ namespace v2rayN
}
//清除要验证字符串中的空格
//domain = domain.Trim();
//domain = domain.TrimEx();
//模式字符串
string pattern = @"^(?=^.{3,255}$)[a-zA-Z0-9][-a-zA-Z0-9]{0,62}(\.[a-zA-Z0-9][-a-zA-Z0-9]{0,62})+$";
@@ -359,6 +442,15 @@ namespace v2rayN
return Regex.IsMatch(input, pattern, RegexOptions.IgnoreCase);
}
public static bool IsIdenticalServer(Mode.ServerStatistics a, Mode.ServerStatistics b)
{
return (a.address == b.address
&& a.port == b.port
&& a.path == b.path
&& a.host == b.host
);
}
#endregion
#region

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Grpc.Tools" version="2.23.0" targetFramework="net46" developmentDependency="true" />
</packages>

View File

@@ -1,560 +0,0 @@
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: command.proto
#pragma warning disable 1591, 0612, 3021
#region Designer generated code
using pb = global::Google.Protobuf;
using pbc = global::Google.Protobuf.Collections;
using pbr = global::Google.Protobuf.Reflection;
using scg = global::System.Collections.Generic;
namespace V2Ray.Core.App.Stats.Command {
/// <summary>Holder for reflection information generated from command.proto</summary>
public static partial class CommandReflection {
#region Descriptor
/// <summary>File descriptor for command.proto</summary>
public static pbr::FileDescriptor Descriptor {
get { return descriptor; }
}
private static pbr::FileDescriptor descriptor;
static CommandReflection() {
byte[] descriptorData = global::System.Convert.FromBase64String(
string.Concat(
"Cg1jb21tYW5kLnByb3RvEhx2MnJheS5jb3JlLmFwcC5zdGF0cy5jb21tYW5k",
"Ii4KD0dldFN0YXRzUmVxdWVzdBIMCgRuYW1lGAEgASgJEg0KBXJlc2V0GAIg",
"ASgIIiMKBFN0YXQSDAoEbmFtZRgBIAEoCRINCgV2YWx1ZRgCIAEoAyJEChBH",
"ZXRTdGF0c1Jlc3BvbnNlEjAKBHN0YXQYASABKAsyIi52MnJheS5jb3JlLmFw",
"cC5zdGF0cy5jb21tYW5kLlN0YXQiCAoGQ29uZmlnMnsKDFN0YXRzU2Vydmlj",
"ZRJrCghHZXRTdGF0cxItLnYycmF5LmNvcmUuYXBwLnN0YXRzLmNvbW1hbmQu",
"R2V0U3RhdHNSZXF1ZXN0Gi4udjJyYXkuY29yZS5hcHAuc3RhdHMuY29tbWFu",
"ZC5HZXRTdGF0c1Jlc3BvbnNlIgBCTAogY29tLnYycmF5LmNvcmUuYXBwLnN0",
"YXRzLmNvbW1hbmRQAVoHY29tbWFuZKoCHFYyUmF5LkNvcmUuQXBwLlN0YXRz",
"LkNvbW1hbmRiBnByb3RvMw=="));
descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData,
new pbr::FileDescriptor[] { },
new pbr::GeneratedClrTypeInfo(null, new pbr::GeneratedClrTypeInfo[] {
new pbr::GeneratedClrTypeInfo(typeof(global::V2Ray.Core.App.Stats.Command.GetStatsRequest), global::V2Ray.Core.App.Stats.Command.GetStatsRequest.Parser, new[]{ "Name", "Reset" }, null, null, null),
new pbr::GeneratedClrTypeInfo(typeof(global::V2Ray.Core.App.Stats.Command.Stat), global::V2Ray.Core.App.Stats.Command.Stat.Parser, new[]{ "Name", "Value" }, null, null, null),
new pbr::GeneratedClrTypeInfo(typeof(global::V2Ray.Core.App.Stats.Command.GetStatsResponse), global::V2Ray.Core.App.Stats.Command.GetStatsResponse.Parser, new[]{ "Stat" }, null, null, null),
new pbr::GeneratedClrTypeInfo(typeof(global::V2Ray.Core.App.Stats.Command.Config), global::V2Ray.Core.App.Stats.Command.Config.Parser, null, null, null, null)
}));
}
#endregion
}
#region Messages
public sealed partial class GetStatsRequest : pb::IMessage<GetStatsRequest> {
private static readonly pb::MessageParser<GetStatsRequest> _parser = new pb::MessageParser<GetStatsRequest>(() => new GetStatsRequest());
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pb::MessageParser<GetStatsRequest> Parser { get { return _parser; } }
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pbr::MessageDescriptor Descriptor {
get { return global::V2Ray.Core.App.Stats.Command.CommandReflection.Descriptor.MessageTypes[0]; }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
pbr::MessageDescriptor pb::IMessage.Descriptor {
get { return Descriptor; }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public GetStatsRequest() {
OnConstruction();
}
partial void OnConstruction();
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public GetStatsRequest(GetStatsRequest other) : this() {
name_ = other.name_;
reset_ = other.reset_;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public GetStatsRequest Clone() {
return new GetStatsRequest(this);
}
/// <summary>Field number for the "name" field.</summary>
public const int NameFieldNumber = 1;
private string name_ = "";
/// <summary>
/// Name of the stat counter.
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public string Name {
get { return name_; }
set {
name_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
}
}
/// <summary>Field number for the "reset" field.</summary>
public const int ResetFieldNumber = 2;
private bool reset_;
/// <summary>
/// Whether or not to reset the counter to fetching its value.
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public bool Reset {
get { return reset_; }
set {
reset_ = value;
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public override bool Equals(object other) {
return Equals(other as GetStatsRequest);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public bool Equals(GetStatsRequest other) {
if (ReferenceEquals(other, null)) {
return false;
}
if (ReferenceEquals(other, this)) {
return true;
}
if (Name != other.Name) return false;
if (Reset != other.Reset) return false;
return true;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public override int GetHashCode() {
int hash = 1;
if (Name.Length != 0) hash ^= Name.GetHashCode();
if (Reset != false) hash ^= Reset.GetHashCode();
return hash;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public override string ToString() {
return pb::JsonFormatter.ToDiagnosticString(this);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void WriteTo(pb::CodedOutputStream output) {
if (Name.Length != 0) {
output.WriteRawTag(10);
output.WriteString(Name);
}
if (Reset != false) {
output.WriteRawTag(16);
output.WriteBool(Reset);
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public int CalculateSize() {
int size = 0;
if (Name.Length != 0) {
size += 1 + pb::CodedOutputStream.ComputeStringSize(Name);
}
if (Reset != false) {
size += 1 + 1;
}
return size;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void MergeFrom(GetStatsRequest other) {
if (other == null) {
return;
}
if (other.Name.Length != 0) {
Name = other.Name;
}
if (other.Reset != false) {
Reset = other.Reset;
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void MergeFrom(pb::CodedInputStream input) {
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
input.SkipLastField();
break;
case 10: {
Name = input.ReadString();
break;
}
case 16: {
Reset = input.ReadBool();
break;
}
}
}
}
}
public sealed partial class Stat : pb::IMessage<Stat> {
private static readonly pb::MessageParser<Stat> _parser = new pb::MessageParser<Stat>(() => new Stat());
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pb::MessageParser<Stat> Parser { get { return _parser; } }
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pbr::MessageDescriptor Descriptor {
get { return global::V2Ray.Core.App.Stats.Command.CommandReflection.Descriptor.MessageTypes[1]; }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
pbr::MessageDescriptor pb::IMessage.Descriptor {
get { return Descriptor; }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public Stat() {
OnConstruction();
}
partial void OnConstruction();
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public Stat(Stat other) : this() {
name_ = other.name_;
value_ = other.value_;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public Stat Clone() {
return new Stat(this);
}
/// <summary>Field number for the "name" field.</summary>
public const int NameFieldNumber = 1;
private string name_ = "";
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public string Name {
get { return name_; }
set {
name_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
}
}
/// <summary>Field number for the "value" field.</summary>
public const int ValueFieldNumber = 2;
private long value_;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public long Value {
get { return value_; }
set {
value_ = value;
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public override bool Equals(object other) {
return Equals(other as Stat);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public bool Equals(Stat other) {
if (ReferenceEquals(other, null)) {
return false;
}
if (ReferenceEquals(other, this)) {
return true;
}
if (Name != other.Name) return false;
if (Value != other.Value) return false;
return true;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public override int GetHashCode() {
int hash = 1;
if (Name.Length != 0) hash ^= Name.GetHashCode();
if (Value != 0L) hash ^= Value.GetHashCode();
return hash;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public override string ToString() {
return pb::JsonFormatter.ToDiagnosticString(this);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void WriteTo(pb::CodedOutputStream output) {
if (Name.Length != 0) {
output.WriteRawTag(10);
output.WriteString(Name);
}
if (Value != 0L) {
output.WriteRawTag(16);
output.WriteInt64(Value);
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public int CalculateSize() {
int size = 0;
if (Name.Length != 0) {
size += 1 + pb::CodedOutputStream.ComputeStringSize(Name);
}
if (Value != 0L) {
size += 1 + pb::CodedOutputStream.ComputeInt64Size(Value);
}
return size;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void MergeFrom(Stat other) {
if (other == null) {
return;
}
if (other.Name.Length != 0) {
Name = other.Name;
}
if (other.Value != 0L) {
Value = other.Value;
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void MergeFrom(pb::CodedInputStream input) {
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
input.SkipLastField();
break;
case 10: {
Name = input.ReadString();
break;
}
case 16: {
Value = input.ReadInt64();
break;
}
}
}
}
}
public sealed partial class GetStatsResponse : pb::IMessage<GetStatsResponse> {
private static readonly pb::MessageParser<GetStatsResponse> _parser = new pb::MessageParser<GetStatsResponse>(() => new GetStatsResponse());
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pb::MessageParser<GetStatsResponse> Parser { get { return _parser; } }
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pbr::MessageDescriptor Descriptor {
get { return global::V2Ray.Core.App.Stats.Command.CommandReflection.Descriptor.MessageTypes[2]; }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
pbr::MessageDescriptor pb::IMessage.Descriptor {
get { return Descriptor; }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public GetStatsResponse() {
OnConstruction();
}
partial void OnConstruction();
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public GetStatsResponse(GetStatsResponse other) : this() {
Stat = other.stat_ != null ? other.Stat.Clone() : null;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public GetStatsResponse Clone() {
return new GetStatsResponse(this);
}
/// <summary>Field number for the "stat" field.</summary>
public const int StatFieldNumber = 1;
private global::V2Ray.Core.App.Stats.Command.Stat stat_;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public global::V2Ray.Core.App.Stats.Command.Stat Stat {
get { return stat_; }
set {
stat_ = value;
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public override bool Equals(object other) {
return Equals(other as GetStatsResponse);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public bool Equals(GetStatsResponse other) {
if (ReferenceEquals(other, null)) {
return false;
}
if (ReferenceEquals(other, this)) {
return true;
}
if (!object.Equals(Stat, other.Stat)) return false;
return true;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public override int GetHashCode() {
int hash = 1;
if (stat_ != null) hash ^= Stat.GetHashCode();
return hash;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public override string ToString() {
return pb::JsonFormatter.ToDiagnosticString(this);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void WriteTo(pb::CodedOutputStream output) {
if (stat_ != null) {
output.WriteRawTag(10);
output.WriteMessage(Stat);
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public int CalculateSize() {
int size = 0;
if (stat_ != null) {
size += 1 + pb::CodedOutputStream.ComputeMessageSize(Stat);
}
return size;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void MergeFrom(GetStatsResponse other) {
if (other == null) {
return;
}
if (other.stat_ != null) {
if (stat_ == null) {
stat_ = new global::V2Ray.Core.App.Stats.Command.Stat();
}
Stat.MergeFrom(other.Stat);
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void MergeFrom(pb::CodedInputStream input) {
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
input.SkipLastField();
break;
case 10: {
if (stat_ == null) {
stat_ = new global::V2Ray.Core.App.Stats.Command.Stat();
}
input.ReadMessage(stat_);
break;
}
}
}
}
}
public sealed partial class Config : pb::IMessage<Config> {
private static readonly pb::MessageParser<Config> _parser = new pb::MessageParser<Config>(() => new Config());
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pb::MessageParser<Config> Parser { get { return _parser; } }
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pbr::MessageDescriptor Descriptor {
get { return global::V2Ray.Core.App.Stats.Command.CommandReflection.Descriptor.MessageTypes[3]; }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
pbr::MessageDescriptor pb::IMessage.Descriptor {
get { return Descriptor; }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public Config() {
OnConstruction();
}
partial void OnConstruction();
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public Config(Config other) : this() {
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public Config Clone() {
return new Config(this);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public override bool Equals(object other) {
return Equals(other as Config);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public bool Equals(Config other) {
if (ReferenceEquals(other, null)) {
return false;
}
if (ReferenceEquals(other, this)) {
return true;
}
return true;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public override int GetHashCode() {
int hash = 1;
return hash;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public override string ToString() {
return pb::JsonFormatter.ToDiagnosticString(this);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void WriteTo(pb::CodedOutputStream output) {
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public int CalculateSize() {
int size = 0;
return size;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void MergeFrom(Config other) {
if (other == null) {
return;
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void MergeFrom(pb::CodedInputStream input) {
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
input.SkipLastField();
break;
}
}
}
}
#endregion
}
#endregion Designer generated code

View File

@@ -1,97 +0,0 @@
// <auto-generated>
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: command.proto
// </auto-generated>
#pragma warning disable 1591
#region Designer generated code
using grpc = global::Grpc.Core;
namespace V2Ray.Core.App.Stats.Command {
public static partial class StatsService
{
static readonly string __ServiceName = "v2ray.core.app.stats.command.StatsService";
static readonly grpc::Marshaller<global::V2Ray.Core.App.Stats.Command.GetStatsRequest> __Marshaller_GetStatsRequest = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::V2Ray.Core.App.Stats.Command.GetStatsRequest.Parser.ParseFrom);
static readonly grpc::Marshaller<global::V2Ray.Core.App.Stats.Command.GetStatsResponse> __Marshaller_GetStatsResponse = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::V2Ray.Core.App.Stats.Command.GetStatsResponse.Parser.ParseFrom);
static readonly grpc::Method<global::V2Ray.Core.App.Stats.Command.GetStatsRequest, global::V2Ray.Core.App.Stats.Command.GetStatsResponse> __Method_GetStats = new grpc::Method<global::V2Ray.Core.App.Stats.Command.GetStatsRequest, global::V2Ray.Core.App.Stats.Command.GetStatsResponse>(
grpc::MethodType.Unary,
__ServiceName,
"GetStats",
__Marshaller_GetStatsRequest,
__Marshaller_GetStatsResponse);
/// <summary>Service descriptor</summary>
public static global::Google.Protobuf.Reflection.ServiceDescriptor Descriptor
{
get { return global::V2Ray.Core.App.Stats.Command.CommandReflection.Descriptor.Services[0]; }
}
/// <summary>Base class for server-side implementations of StatsService</summary>
public abstract partial class StatsServiceBase
{
public virtual global::System.Threading.Tasks.Task<global::V2Ray.Core.App.Stats.Command.GetStatsResponse> GetStats(global::V2Ray.Core.App.Stats.Command.GetStatsRequest request, grpc::ServerCallContext context)
{
throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, ""));
}
}
/// <summary>Client for StatsService</summary>
public partial class StatsServiceClient : grpc::ClientBase<StatsServiceClient>
{
/// <summary>Creates a new client for StatsService</summary>
/// <param name="channel">The channel to use to make remote calls.</param>
public StatsServiceClient(grpc::Channel channel) : base(channel)
{
}
/// <summary>Creates a new client for StatsService that uses a custom <c>CallInvoker</c>.</summary>
/// <param name="callInvoker">The callInvoker to use to make remote calls.</param>
public StatsServiceClient(grpc::CallInvoker callInvoker) : base(callInvoker)
{
}
/// <summary>Protected parameterless constructor to allow creation of test doubles.</summary>
protected StatsServiceClient() : base()
{
}
/// <summary>Protected constructor to allow creation of configured clients.</summary>
/// <param name="configuration">The client configuration.</param>
protected StatsServiceClient(ClientBaseConfiguration configuration) : base(configuration)
{
}
public virtual global::V2Ray.Core.App.Stats.Command.GetStatsResponse GetStats(global::V2Ray.Core.App.Stats.Command.GetStatsRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
{
return GetStats(request, new grpc::CallOptions(headers, deadline, cancellationToken));
}
public virtual global::V2Ray.Core.App.Stats.Command.GetStatsResponse GetStats(global::V2Ray.Core.App.Stats.Command.GetStatsRequest request, grpc::CallOptions options)
{
return CallInvoker.BlockingUnaryCall(__Method_GetStats, null, options, request);
}
public virtual grpc::AsyncUnaryCall<global::V2Ray.Core.App.Stats.Command.GetStatsResponse> GetStatsAsync(global::V2Ray.Core.App.Stats.Command.GetStatsRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
{
return GetStatsAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken));
}
public virtual grpc::AsyncUnaryCall<global::V2Ray.Core.App.Stats.Command.GetStatsResponse> GetStatsAsync(global::V2Ray.Core.App.Stats.Command.GetStatsRequest request, grpc::CallOptions options)
{
return CallInvoker.AsyncUnaryCall(__Method_GetStats, null, options, request);
}
/// <summary>Creates a new instance of client from given <c>ClientBaseConfiguration</c>.</summary>
protected override StatsServiceClient NewInstance(ClientBaseConfiguration configuration)
{
return new StatsServiceClient(configuration);
}
}
/// <summary>Creates service definition that can be registered with a server</summary>
/// <param name="serviceImpl">An object implementing the server-side handling logic.</param>
public static grpc::ServerServiceDefinition BindService(StatsServiceBase serviceImpl)
{
return grpc::ServerServiceDefinition.CreateBuilder()
.AddMethod(__Method_GetStats, serviceImpl.GetStats).Build();
}
}
}
#endregion

View File

@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\packages\Grpc.Tools.2.23.0\build\Grpc.Tools.props" Condition="Exists('..\packages\Grpc.Tools.2.23.0\build\Grpc.Tools.props')" />
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
@@ -74,11 +75,32 @@
<PropertyGroup />
<PropertyGroup />
<ItemGroup>
<Reference Include="Newtonsoft.Json">
<HintPath>.\Newtonsoft.Json.dll</HintPath>
<Reference Include="Google.Protobuf, Version=3.9.1.0, Culture=neutral, PublicKeyToken=a7d26565bac4d604, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>LIB\Google.Protobuf.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="Grpc.Core, Version=2.0.0.0, Culture=neutral, PublicKeyToken=d754f35622e28bad, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>LIB\Grpc.Core.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="Grpc.Core.Api, Version=2.0.0.0, Culture=neutral, PublicKeyToken=d754f35622e28bad, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>LIB\Grpc.Core.Api.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="Newtonsoft.Json, Version=10.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>LIB\Newtonsoft.Json.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="System" />
<Reference Include="System.Buffers, Version=4.0.2.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>LIB\System.Buffers.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="System.Core" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
@@ -87,15 +109,27 @@
<Reference Include="System.Drawing" />
<Reference Include="System.IO.Compression" />
<Reference Include="System.IO.Compression.FileSystem" />
<Reference Include="System.Net" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
<Reference Include="zxing">
<HintPath>.\zxing.dll</HintPath>
<Reference Include="System.Memory, Version=4.0.1.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>LIB\System.Memory.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="zxing.presentation">
<HintPath>.\zxing.presentation.dll</HintPath>
<Reference Include="System.Net" />
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=4.0.4.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>LIB\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
<Reference Include="zxing, Version=0.16.2.0, Culture=neutral, PublicKeyToken=4e88037ac681fe60, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>LIB\zxing.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="zxing.presentation, Version=0.16.2.0, Culture=neutral, PublicKeyToken=4e88037ac681fe60, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>LIB\zxing.presentation.dll</HintPath>
<Private>False</Private>
</Reference>
</ItemGroup>
@@ -106,6 +140,9 @@
<Compile Include="Forms\AddServer4Form.Designer.cs">
<DependentUpon>AddServer4Form.cs</DependentUpon>
</Compile>
<Compile Include="Forms\ListViewFlickerFree.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="Forms\MainForm.cs">
<SubType>Form</SubType>
</Compile>
@@ -142,9 +179,9 @@
<Compile Include="Forms\SubSettingControl.Designer.cs">
<DependentUpon>SubSettingControl.cs</DependentUpon>
</Compile>
<Compile Include="Handler\StatisticsHandler.cs" />
<Compile Include="Handler\V2rayUpdateHandle.cs" />
<Compile Include="HttpProxyHandler\HttpWebServer.cs" />
<Compile Include="HttpProxyHandler\HttpWebServerB.cs" />
<Compile Include="HttpProxyHandler\PACFileWatcherHandle.cs" />
<Compile Include="HttpProxyHandler\PrivoxyHandler.cs" />
<Compile Include="HttpProxyHandler\PACListHandle.cs" />
@@ -156,6 +193,7 @@
<SubType>Component</SubType>
</Compile>
<Compile Include="Mode\EMove.cs" />
<Compile Include="Mode\ServerStatistics.cs" />
<Compile Include="Mode\SysproxyConfig.cs" />
<Compile Include="Mode\EConfigType.cs" />
<Compile Include="Resx\ResUI.zh-Hans.Designer.cs">
@@ -290,6 +328,7 @@
<EmbeddedResource Include="app.config">
<SubType>Designer</SubType>
</EmbeddedResource>
<None Include="packages.config" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
@@ -299,6 +338,7 @@
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
<Protobuf Include="Protos\Statistics.proto" />
<None Include="Resources\abp.js.gz" />
<None Include="Resources\pac.txt.gz" />
<None Include="Resources\sysproxy.exe.gz" />
@@ -320,9 +360,6 @@
<ItemGroup>
<EmbeddedResource Include="Sample\SampleClientConfig.txt" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Newtonsoft.Json.dll" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Sample\SampleHttprequest.txt" />
<EmbeddedResource Include="Sample\SampleHttpresponse.txt" />
@@ -372,19 +409,39 @@
<None Include="Resources\sub.png" />
<None Include="Resources\checkupdate.png" />
<None Include="Resources\about.png" />
<EmbeddedResource Include="LIB\Google.Protobuf.dll" />
<EmbeddedResource Include="LIB\Grpc.Core.Api.dll" />
<EmbeddedResource Include="LIB\Grpc.Core.dll" />
<EmbeddedResource Include="LIB\Newtonsoft.Json.dll" />
<EmbeddedResource Include="LIB\System.Buffers.dll" />
<EmbeddedResource Include="LIB\System.Memory.dll" />
<EmbeddedResource Include="LIB\System.Runtime.CompilerServices.Unsafe.dll" />
<EmbeddedResource Include="LIB\zxing.dll" />
<EmbeddedResource Include="LIB\zxing.presentation.dll" />
<Content Include="grpc_csharp_ext.x64.dll">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="grpc_csharp_ext.x86.dll">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<EmbeddedResource Include="LIB\netstandard.dll" />
<Content Include="Resources\help.png" />
<Content Include="Resources\privoxy_conf.txt" />
<EmbeddedResource Include="zxing.presentation.dll" />
<EmbeddedResource Include="zxing.dll" />
</ItemGroup>
<ItemGroup>
<Folder Include="protos\" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PostBuildEvent>
</PostBuildEvent>
</PropertyGroup>
<Import Project="..\packages\Grpc.Core.2.23.0\build\net45\Grpc.Core.targets" Condition="Exists('..\packages\Grpc.Core.2.23.0\build\net45\Grpc.Core.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\Grpc.Tools.2.23.0\build\Grpc.Tools.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Grpc.Tools.2.23.0\build\Grpc.Tools.props'))" />
<Error Condition="!Exists('..\packages\Grpc.Tools.2.23.0\build\Grpc.Tools.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Grpc.Tools.2.23.0\build\Grpc.Tools.targets'))" />
</Target>
<Import Project="..\packages\Grpc.Tools.2.23.0\build\Grpc.Tools.targets" Condition="Exists('..\packages\Grpc.Tools.2.23.0\build\Grpc.Tools.targets')" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">

View File

@@ -14,4 +14,9 @@
<PropertyGroup>
<EnableSecurityDebugging>false</EnableSecurityDebugging>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'">
<StartAction>Project</StartAction>
<StartArguments>
</StartArguments>
</PropertyGroup>
</Project>