Merge remote-tracking branch 'upstream/master' into dev

pull/43/head
CGQAQ 2019-08-27 12:10:28 +08:00
commit 65d2db55f8
14 changed files with 1351 additions and 1374 deletions

View File

@ -0,0 +1,15 @@
using System.Windows.Forms;
namespace v2rayN.Forms
{
class ListViewFlickerFree : ListView
{
public ListViewFlickerFree()
{
SetStyle(ControlStyles.OptimizedDoubleBuffer
| ControlStyles.AllPaintingInWmPaint
, true);
UpdateStyles();
}
}
}

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 v2rayN.Forms.MainForm.ListViewFlickerFree();
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();
@ -115,7 +116,6 @@
this.tsbPromotion = new System.Windows.Forms.ToolStripButton();
this.toolStripSeparator11 = new System.Windows.Forms.ToolStripSeparator();
this.tsbClose = new System.Windows.Forms.ToolStripButton();
this.menuRemoveDuplicateServer = new System.Windows.Forms.ToolStripMenuItem();
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
this.splitContainer1.Panel1.SuspendLayout();
this.splitContainer1.Panel2.SuspendLayout();
@ -136,17 +136,19 @@
//
// 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;
@ -163,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,
@ -192,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
@ -348,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,
@ -372,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
@ -458,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,
@ -494,67 +503,66 @@
this.toolSslBlank3,
this.toolSslServerSpeed,
this.toolSslBlank4});
resources.ApplyResources(this.ssMain, "ssMain");
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
//
this.toolSslHttpPortLab.Name = "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
//
this.toolSslPacPortLab.Name = "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
//
this.toolSslServerSpeed.Name = "toolSslServerSpeed";
resources.ApplyResources(this.toolSslServerSpeed, "toolSslServerSpeed");
this.toolSslServerSpeed.Name = "toolSslServerSpeed";
//
// toolSslBlank4
//
this.toolSslBlank4.Name = "toolSslBlank4";
resources.ApplyResources(this.toolSslBlank4, "toolSslBlank4");
this.toolSslBlank4.Name = "toolSslBlank4";
//
// panel1
//
@ -563,6 +571,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,
@ -579,51 +588,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
//
@ -633,95 +641,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
//
@ -729,12 +737,6 @@
this.tsbClose.Name = "tsbClose";
this.tsbClose.Click += new System.EventHandler(this.tsbClose_Click);
//
// menuRemoveDuplicateServer
//
this.menuRemoveDuplicateServer.Name = "menuRemoveDuplicateServer";
resources.ApplyResources(this.menuRemoveDuplicateServer, "menuRemoveDuplicateServer");
this.menuRemoveDuplicateServer.Click += new System.EventHandler(this.menuRemoveDuplicateServer_Click);
//
// MainForm
//
resources.ApplyResources(this, "$this");
@ -774,7 +776,7 @@
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.GroupBox groupBox2;
private System.Windows.Forms.TextBox txtMsgBox;
private v2rayN.Forms.MainForm.ListViewFlickerFree lvServers;
private v2rayN.Forms.ListViewFlickerFree lvServers;
private System.Windows.Forms.NotifyIcon notifyMain;
private System.Windows.Forms.ContextMenuStrip cmsMain;
private System.Windows.Forms.ToolStripMenuItem menuExit;

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,19 +17,7 @@ namespace v2rayN.Forms
private V2rayUpdateHandle v2rayUpdateHandle;
private V2rayUpdateHandle v2rayUpdateHandle2;
private List<int> lvSelecteds = new List<int>();
private StatisticsHandler statistics;
class ListViewFlickerFree: ListView
{
public ListViewFlickerFree()
{
SetStyle(ControlStyles.OptimizedDoubleBuffer
| ControlStyles.AllPaintingInWmPaint
, true);
UpdateStyles();
}
}
private StatisticsHandler statistics = null;
#region Window 事件
@ -44,7 +32,7 @@ namespace v2rayN.Forms
Application.ApplicationExit += (sender, args) =>
{
Utils.ClearTempPath();
statistics.Close();
statistics?.Close();
};
}
@ -53,76 +41,68 @@ namespace v2rayN.Forms
ConfigHandler.LoadConfig(ref config);
v2rayHandler = new V2rayHandler();
v2rayHandler.ProcessEvent += v2rayHandler_ProcessEvent;
statistics = new StatisticsHandler(config, UpdateHandler);
if (config.enableStatistics)
{
statistics = new StatisticsHandler(config, UpdateStatisticsHandler);
}
}
private void UpdateHandler(ulong totalUp, ulong totalDown, ulong up, ulong down, List<Mode.ServerStatistics> statistics)
private void UpdateStatisticsHandler(ulong totalUp, ulong totalDown, ulong up, ulong down, List<Mode.ServerStatistics> statistics)
{
double up_amount = 0.0, down_amount;
string up_unit = "", down_unit;
up /= (ulong) (config.statisticsFreshRate / 1000f);
down /= (ulong) (config.statisticsFreshRate / 1000f);
Utils.ToHumanReadable(up, out up_amount, out up_unit);
Utils.ToHumanReadable(down, out down_amount, out down_unit);
up_unit += "/s";
down_unit += "/s";
toolSslBlank4.Text = string.Format(
"{4}: {0:f2} {1} | {5}: {2:f2} {3}",
up_amount,
up_unit,
down_amount,
down_unit,
UIRes.I18N("uploadSpeed"),
UIRes.I18N("downloadSpeed")
);
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)
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
{
Func<ulong, string> human_fy = (amount) =>
lvServers.SuspendLayout();
for (int i = 0; i < datas.Count; i++)
{
double result;
string unit;
Utils.ToHumanReadable(amount, out result, out unit);
return $"{string.Format("{0:f2}", result)}{unit}";
};
totalUp_ = human_fy(statistics[index].totalUp);
totalDown_ = human_fy(statistics[index].totalDown);
todayUp_ = human_fy(statistics[index].todayUp);
todayDown_ = human_fy(statistics[index].todayDown);
}
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();
});
datas.Add(new string[] { totalUp_, totalDown_, todayUp_, todayDown_});
}
lvServers.Invoke((MethodInvoker)delegate
catch (Exception ex)
{
lvServers.SuspendLayout();
for (int i =0; i<datas.Count; i++)
{
lvServers.Items[i].SubItems[7].Text = datas[i][0];
lvServers.Items[i].SubItems[8].Text = datas[i][1];
lvServers.Items[i].SubItems[9].Text = datas[i][2];
lvServers.Items[i].SubItems[10].Text = datas[i][3];
}
lvServers.ResumeLayout();
});
Utils.SaveLog(ex.Message, ex);
}
}
private void MainForm_VisibleChanged(object sender, EventArgs e)
{
if (statistics == null || !statistics.Enable) return;
if((sender as Form).Visible)
if ((sender as Form).Visible)
{
statistics.UpdateUI = true;
}
@ -149,16 +129,16 @@ namespace v2rayN.Forms
{
e.Cancel = true;
statistics.saveToFile();
statistics?.saveToFile();
HideForm();
return;
}
if(e.CloseReason == CloseReason.ApplicationExitCall)
if (e.CloseReason == CloseReason.ApplicationExitCall)
{
ConfigHandler.SaveConfig(ref config);
statistics.saveToFile();
statistics.Close();
statistics?.saveToFile();
statistics?.Close();
}
}
@ -188,8 +168,7 @@ namespace v2rayN.Forms
Utils.SaveLog("Windows shutdown UnsetProxy");
//CloseV2ray();
ConfigHandler.ToJsonFile(config);
if(statistics!=null && statistics.Enable)
statistics.saveToFile();
statistics?.saveToFile();
ProxySetting.UnsetProxy();
m.Result = (IntPtr)1;
break;
@ -232,19 +211,16 @@ namespace v2rayN.Forms
lvServers.Columns.Add(UIRes.I18N("LvPort"), 50, HorizontalAlignment.Left);
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);
if(statistics != null && statistics.Enable)
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);
this.Width = 1250;
}
lvServers.Columns.Add(UIRes.I18N("LvSubscription"), 50, HorizontalAlignment.Left);
lvServers.Columns.Add(UIRes.I18N("LvTestResults"), 100, HorizontalAlignment.Left);
}
/// <summary>
@ -257,9 +233,9 @@ 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,
string totalUp = string.Empty,
totalDown = string.Empty,
todayUp = string.Empty,
todayDown = string.Empty;
if (config.index.Equals(k))
{
@ -274,17 +250,10 @@ namespace v2rayN.Forms
var index = statistics.Statistic.FindIndex(item_ => item_.address == item.address);
if (index != -1)
{
Func<ulong, string> human_fy = (amount) =>
{
double result;
string unit;
Utils.ToHumanReadable(amount, out result, out unit);
return $"{string.Format("{0:f2}", result)}{unit}";
};
totalUp = human_fy(statistics.Statistic[index].totalUp);
totalDown = human_fy(statistics.Statistic[index].totalDown);
todayUp = human_fy(statistics.Statistic[index].todayUp);
todayDown = human_fy(statistics.Statistic[index].todayDown);
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[]
@ -298,12 +267,12 @@ namespace v2rayN.Forms
//item.alterId.ToString(),
item.security,
item.network,
item.getSubRemarks(config),
item.testResult,
totalUp,
totalDown,
todayUp,
todayDown,
item.getSubRemarks(config),
item.testResult
todayDown
});
}
else
@ -319,16 +288,16 @@ namespace v2rayN.Forms
//item.alterId.ToString(),
item.security,
item.network,
item.getSubRemarks(config),
item.testResult
//totalUp,
//totalDown,
//todayUp,
//todayDown,
item.getSubRemarks(config),
item.testResult
});
}
if(lvItem!=null) lvServers.Items.Add(lvItem);
if (lvItem != null) lvServers.Items.Add(lvItem);
}
//if (lvServers.Items.Count > 0)
@ -403,10 +372,10 @@ 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}";
@ -521,23 +490,10 @@ namespace v2rayN.Forms
menuSelectAll_Click(null, null);
break;
case Keys.T:
// Speed test selected servers
if (!config.sysAgentEnabled || config.listenerType != 1)
{
UI.Show(UIRes.I18N("NeedHttpGlobalProxy"));
return;
}
UI.Show(UIRes.I18N("SpeedServerTips"));
GetLvSelectedIndex();
ServerSpeedTest();
menuSpeedServer_Click(null, null);
break;
case Keys.P:
// Ping selected servers
GetLvSelectedIndex();
ClearTestResult();
bgwPing.RunWorkerAsync();
menuPingServer_Click(null, null);
break;
}
}
@ -1032,7 +988,7 @@ namespace v2rayN.Forms
this.Visible = false;
this.Close();
statistics.Close();
statistics?.Close();
//this.Dispose();
//System.Environment.Exit(System.Environment.ExitCode);
@ -1102,7 +1058,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()
{

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>
@ -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>
@ -276,12 +282,21 @@
ZW0uRHJhd2luZy5HcmFwaGljc1VuaXQBAAAAB3ZhbHVlX18ACAMAAAADAAAACw==
</value>
</data>
<data name="cmsMain.Size" type="System.Drawing.Size, System.Drawing">
<value>196, 164</value>
</data>
<data name="menuSysAgentEnabled.Size" type="System.Drawing.Size, System.Drawing">
<value>195, 22</value>
</data>
<data name="menuSysAgentEnabled.Text" xml:space="preserve">
<value>启用Http代理</value>
</data>
<data name="menuSysAgentMode.Size" type="System.Drawing.Size, System.Drawing">
<value>195, 22</value>
</data>
<data name="menuSysAgentMode.Text" xml:space="preserve">
<value>Http代理模式</value>
</data>
<data name="menuGlobal.Size" type="System.Drawing.Size, System.Drawing">
<value>340, 22</value>
</data>
@ -306,12 +321,6 @@
<data name="menuKeepPAC.Text" xml:space="preserve">
<value>仅开启PAC,不自动配置PAC</value>
</data>
<data name="menuSysAgentMode.Size" type="System.Drawing.Size, System.Drawing">
<value>195, 22</value>
</data>
<data name="menuSysAgentMode.Text" xml:space="preserve">
<value>Http代理模式</value>
</data>
<data name="menuServers.Size" type="System.Drawing.Size, System.Drawing">
<value>195, 22</value>
</data>
@ -345,15 +354,27 @@
<data name="menuExit.Text" xml:space="preserve">
<value>退出</value>
</data>
<data name="cmsMain.Size" type="System.Drawing.Size, System.Drawing">
<value>196, 164</value>
</data>
<data name="groupBox1.Text" xml:space="preserve">
<value>服务器列表</value>
</data>
<data name="groupBox2.Text" xml:space="preserve">
<value>信息</value>
</data>
<data name="toolSslBlank1.Size" type="System.Drawing.Size, System.Drawing">
<value>176, 17</value>
</data>
<data name="toolSslBlank2.Size" type="System.Drawing.Size, System.Drawing">
<value>176, 17</value>
</data>
<data name="toolSslBlank3.Size" type="System.Drawing.Size, System.Drawing">
<value>176, 17</value>
</data>
<data name="tsbSub.Size" type="System.Drawing.Size, System.Drawing">
<value>61, 53</value>
</data>
<data name="tsbSub.Text" xml:space="preserve">
<value> 订阅 </value>
</data>
<data name="tsbSubSetting.Size" type="System.Drawing.Size, System.Drawing">
<value>124, 22</value>
</data>
@ -366,12 +387,6 @@
<data name="tsbSubUpdate.Text" xml:space="preserve">
<value>更新订阅</value>
</data>
<data name="tsbSub.Size" type="System.Drawing.Size, System.Drawing">
<value>61, 53</value>
</data>
<data name="tsbSub.Text" xml:space="preserve">
<value> 订阅 </value>
</data>
<data name="tsbOptionSetting.Size" type="System.Drawing.Size, System.Drawing">
<value>76, 53</value>
</data>
@ -380,13 +395,13 @@
</data>
<data name="tsbReload.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO
wwAADsMBx2+oZAAAATdJREFUWEftloENAiEMRW8ER3AEN9ANdARHcAPdwBF0A91AN9INtC+5JvUCJwWM
mvCTFw3QUiiU65qa/lUTYT6Ato9rJZyERwT6GFNdU+EihCYNwVhsqmgm3AR1fheOAitd9PCfNvp0HDbY
FolV2MmZZCzX9J0FG0TRTlwFdbahIVE7Qe1IR5bYVnXCyr2yO5F1MNUBec25YtjomcCXSxhr9DmrV2Gr
flyL4GSrYcm9tmnEZ7JsAC7DgWr5ydbXA8hOAcVjG8FTD6ocQgvXKrW8MqFWUfc1DAXgmRwVFaJQAHsh
VbYUU87diqWA934sl/TZ7wV2Lesx0gBwsO5/1Sl5PQhLQb+G+E+bfTm9KXsRAVgHrMK+jO9gbNEzzMSh
6DlM9nANoa+kdCeLXLNLFtc9b2r6EXXdE4e4mdByNuG1AAAAAElFTkSuQmCC
iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAE3SURBVFhH7ZaBDQIhDEVvBEdwBDfQDXQER3AD3cARdAPd
QDfSDbQvuSb1AicFjJrwkxcN0FIolOuamv5VE2E+gLaPayWchEcE+hhTXVPhIoQmDcFYbKpoJtwEdX4X
jgIrXfTwnzb6dBw22BaJVdjJmWQs1/SdBRtE0U5cBXW2oSFRO0HtSEeW2FZ1wsq9sjuRdTDVAXnNuWLY
6JnAl0sYa/Q5q1dhq35ci+Bkq2HJvbZpxGeybAAuw4Fq+cnW1wPITgHFYxvBUw+qHEIL1yq1vDKhVlH3
NQwF4JkcFRWiUAB7IVW2FFPO3YqlgPd+LJf02e8Fdi3rMdIAcLDuf9UpeT0IS0G/hvhPm305vSl7EQFY
B6zCvozvYGzRM8zEoeg5TPZwDaGvpHQni1yzSxbXPW9q+hF13ROHuJnQcjbhtQAAAABJRU5ErkJggg==
</value>
</data>
<data name="tsbReload.Size" type="System.Drawing.Size, System.Drawing">
@ -395,6 +410,12 @@
<data name="tsbReload.Text" xml:space="preserve">
<value> 重启服务 </value>
</data>
<data name="tsbCheckUpdate.Size" type="System.Drawing.Size, System.Drawing">
<value>85, 53</value>
</data>
<data name="tsbCheckUpdate.Text" xml:space="preserve">
<value> 检查更新 </value>
</data>
<data name="tsbCheckUpdateN.Size" type="System.Drawing.Size, System.Drawing">
<value>232, 22</value>
</data>
@ -419,21 +440,15 @@
<data name="tsbCheckClearPACList.Text" xml:space="preserve">
<value>简化PAC (请设置Core路由)</value>
</data>
<data name="tsbCheckUpdate.Size" type="System.Drawing.Size, System.Drawing">
<value>85, 53</value>
</data>
<data name="tsbCheckUpdate.Text" xml:space="preserve">
<value> 检查更新 </value>
</data>
<data name="tsbAbout.Text" xml:space="preserve">
<value>关于</value>
</data>
<data name="tsbHelp.Size" type="System.Drawing.Size, System.Drawing">
<value>69, 53</value>
</data>
<data name="tsbHelp.Text" xml:space="preserve">
<value> 帮助 </value>
</data>
<data name="tsbAbout.Text" xml:space="preserve">
<value>关于</value>
</data>
<data name="tsbPromotion.Size" type="System.Drawing.Size, System.Drawing">
<value>68, 53</value>
</data>
@ -442,21 +457,12 @@
</data>
<data name="tsbClose.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO
wwAADsMBx2+oZAAAADJJREFUWEftzrENACAIRUFGdVMdTZkAG4zFXfI68kMAAD8ap9lUbpfyaDV19QAA
8FDEBl3RImu5VcdbAAAAAElFTkSuQmCC
iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAAySURBVFhH7c6xDQAgCEVBRnVTHU2ZABuMxV3yOvJDAAA/
GqfZVG6X8mg1dfUAAPBQxAZd0SJruVXHWwAAAABJRU5ErkJggg==
</value>
</data>
<data name="tsbClose.Text" xml:space="preserve">
<value> 关闭 </value>
</data>
<data name="toolSslServerSpeed.Text" xml:space="preserve">
<value>代理速度</value>
</data>
<data name="menuRemoveDuplicateServer.Text" xml:space="preserve">
<value>移除重复的服务器</value>
</data>
<data name="toolSslBlank4.Text" xml:space="preserve">
<value>未启用</value>
</data>
</root>

View File

@ -496,6 +496,7 @@
//
// cbFreshrate
//
this.cbFreshrate.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cbFreshrate.FormattingEnabled = true;
resources.ApplyResources(this.cbFreshrate, "cbFreshrate");
this.cbFreshrate.Name = "cbFreshrate";

View File

@ -1,8 +1,5 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Drawing;
using System.Drawing.Text;
using System.Windows.Forms;
using v2rayN.Handler;
@ -111,7 +108,6 @@ namespace v2rayN.Forms
var enableStatistics = config.enableStatistics;
chkEnableStatistics.Checked = enableStatistics;
tbCacheDays.Enabled = enableStatistics;
tbCacheDays.Text = config.CacheDays.ToString();
@ -139,7 +135,6 @@ namespace v2rayN.Forms
break;
}
cbFreshrate.Enabled = enableStatistics;
}
private void btnOK_Click(object sender, EventArgs e)
@ -338,15 +333,15 @@ namespace v2rayN.Forms
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();
//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);
}
// // Restart the app passing "/restart [processId]" as cmd line args
// Process.Start(Application.ExecutablePath, "/restart " + Process.GetCurrentProcess().Id);
//}
return 0;
}

View File

@ -146,12 +146,12 @@ namespace v2rayN
public const string InboundProxyTagName = "proxy";
public const string Loopback = "127.0.0.1";
public const string InboundAPIProtocal = "dokodemo-door";
public const uint InboundAPIPort = 10085;
public const uint InboundAPIPort = 10805;
public enum StatisticsFreshRate
{
quick = 500,
medium = 1000,
slow = 2000
quick = 1000,
medium = 2000,
slow = 3000
}
public const string StatisticLogDirectory = "Statistics";
public const string StatisticLogOverall = "overall.txt";

View File

@ -1,13 +1,10 @@
using System;
using System.Threading;
using System.IO;
using System.Collections.Generic;
using System.Linq;
using System.Diagnostics;
using System.IO;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using System.Diagnostics;
using System.Threading;
using v2rayN.Mode;
namespace v2rayN.Handler
@ -91,11 +88,15 @@ namespace v2rayN.Handler
public void Close()
{
exitFlag_ = true;
if (!connector_.HasExited)
try
{
connector_.Kill();
exitFlag_ = true;
if (!connector_.HasExited)
{
connector_.Kill();
}
}
catch { }
}
public void run()

View File

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

View File

@ -1,10 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
This file is automatically generated by Visual Studio .Net. It is
used to store generic object data source configuration information.
Renaming the file extension or editing the content of this file may
cause the file to be unrecognizable by the program.
-->
<GenericObjectDataSource DisplayName="Config" Version="1.0" xmlns="urn:schemas-microsoft-com:xml-msdatasource">
<TypeInfo>v2rayN.Mode.Config, v2rayN, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null</TypeInfo>
</GenericObjectDataSource>

View File

@ -42,7 +42,7 @@
},
{
"listen": "127.0.0.1",
"port": 10085,
"port": 10805,
"protocol": "dokodemo-door",
"settings": {
"address": "127.0.0.1"

View File

@ -273,19 +273,19 @@ namespace v2rayN
{
var factor = 1024u;
var KBs = amount / factor;
if(KBs > 0)
if (KBs > 0)
{
// multi KB
var MBs = KBs / factor;
if(MBs > 0)
if (MBs > 0)
{
// multi MB
var GBs = MBs / factor;
if(GBs > 0)
if (GBs > 0)
{
// multi GB
var TBs = GBs / factor;
if(TBs > 0)
if (TBs > 0)
{
// 你是魔鬼吗? 用这么多流量
result = TBs + GBs % factor / (factor + 0.0);
@ -303,20 +303,29 @@ namespace v2rayN
result = KBs + amount % factor / (factor + 0.0);
unit = "KB";
return;
}
}
else
{
result = amount;
unit = "Byte";
unit = "B";
}
}
public static string HumanFy(ulong amount)
{
double result;
string unit;
ToHumanReadable(amount, out result, out unit);
return $"{string.Format("{0:f2}", 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 && item.requestHost == i.requestHost))
if (!list.Exists(i => item.address == i.address && item.port == i.port && item.path == i.path))
{
list.Add(item);
}

View File

@ -106,6 +106,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>
@ -292,7 +295,6 @@
<EmbeddedResource Include="app.config">
<SubType>Designer</SubType>
</EmbeddedResource>
<None Include="Properties\DataSources\v2rayN.Mode.Config.datasource" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>