Compare commits

..

9 Commits

Author SHA1 Message Date
2dust dd1a01556f up pac server 2019-08-21 16:35:01 +08:00
2dust 5a1e5707b8 unsetproxy 2019-08-21 16:34:46 +08:00
2dust 5ec275a7e0 add socks user 2019-08-21 16:34:22 +08:00
2dust d1644bb591 up ser 2019-08-20 13:15:31 +08:00
2dust 93ecd20719 Create issue_template.md 2019-08-13 17:14:55 +08:00
2dust ed0231e7f9 up 2019-08-01 10:21:20 +08:00
2dust cf6c20b12e up all 2019-07-30 11:53:58 +08:00
2dust ab37076adc up 2019-07-30 11:52:43 +08:00
2dust 7894dd93b4 Initial commit 2019-07-30 11:47:24 +08:00
62 changed files with 2495 additions and 3251 deletions
+1 -2
View File
@@ -2,14 +2,13 @@
# 此 .gitignore 文件已由 Microsoft(R) Visual Studio 自动创建。
################################################################################
/v2rayN/.vs/
/v2rayN/.vs/v2rayN/v15
/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
-1
View File
@@ -35,6 +35,5 @@ namespace v2rayN.Forms
Utils.SaveLog($"Loading custom icon failed: {e.Message}");
}
}
}
}
@@ -1,56 +0,0 @@
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 { }
}
}
}
+33 -71
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.ListViewFlickerFree();
this.lvServers = new System.Windows.Forms.ListView();
this.cmsLv = new System.Windows.Forms.ContextMenuStrip(this.components);
this.menuAddVmessServer = new System.Windows.Forms.ToolStripMenuItem();
this.menuAddShadowsocksServer = new System.Windows.Forms.ToolStripMenuItem();
@@ -41,7 +41,6 @@
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();
@@ -52,16 +51,14 @@
this.menuSelectAll = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator9 = new System.Windows.Forms.ToolStripSeparator();
this.menuPingServer = new System.Windows.Forms.ToolStripMenuItem();
this.menuTcpingServer = new System.Windows.Forms.ToolStripMenuItem();
this.menuRealPingServer = new System.Windows.Forms.ToolStripMenuItem();
this.menuSpeedServer = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator6 = new System.Windows.Forms.ToolStripSeparator();
this.menuExport2ClientConfig = new System.Windows.Forms.ToolStripMenuItem();
this.menuExport2ServerConfig = new System.Windows.Forms.ToolStripMenuItem();
this.menuExport2ShareUrl = new System.Windows.Forms.ToolStripMenuItem();
this.menuExport2SubContent = new System.Windows.Forms.ToolStripMenuItem();
this.qrCodeControl = new v2rayN.Forms.QRCodeControl();
this.tsbServer = new System.Windows.Forms.ToolStripDropDownButton();
this.qrCodeControl = new v2rayN.Forms.QRCodeControl();
this.notifyMain = new System.Windows.Forms.NotifyIcon(this.components);
this.cmsMain = new System.Windows.Forms.ContextMenuStrip(this.components);
this.menuSysAgentEnabled = new System.Windows.Forms.ToolStripMenuItem();
@@ -76,6 +73,7 @@
this.menuCopyPACUrl = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator();
this.menuExit = new System.Windows.Forms.ToolStripMenuItem();
this.bgwPing = new System.ComponentModel.BackgroundWorker();
this.bgwScan = new System.ComponentModel.BackgroundWorker();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.groupBox2 = new System.Windows.Forms.GroupBox();
@@ -84,14 +82,10 @@
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();
@@ -117,6 +111,8 @@
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();
@@ -151,7 +147,6 @@
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;
@@ -174,7 +169,6 @@
this.menuScanScreen,
this.toolStripSeparator1,
this.menuRemoveServer,
this.menuRemoveDuplicateServer,
this.menuCopyServer,
this.menuSetDefaultServer,
this.toolStripSeparator3,
@@ -185,8 +179,6 @@
this.menuSelectAll,
this.toolStripSeparator9,
this.menuPingServer,
this.menuTcpingServer,
this.menuRealPingServer,
this.menuSpeedServer,
this.toolStripSeparator6,
this.menuExport2ClientConfig,
@@ -244,12 +236,6 @@
resources.ApplyResources(this.menuRemoveServer, "menuRemoveServer");
this.menuRemoveServer.Click += new System.EventHandler(this.menuRemoveServer_Click);
//
// menuRemoveDuplicateServer
//
this.menuRemoveDuplicateServer.Name = "menuRemoveDuplicateServer";
resources.ApplyResources(this.menuRemoveDuplicateServer, "menuRemoveDuplicateServer");
this.menuRemoveDuplicateServer.Click += new System.EventHandler(this.menuRemoveDuplicateServer_Click);
//
// menuCopyServer
//
this.menuCopyServer.Name = "menuCopyServer";
@@ -308,18 +294,6 @@
resources.ApplyResources(this.menuPingServer, "menuPingServer");
this.menuPingServer.Click += new System.EventHandler(this.menuPingServer_Click);
//
// menuTcpingServer
//
this.menuTcpingServer.Name = "menuTcpingServer";
resources.ApplyResources(this.menuTcpingServer, "menuTcpingServer");
this.menuTcpingServer.Click += new System.EventHandler(this.menuTcpingServer_Click);
//
// menuRealPingServer
//
this.menuRealPingServer.Name = "menuRealPingServer";
resources.ApplyResources(this.menuRealPingServer, "menuRealPingServer");
this.menuRealPingServer.Click += new System.EventHandler(this.menuRealPingServer_Click);
//
// menuSpeedServer
//
this.menuSpeedServer.Name = "menuSpeedServer";
@@ -355,11 +329,6 @@
resources.ApplyResources(this.menuExport2SubContent, "menuExport2SubContent");
this.menuExport2SubContent.Click += new System.EventHandler(this.menuExport2SubContent_Click);
//
// qrCodeControl
//
resources.ApplyResources(this.qrCodeControl, "qrCodeControl");
this.qrCodeControl.Name = "qrCodeControl";
//
// tsbServer
//
this.tsbServer.DropDown = this.cmsLv;
@@ -367,6 +336,11 @@
resources.ApplyResources(this.tsbServer, "tsbServer");
this.tsbServer.Name = "tsbServer";
//
// qrCodeControl
//
resources.ApplyResources(this.qrCodeControl, "qrCodeControl");
this.qrCodeControl.Name = "qrCodeControl";
//
// notifyMain
//
this.notifyMain.ContextMenuStrip = this.cmsMain;
@@ -465,6 +439,12 @@
resources.ApplyResources(this.menuExit, "menuExit");
this.menuExit.Click += new System.EventHandler(this.menuExit_Click);
//
// bgwPing
//
this.bgwPing.WorkerReportsProgress = true;
this.bgwPing.DoWork += new System.ComponentModel.DoWorkEventHandler(this.bgwPing_DoWork);
this.bgwPing.ProgressChanged += new System.ComponentModel.ProgressChangedEventHandler(this.bgwPing_ProgressChanged);
//
// bgwScan
//
this.bgwScan.WorkerReportsProgress = true;
@@ -506,17 +486,15 @@
this.toolSslBlank2,
this.toolSslPacPortLab,
this.toolSslPacPort,
this.toolSslBlank3,
this.toolSslServerSpeed,
this.toolSslBlank4});
this.toolSslBlank3});
resources.ApplyResources(this.ssMain, "ssMain");
this.ssMain.Name = "ssMain";
this.ssMain.ItemClicked += new System.Windows.Forms.ToolStripItemClickedEventHandler(this.ssMain_ItemClicked);
//
// toolSslSocksPortLab
//
resources.ApplyResources(this.toolSslSocksPortLab, "toolSslSocksPortLab");
this.toolSslSocksPortLab.Name = "toolSslSocksPortLab";
resources.ApplyResources(this.toolSslSocksPortLab, "toolSslSocksPortLab");
//
// toolSslSocksPort
//
@@ -525,15 +503,10 @@
//
// toolSslBlank1
//
resources.ApplyResources(this.toolSslBlank1, "toolSslBlank1");
this.toolSslBlank1.Name = "toolSslBlank1";
resources.ApplyResources(this.toolSslBlank1, "toolSslBlank1");
this.toolSslBlank1.Spring = true;
//
// toolSslHttpPortLab
//
resources.ApplyResources(this.toolSslHttpPortLab, "toolSslHttpPortLab");
this.toolSslHttpPortLab.Name = "toolSslHttpPortLab";
//
// toolSslHttpPort
//
this.toolSslHttpPort.Name = "toolSslHttpPort";
@@ -541,15 +514,10 @@
//
// toolSslBlank2
//
resources.ApplyResources(this.toolSslBlank2, "toolSslBlank2");
this.toolSslBlank2.Name = "toolSslBlank2";
resources.ApplyResources(this.toolSslBlank2, "toolSslBlank2");
this.toolSslBlank2.Spring = true;
//
// toolSslPacPortLab
//
resources.ApplyResources(this.toolSslPacPortLab, "toolSslPacPortLab");
this.toolSslPacPortLab.Name = "toolSslPacPortLab";
//
// toolSslPacPort
//
this.toolSslPacPort.Name = "toolSslPacPort";
@@ -557,21 +525,10 @@
//
// toolSslBlank3
//
resources.ApplyResources(this.toolSslBlank3, "toolSslBlank3");
this.toolSslBlank3.Name = "toolSslBlank3";
resources.ApplyResources(this.toolSslBlank3, "toolSslBlank3");
this.toolSslBlank3.Spring = true;
//
// toolSslServerSpeed
//
resources.ApplyResources(this.toolSslServerSpeed, "toolSslServerSpeed");
this.toolSslServerSpeed.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text;
this.toolSslServerSpeed.Name = "toolSslServerSpeed";
//
// toolSslBlank4
//
this.toolSslBlank4.Name = "toolSslBlank4";
resources.ApplyResources(this.toolSslBlank4, "toolSslBlank4");
//
// panel1
//
resources.ApplyResources(this.panel1, "panel1");
@@ -745,6 +702,16 @@
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");
@@ -759,7 +726,6 @@
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);
@@ -784,13 +750,14 @@
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.GroupBox groupBox2;
private System.Windows.Forms.TextBox txtMsgBox;
private v2rayN.Forms.ListViewFlickerFree lvServers;
private System.Windows.Forms.ListView lvServers;
private System.Windows.Forms.NotifyIcon notifyMain;
private System.Windows.Forms.ContextMenuStrip cmsMain;
private System.Windows.Forms.ToolStripMenuItem menuExit;
private System.Windows.Forms.Panel panel1;
private System.Windows.Forms.ToolStripMenuItem menuServers;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator2;
private System.ComponentModel.BackgroundWorker bgwPing;
private System.Windows.Forms.ContextMenuStrip cmsLv;
private System.Windows.Forms.ToolStripMenuItem menuAddVmessServer;
private System.Windows.Forms.ToolStripMenuItem menuRemoveServer;
@@ -863,11 +830,6 @@
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;
private System.Windows.Forms.ToolStripMenuItem menuTcpingServer;
private System.Windows.Forms.ToolStripMenuItem menuRealPingServer;
}
}
+118 -260
View File
@@ -1,13 +1,12 @@
using System;
using System.Collections.Generic;
using System.Drawing;
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
{
@@ -16,8 +15,8 @@ namespace v2rayN.Forms
private V2rayHandler v2rayHandler;
private PACListHandle pacListHandle;
private V2rayUpdateHandle v2rayUpdateHandle;
private V2rayUpdateHandle v2rayUpdateHandle2;
private List<int> lvSelecteds = new List<int>();
private StatisticsHandler statistics = null;
#region Window
@@ -32,7 +31,6 @@ namespace v2rayN.Forms
Application.ApplicationExit += (sender, args) =>
{
Utils.ClearTempPath();
statistics?.Close();
};
}
@@ -42,30 +40,12 @@ namespace v2rayN.Forms
v2rayHandler = new V2rayHandler();
v2rayHandler.ProcessEvent += v2rayHandler_ProcessEvent;
if (config.enableStatistics)
{
statistics = new StatisticsHandler(config, UpdateStatisticsHandler);
}
}
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();
@@ -79,17 +59,9 @@ 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)
@@ -108,7 +80,7 @@ namespace v2rayN.Forms
{
//config.uiItem.mainQRCodeWidth = splitContainer1.SplitterDistance;
}
private const int WM_QUERYENDSESSION = 0x0011;
protected override void WndProc(ref Message m)
{
@@ -116,9 +88,7 @@ namespace v2rayN.Forms
{
case WM_QUERYENDSESSION:
Utils.SaveLog("Windows shutdown UnsetProxy");
//CloseV2ray();
ConfigHandler.ToJsonFile(config);
statistics?.SaveToFile();
CloseV2ray();
ProxySetting.UnsetProxy();
m.Result = (IntPtr)1;
break;
@@ -162,15 +132,8 @@ 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"), 70, HorizontalAlignment.Left);
lvServers.Columns.Add(UIRes.I18N("LvTestResults"), 100, 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>
@@ -183,52 +146,14 @@ 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 = null;
if (statistics != null && statistics.Enable)
ListViewItem lvItem = new ListViewItem(new string[]
{
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,
@@ -240,14 +165,8 @@ namespace v2rayN.Forms
item.network,
item.getSubRemarks(config),
item.testResult
//totalUp,
//totalDown,
//todayUp,
//todayDown,
});
}
if (lvItem != null) lvServers.Items.Add(lvItem);
});
lvServers.Items.Add(lvItem);
}
//if (lvServers.Items.Count > 0)
@@ -322,75 +241,26 @@ 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)
{
if (PACServerHandle.IsRunning)
{
toolSslPacPort.Text = $"{HttpProxyHandle.GetPacUrl()}";
}
else
{
toolSslPacPort.Text = UIRes.I18N("StartPacFailed");
}
toolSslPacPort.Text = $"{HttpProxyHandle.GetPacUrl()}";
}
}
notifyMain.Icon = GetNotifyIcon();
}
private void ssMain_ItemClicked(object sender, ToolStripItemClickedEventArgs e)
{
if (!Utils.IsNullOrEmpty(e.ClickedItem.Text))
if (!string.IsNullOrEmpty(e.ClickedItem.Text))
{
Utils.SetClipboardData(e.ClickedItem.Text);
}
}
private Icon GetNotifyIcon()
{
try
{
var color = ColorTranslator.FromHtml("#3399CC");
var index = config.sysAgentEnabled ? config.listenerType : 0;
if (index > 0)
{
color = (new Color[] { Color.Red, Color.Purple, Color.DarkGreen, Color.Orange })[index - 1];
//color = ColorTranslator.FromHtml(new string[] { "#CC0066", "#CC6600", "#99CC99", "#666699" }[index - 1]);
}
var width = 128;
var height = 128;
var bitmap = new Bitmap(width, height);
var graphics = Graphics.FromImage(bitmap);
var drawBrush = new SolidBrush(color);
graphics.FillEllipse(drawBrush, new Rectangle(0, 0, width, height));
var zoom = 16;
graphics.DrawImage(new Bitmap(Properties.Resources.notify, width - zoom, width - zoom), zoom / 2, zoom / 2);
bitmap.Save(Utils.GetPath("temp_icon.ico"), System.Drawing.Imaging.ImageFormat.Icon);
Icon createdIcon = Icon.FromHandle(bitmap.GetHicon());
drawBrush.Dispose();
graphics.Dispose();
bitmap.Dispose();
return createdIcon;
}
catch (Exception ex)
{
Utils.SaveLog(ex.Message, ex);
return this.Icon;
}
}
#endregion
#region v2ray
@@ -406,7 +276,6 @@ namespace v2rayN.Forms
}
v2rayHandler.LoadV2ray(config);
Global.reloadV2ray = false;
ConfigHandler.ToJsonFile(config);
ChangeSysAgent(config.sysAgentEnabled);
DisplayToolStatus();
@@ -489,18 +358,6 @@ namespace v2rayN.Forms
case Keys.A:
menuSelectAll_Click(null, null);
break;
case Keys.P:
menuPingServer_Click(null, null);
break;
case Keys.O:
menuTcpingServer_Click(null, null);
break;
case Keys.R:
menuRealPingServer_Click(null, null);
break;
case Keys.T:
menuSpeedServer_Click(null, null);
break;
}
}
switch (e.KeyCode)
@@ -554,19 +411,6 @@ 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();
}
private void menuCopyServer_Click(object sender, EventArgs e)
{
int index = GetLvSelectedIndex();
@@ -596,28 +440,7 @@ namespace v2rayN.Forms
{
GetLvSelectedIndex();
ClearTestResult();
var statistics = new SpeedtestHandler(ref config, ref v2rayHandler, lvSelecteds, "ping", UpdateSpeedtestHandler);
}
private void menuTcpingServer_Click(object sender, EventArgs e)
{
GetLvSelectedIndex();
ClearTestResult();
var statistics = new SpeedtestHandler(ref config, ref v2rayHandler, lvSelecteds, "tcping", UpdateSpeedtestHandler);
}
private void menuRealPingServer_Click(object sender, EventArgs e)
{
if (!config.sysAgentEnabled || config.listenerType != 1)
{
UI.Show(UIRes.I18N("NeedHttpGlobalProxy"));
return;
}
UI.Show(UIRes.I18N("SpeedServerTips"));
GetLvSelectedIndex();
ClearTestResult();
var statistics = new SpeedtestHandler(ref config, ref v2rayHandler, lvSelecteds, "realping", UpdateSpeedtestHandler);
bgwPing.RunWorkerAsync();
}
private void menuSpeedServer_Click(object sender, EventArgs e)
@@ -631,7 +454,7 @@ namespace v2rayN.Forms
UI.Show(UIRes.I18N("SpeedServerTips"));
GetLvSelectedIndex();
var statistics = new SpeedtestHandler(ref config, ref v2rayHandler, lvSelecteds, "speedtest", UpdateSpeedtestHandler);
ServerSpeedTest();
}
private void menuExport2ClientConfig_Click(object sender, EventArgs e)
@@ -1011,9 +834,6 @@ namespace v2rayN.Forms
this.Visible = false;
this.Close();
statistics?.Close();
//this.Dispose();
//System.Environment.Exit(System.Environment.ExitCode);
Application.Exit();
@@ -1035,7 +855,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;
@@ -1045,11 +865,43 @@ namespace v2rayN.Forms
#endregion
#region
private void bgwPing_DoWork(object sender, System.ComponentModel.DoWorkEventArgs e)
{
try
{
for (int k = 0; k < lvSelecteds.Count; k++)
{
int index = lvSelecteds[k];
if (config.vmess[index].configType == (int)EConfigType.Custom)
{
continue;
}
long time = Utils.Ping(config.vmess[index].address);
bgwPing.ReportProgress(index, string.Format("{0}ms", time));
}
}
catch
{
}
}
private void bgwPing_ProgressChanged(object sender, System.ComponentModel.ProgressChangedEventArgs e)
{
try
{
int k = e.ProgressPercentage;
string time = string.Format("{0}", Convert.ToString(e.UserState));
SetTestResult(k, time);
}
catch
{
}
}
private void SetTestResult(int k, string txt)
{
config.vmess[k].testResult = txt;
lvServers.Items[k].SubItems[8].Text = txt;
lvServers.Items[k].SubItems[lvServers.Items[k].SubItems.Count - 1].Text = txt;
}
private void ClearTestResult()
{
@@ -1058,70 +910,77 @@ namespace v2rayN.Forms
SetTestResult(k, "");
}
}
private void UpdateSpeedtestHandler(int index, string msg)
private int testCounter = 0;
private int ServerSpeedTestSub(int index, string url)
{
lvServers.Invoke((MethodInvoker)delegate
if (index >= lvSelecteds.Count)
{
lvServers.SuspendLayout();
SetTestResult(index, msg);
lvServers.ResumeLayout();
});
}
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();
});
return -1;
}
catch (Exception ex)
if (ConfigHandler.SetDefaultServer(ref config, lvSelecteds[index]) == 0)
{
Utils.SaveLog(ex.Message, ex);
SetTestResult(lvSelecteds[index], "testing...");
v2rayHandler.LoadV2ray(config);
v2rayUpdateHandle2.DownloadFileAsync(config, url);
testCounter++;
return 0;
}
else
{
return -1;
}
}
private void ServerSpeedTest()
{
if (config.vmess.Count <= 0)
{
return;
}
ClearTestResult();
string url = Global.SpeedTestUrl;
testCounter = 0;
if (v2rayUpdateHandle2 == null)
{
v2rayUpdateHandle2 = new V2rayUpdateHandle();
v2rayUpdateHandle2.UpdateCompleted += (sender2, args) =>
{
if (args.Success)
{
AppendText(false, args.Msg);
SetTestResult(lvSelecteds[testCounter - 1], args.Msg);
if (ServerSpeedTestSub(testCounter, url) != 0)
{
RefreshServers();
return;
}
}
else
{
AppendText(false, args.Msg);
}
};
v2rayUpdateHandle2.Error += (sender2, args) =>
{
SetTestResult(lvSelecteds[testCounter - 1], args.GetException().Message);
AppendText(true, args.GetException().Message);
if (ServerSpeedTestSub(testCounter, url) != 0)
{
RefreshServers();
return;
}
};
}
if (ServerSpeedTestSub(testCounter, url) != 0)
{
return;
}
}
#endregion
#region
@@ -1424,7 +1283,7 @@ namespace v2rayN.Forms
ShowForm();
string result = Convert.ToString(e.UserState);
if (Utils.IsNullOrEmpty(result))
if (string.IsNullOrEmpty(result))
{
UI.Show(UIRes.I18N("NoValidQRcodeFound"));
}
@@ -1461,8 +1320,8 @@ namespace v2rayN.Forms
for (int k = 1; k <= config.subItem.Count; k++)
{
string id = config.subItem[k - 1].id.TrimEx();
string url = config.subItem[k - 1].url.TrimEx();
string id = config.subItem[k - 1].id.Trim();
string url = config.subItem[k - 1].url.Trim();
string hashCode = $"{k}->";
if (config.subItem[k - 1].enabled == false)
{
@@ -1534,9 +1393,8 @@ namespace v2rayN.Forms
Utils.RegWriteValue(Global.MyRegPath, Global.MyRegKeyLanguage, value);
}
#endregion
}
}
+119 -197
View File
@@ -173,12 +173,6 @@
<data name="menuRemoveServer.Text" xml:space="preserve">
<value>Remove selected server (multiple choice) (Delete)</value>
</data>
<data name="menuRemoveDuplicateServer.Size" type="System.Drawing.Size, System.Drawing">
<value>447, 22</value>
</data>
<data name="menuRemoveDuplicateServer.Text" xml:space="preserve">
<value>Remove duplicate server</value>
</data>
<data name="menuCopyServer.Size" type="System.Drawing.Size, System.Drawing">
<value>447, 22</value>
</data>
@@ -231,25 +225,13 @@
<value>447, 22</value>
</data>
<data name="menuPingServer.Text" xml:space="preserve">
<value>Test server ping (multiple choice)(Ctrl+P)</value>
</data>
<data name="menuTcpingServer.Size" type="System.Drawing.Size, System.Drawing">
<value>447, 22</value>
</data>
<data name="menuTcpingServer.Text" xml:space="preserve">
<value>Test server tcping (multiple choice)(Ctrl+O)</value>
</data>
<data name="menuRealPingServer.Size" type="System.Drawing.Size, System.Drawing">
<value>447, 22</value>
</data>
<data name="menuRealPingServer.Text" xml:space="preserve">
<value>Test server real ping (multiple choice)(Ctrl+R)</value>
<value>Test server delay (multiple choice)</value>
</data>
<data name="menuSpeedServer.Size" type="System.Drawing.Size, System.Drawing">
<value>447, 22</value>
</data>
<data name="menuSpeedServer.Text" xml:space="preserve">
<value>Test server speed (multiple choice)(Ctrl+T)</value>
<value>Test server speed (multiple choice)</value>
</data>
<data name="toolStripSeparator6.Size" type="System.Drawing.Size, System.Drawing">
<value>444, 6</value>
@@ -291,7 +273,7 @@
<value>ImageAboveText</value>
</data>
<data name="cmsLv.Size" type="System.Drawing.Size, System.Drawing">
<value>448, 556</value>
<value>448, 468</value>
</data>
<data name="&gt;&gt;cmsLv.Name" xml:space="preserve">
<value>cmsLv</value>
@@ -323,7 +305,7 @@
<value>0, 0</value>
</data>
<data name="lvServers.Size" type="System.Drawing.Size, System.Drawing">
<value>686, 331</value>
<value>726, 331</value>
</data>
<assembly alias="mscorlib" name="mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="lvServers.TabIndex" type="System.Int32, mscorlib">
@@ -333,7 +315,7 @@
<value>lvServers</value>
</data>
<data name="&gt;&gt;lvServers.Type" xml:space="preserve">
<value>v2rayN.Forms.ListViewFlickerFree, v2rayN, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null</value>
<value>System.Windows.Forms.ListView, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;lvServers.Parent" xml:space="preserve">
<value>splitContainer1.Panel1</value>
@@ -393,10 +375,10 @@
<value>100</value>
</data>
<data name="splitContainer1.Size" type="System.Drawing.Size, System.Drawing">
<value>946, 331</value>
<value>986, 331</value>
</data>
<data name="splitContainer1.SplitterDistance" type="System.Int32, mscorlib">
<value>686</value>
<value>726</value>
</data>
<data name="splitContainer1.TabIndex" type="System.Int32, mscorlib">
<value>2</value>
@@ -422,12 +404,33 @@
<data name="cmsMain.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
<value>NoControl</value>
</data>
<data name="cmsMain.Size" type="System.Drawing.Size, System.Drawing">
<value>265, 164</value>
</data>
<data name="&gt;&gt;cmsMain.Name" xml:space="preserve">
<value>cmsMain</value>
</data>
<data name="&gt;&gt;cmsMain.Type" xml:space="preserve">
<value>System.Windows.Forms.ContextMenuStrip, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="notifyMain.Text" xml:space="preserve">
<value>v2rayN</value>
</data>
<data name="notifyMain.Visible" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="menuSysAgentEnabled.Size" type="System.Drawing.Size, System.Drawing">
<value>264, 22</value>
</data>
<data name="menuSysAgentEnabled.Text" xml:space="preserve">
<value>Enable Http proxy</value>
</data>
<data name="menuSysAgentMode.Size" type="System.Drawing.Size, System.Drawing">
<value>264, 22</value>
</data>
<data name="menuSysAgentMode.Text" xml:space="preserve">
<value>Http proxy mode</value>
</data>
<data name="menuGlobal.Size" type="System.Drawing.Size, System.Drawing">
<value>547, 22</value>
</data>
@@ -452,12 +455,6 @@
<data name="menuKeepPAC.Text" xml:space="preserve">
<value>Only open PAC, do not automatically configure PAC</value>
</data>
<data name="menuSysAgentMode.Size" type="System.Drawing.Size, System.Drawing">
<value>264, 22</value>
</data>
<data name="menuSysAgentMode.Text" xml:space="preserve">
<value>Http proxy mode</value>
</data>
<data name="menuServers.Size" type="System.Drawing.Size, System.Drawing">
<value>264, 22</value>
</data>
@@ -491,21 +488,9 @@
<data name="menuExit.Text" xml:space="preserve">
<value>Exit</value>
</data>
<data name="cmsMain.Size" type="System.Drawing.Size, System.Drawing">
<value>265, 164</value>
</data>
<data name="&gt;&gt;cmsMain.Name" xml:space="preserve">
<value>cmsMain</value>
</data>
<data name="&gt;&gt;cmsMain.Type" xml:space="preserve">
<value>System.Windows.Forms.ContextMenuStrip, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="notifyMain.Text" xml:space="preserve">
<value>v2rayN</value>
</data>
<data name="notifyMain.Visible" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<metadata name="bgwPing.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>232, 17</value>
</metadata>
<metadata name="bgwScan.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>498, 17</value>
</metadata>
@@ -516,7 +501,7 @@
<value>0, 66</value>
</data>
<data name="groupBox1.Size" type="System.Drawing.Size, System.Drawing">
<value>952, 351</value>
<value>992, 351</value>
</data>
<data name="groupBox1.TabIndex" type="System.Int32, mscorlib">
<value>2</value>
@@ -552,7 +537,7 @@
<value>Vertical</value>
</data>
<data name="txtMsgBox.Size" type="System.Drawing.Size, System.Drawing">
<value>946, 134</value>
<value>986, 134</value>
</data>
<data name="txtMsgBox.TabIndex" type="System.Int32, mscorlib">
<value>2</value>
@@ -570,13 +555,10 @@
<value>0</value>
</data>
<metadata name="ssMain.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>228, 18</value>
<value>603, 17</value>
</metadata>
<data name="toolSslSocksPortLab.Font" type="System.Drawing.Font, System.Drawing">
<value>微软雅黑, 8pt</value>
</data>
<data name="toolSslSocksPortLab.Size" type="System.Drawing.Size, System.Drawing">
<value>49, 17</value>
<value>55, 17</value>
</data>
<data name="toolSslSocksPortLab.Text" xml:space="preserve">
<value>SOCKS5</value>
@@ -584,17 +566,11 @@
<data name="toolSslSocksPort.Size" type="System.Drawing.Size, System.Drawing">
<value>0, 17</value>
</data>
<data name="toolSslBlank1.Font" type="System.Drawing.Font, System.Drawing">
<value>微软雅黑, 8pt</value>
</data>
<data name="toolSslBlank1.Size" type="System.Drawing.Size, System.Drawing">
<value>198, 17</value>
</data>
<data name="toolSslHttpPortLab.Font" type="System.Drawing.Font, System.Drawing">
<value>微软雅黑, 8pt</value>
<value>238, 17</value>
</data>
<data name="toolSslHttpPortLab.Size" type="System.Drawing.Size, System.Drawing">
<value>36, 17</value>
<value>38, 17</value>
</data>
<data name="toolSslHttpPortLab.Text" xml:space="preserve">
<value>HTTP</value>
@@ -602,17 +578,11 @@
<data name="toolSslHttpPort.Size" type="System.Drawing.Size, System.Drawing">
<value>0, 17</value>
</data>
<data name="toolSslBlank2.Font" type="System.Drawing.Font, System.Drawing">
<value>微软雅黑, 8pt</value>
</data>
<data name="toolSslBlank2.Size" type="System.Drawing.Size, System.Drawing">
<value>198, 17</value>
</data>
<data name="toolSslPacPortLab.Font" type="System.Drawing.Font, System.Drawing">
<value>微软雅黑, 8pt</value>
<value>238, 17</value>
</data>
<data name="toolSslPacPortLab.Size" type="System.Drawing.Size, System.Drawing">
<value>30, 17</value>
<value>31, 17</value>
</data>
<data name="toolSslPacPortLab.Text" xml:space="preserve">
<value>PAC</value>
@@ -620,38 +590,14 @@
<data name="toolSslPacPort.Size" type="System.Drawing.Size, System.Drawing">
<value>0, 17</value>
</data>
<data name="toolSslBlank3.Font" type="System.Drawing.Font, System.Drawing">
<value>微软雅黑, 8pt</value>
</data>
<data name="toolSslBlank3.Size" type="System.Drawing.Size, System.Drawing">
<value>198, 17</value>
</data>
<data name="toolSslServerSpeed.AutoSize" type="System.Boolean, mscorlib">
<value>False</value>
</data>
<data name="toolSslServerSpeed.Font" type="System.Drawing.Font, System.Drawing">
<value>微软雅黑, 8pt</value>
</data>
<data name="toolSslServerSpeed.RightToLeft" type="System.Windows.Forms.RightToLeft, System.Windows.Forms">
<value>No</value>
</data>
<data name="toolSslServerSpeed.Size" type="System.Drawing.Size, System.Drawing">
<value>220, 17</value>
</data>
<data name="toolSslServerSpeed.Text" xml:space="preserve">
<value>SPEED Disabled</value>
</data>
<data name="toolSslServerSpeed.TextAlign" type="System.Drawing.ContentAlignment, System.Drawing">
<value>MiddleRight</value>
</data>
<data name="toolSslBlank4.Size" type="System.Drawing.Size, System.Drawing">
<value>0, 17</value>
<value>238, 17</value>
</data>
<data name="ssMain.Location" type="System.Drawing.Point, System.Drawing">
<value>3, 151</value>
</data>
<data name="ssMain.Size" type="System.Drawing.Size, System.Drawing">
<value>946, 22</value>
<value>986, 22</value>
</data>
<data name="ssMain.TabIndex" type="System.Int32, mscorlib">
<value>7</value>
@@ -678,7 +624,7 @@
<value>0, 417</value>
</data>
<data name="groupBox2.Size" type="System.Drawing.Size, System.Drawing">
<value>952, 176</value>
<value>992, 176</value>
</data>
<data name="groupBox2.TabIndex" type="System.Int32, mscorlib">
<value>4</value>
@@ -705,7 +651,7 @@
<value>0, 56</value>
</data>
<data name="panel1.Size" type="System.Drawing.Size, System.Drawing">
<value>952, 10</value>
<value>992, 10</value>
</data>
<data name="panel1.TabIndex" type="System.Int32, mscorlib">
<value>5</value>
@@ -725,21 +671,30 @@
<metadata name="tsMain.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>409, 17</value>
</metadata>
<data name="tsMain.Location" type="System.Drawing.Point, System.Drawing">
<value>0, 0</value>
</data>
<data name="tsMain.Size" type="System.Drawing.Size, System.Drawing">
<value>992, 56</value>
</data>
<data name="tsMain.TabIndex" type="System.Int32, mscorlib">
<value>6</value>
</data>
<data name="&gt;&gt;tsMain.Name" xml:space="preserve">
<value>tsMain</value>
</data>
<data name="&gt;&gt;tsMain.Type" xml:space="preserve">
<value>System.Windows.Forms.ToolStrip, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;tsMain.Parent" xml:space="preserve">
<value>$this</value>
</data>
<data name="&gt;&gt;tsMain.ZOrder" xml:space="preserve">
<value>5</value>
</data>
<data name="toolStripSeparator4.Size" type="System.Drawing.Size, System.Drawing">
<value>6, 56</value>
</data>
<data name="tsbSubSetting.Size" type="System.Drawing.Size, System.Drawing">
<value>197, 22</value>
</data>
<data name="tsbSubSetting.Text" xml:space="preserve">
<value>Subscription settings</value>
</data>
<data name="tsbSubUpdate.Size" type="System.Drawing.Size, System.Drawing">
<value>197, 22</value>
</data>
<data name="tsbSubUpdate.Text" xml:space="preserve">
<value>Update subscription</value>
</data>
<data name="tsbSub.ImageTransparentColor" type="System.Drawing.Color, System.Drawing">
<value>Magenta</value>
</data>
@@ -752,6 +707,18 @@
<data name="tsbSub.TextImageRelation" type="System.Windows.Forms.TextImageRelation, System.Windows.Forms">
<value>ImageAboveText</value>
</data>
<data name="tsbSubSetting.Size" type="System.Drawing.Size, System.Drawing">
<value>197, 22</value>
</data>
<data name="tsbSubSetting.Text" xml:space="preserve">
<value>Subscription settings</value>
</data>
<data name="tsbSubUpdate.Size" type="System.Drawing.Size, System.Drawing">
<value>197, 22</value>
</data>
<data name="tsbSubUpdate.Text" xml:space="preserve">
<value>Update subscription</value>
</data>
<data name="toolStripSeparator8.Size" type="System.Drawing.Size, System.Drawing">
<value>6, 56</value>
</data>
@@ -799,6 +766,18 @@
<data name="toolStripSeparator7.Size" type="System.Drawing.Size, System.Drawing">
<value>6, 56</value>
</data>
<data name="tsbCheckUpdate.ImageTransparentColor" type="System.Drawing.Color, System.Drawing">
<value>Magenta</value>
</data>
<data name="tsbCheckUpdate.Size" type="System.Drawing.Size, System.Drawing">
<value>128, 53</value>
</data>
<data name="tsbCheckUpdate.Text" xml:space="preserve">
<value>Check for updates</value>
</data>
<data name="tsbCheckUpdate.TextImageRelation" type="System.Windows.Forms.TextImageRelation, System.Windows.Forms">
<value>ImageAboveText</value>
</data>
<data name="tsbCheckUpdateN.Size" type="System.Drawing.Size, System.Drawing">
<value>338, 22</value>
</data>
@@ -823,21 +802,21 @@
<data name="tsbCheckClearPACList.Text" xml:space="preserve">
<value>Simplify PAC (please set Core route)</value>
</data>
<data name="tsbCheckUpdate.ImageTransparentColor" type="System.Drawing.Color, System.Drawing">
<value>Magenta</value>
</data>
<data name="tsbCheckUpdate.Size" type="System.Drawing.Size, System.Drawing">
<value>128, 53</value>
</data>
<data name="tsbCheckUpdate.Text" xml:space="preserve">
<value>Check for updates</value>
</data>
<data name="tsbCheckUpdate.TextImageRelation" type="System.Windows.Forms.TextImageRelation, System.Windows.Forms">
<value>ImageAboveText</value>
</data>
<data name="toolStripSeparator10.Size" type="System.Drawing.Size, System.Drawing">
<value>6, 56</value>
</data>
<data name="tsbHelp.ImageTransparentColor" type="System.Drawing.Color, System.Drawing">
<value>Magenta</value>
</data>
<data name="tsbHelp.Size" type="System.Drawing.Size, System.Drawing">
<value>48, 53</value>
</data>
<data name="tsbHelp.Text" xml:space="preserve">
<value>Help</value>
</data>
<data name="tsbHelp.TextImageRelation" type="System.Windows.Forms.TextImageRelation, System.Windows.Forms">
<value>ImageAboveText</value>
</data>
<data name="tsbAbout.Size" type="System.Drawing.Size, System.Drawing">
<value>187, 22</value>
</data>
@@ -859,18 +838,6 @@
<data name="tsbLanguageZhHans.Text" xml:space="preserve">
<value>语言-[中文简体]</value>
</data>
<data name="tsbHelp.ImageTransparentColor" type="System.Drawing.Color, System.Drawing">
<value>Magenta</value>
</data>
<data name="tsbHelp.Size" type="System.Drawing.Size, System.Drawing">
<value>48, 53</value>
</data>
<data name="tsbHelp.Text" xml:space="preserve">
<value>Help</value>
</data>
<data name="tsbHelp.TextImageRelation" type="System.Windows.Forms.TextImageRelation, System.Windows.Forms">
<value>ImageAboveText</value>
</data>
<data name="tsbPromotion.ImageTransparentColor" type="System.Drawing.Color, System.Drawing">
<value>Magenta</value>
</data>
@@ -905,27 +872,6 @@
<data name="tsbClose.TextImageRelation" type="System.Windows.Forms.TextImageRelation, System.Windows.Forms">
<value>ImageAboveText</value>
</data>
<data name="tsMain.Location" type="System.Drawing.Point, System.Drawing">
<value>0, 0</value>
</data>
<data name="tsMain.Size" type="System.Drawing.Size, System.Drawing">
<value>952, 56</value>
</data>
<data name="tsMain.TabIndex" type="System.Int32, mscorlib">
<value>6</value>
</data>
<data name="&gt;&gt;tsMain.Name" xml:space="preserve">
<value>tsMain</value>
</data>
<data name="&gt;&gt;tsMain.Type" xml:space="preserve">
<value>System.Windows.Forms.ToolStrip, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;tsMain.Parent" xml:space="preserve">
<value>$this</value>
</data>
<data name="&gt;&gt;tsMain.ZOrder" xml:space="preserve">
<value>5</value>
</data>
<metadata name="$this.Localizable" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
@@ -936,7 +882,7 @@
<value>6, 12</value>
</data>
<data name="$this.ClientSize" type="System.Drawing.Size, System.Drawing">
<value>952, 593</value>
<value>992, 593</value>
</data>
<data name="$this.Margin" type="System.Windows.Forms.Padding, System.Windows.Forms">
<value>4, 4, 4, 4</value>
@@ -992,12 +938,6 @@
<data name="&gt;&gt;menuRemoveServer.Type" xml:space="preserve">
<value>System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;menuRemoveDuplicateServer.Name" xml:space="preserve">
<value>menuRemoveDuplicateServer</value>
</data>
<data name="&gt;&gt;menuRemoveDuplicateServer.Type" xml:space="preserve">
<value>System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;menuCopyServer.Name" xml:space="preserve">
<value>menuCopyServer</value>
</data>
@@ -1058,18 +998,6 @@
<data name="&gt;&gt;menuPingServer.Type" xml:space="preserve">
<value>System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;menuTcpingServer.Name" xml:space="preserve">
<value>menuTcpingServer</value>
</data>
<data name="&gt;&gt;menuTcpingServer.Type" xml:space="preserve">
<value>System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;menuRealPingServer.Name" xml:space="preserve">
<value>menuRealPingServer</value>
</data>
<data name="&gt;&gt;menuRealPingServer.Type" xml:space="preserve">
<value>System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;menuSpeedServer.Name" xml:space="preserve">
<value>menuSpeedServer</value>
</data>
@@ -1190,6 +1118,12 @@
<data name="&gt;&gt;menuExit.Type" xml:space="preserve">
<value>System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;bgwPing.Name" xml:space="preserve">
<value>bgwPing</value>
</data>
<data name="&gt;&gt;bgwPing.Type" xml:space="preserve">
<value>System.ComponentModel.BackgroundWorker, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;bgwScan.Name" xml:space="preserve">
<value>bgwScan</value>
</data>
@@ -1214,12 +1148,6 @@
<data name="&gt;&gt;toolSslBlank1.Type" xml:space="preserve">
<value>System.Windows.Forms.ToolStripStatusLabel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;toolSslHttpPortLab.Name" xml:space="preserve">
<value>toolSslHttpPortLab</value>
</data>
<data name="&gt;&gt;toolSslHttpPortLab.Type" xml:space="preserve">
<value>System.Windows.Forms.ToolStripStatusLabel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;toolSslHttpPort.Name" xml:space="preserve">
<value>toolSslHttpPort</value>
</data>
@@ -1232,12 +1160,6 @@
<data name="&gt;&gt;toolSslBlank2.Type" xml:space="preserve">
<value>System.Windows.Forms.ToolStripStatusLabel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;toolSslPacPortLab.Name" xml:space="preserve">
<value>toolSslPacPortLab</value>
</data>
<data name="&gt;&gt;toolSslPacPortLab.Type" xml:space="preserve">
<value>System.Windows.Forms.ToolStripStatusLabel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;toolSslPacPort.Name" xml:space="preserve">
<value>toolSslPacPort</value>
</data>
@@ -1250,18 +1172,6 @@
<data name="&gt;&gt;toolSslBlank3.Type" xml:space="preserve">
<value>System.Windows.Forms.ToolStripStatusLabel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;toolSslServerSpeed.Name" xml:space="preserve">
<value>toolSslServerSpeed</value>
</data>
<data name="&gt;&gt;toolSslServerSpeed.Type" xml:space="preserve">
<value>System.Windows.Forms.ToolStripStatusLabel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;toolSslBlank4.Name" xml:space="preserve">
<value>toolSslBlank4</value>
</data>
<data name="&gt;&gt;toolSslBlank4.Type" xml:space="preserve">
<value>System.Windows.Forms.ToolStripStatusLabel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;toolStripSeparator4.Name" xml:space="preserve">
<value>toolStripSeparator4</value>
</data>
@@ -1400,6 +1310,18 @@
<data name="&gt;&gt;tsbClose.Type" xml:space="preserve">
<value>System.Windows.Forms.ToolStripButton, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;toolSslHttpPortLab.Name" xml:space="preserve">
<value>toolSslHttpPortLab</value>
</data>
<data name="&gt;&gt;toolSslHttpPortLab.Type" xml:space="preserve">
<value>System.Windows.Forms.ToolStripStatusLabel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;toolSslPacPortLab.Name" xml:space="preserve">
<value>toolSslPacPortLab</value>
</data>
<data name="&gt;&gt;toolSslPacPortLab.Type" xml:space="preserve">
<value>System.Windows.Forms.ToolStripStatusLabel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;$this.Name" xml:space="preserve">
<value>MainForm</value>
</data>
+57 -78
View File
@@ -119,157 +119,145 @@
</resheader>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="menuAddVmessServer.Size" type="System.Drawing.Size, System.Drawing">
<value>278, 22</value>
<value>252, 22</value>
</data>
<data name="menuAddVmessServer.Text" xml:space="preserve">
<value>添加[VMess]服务器</value>
</data>
<data name="menuAddShadowsocksServer.Size" type="System.Drawing.Size, System.Drawing">
<value>278, 22</value>
<value>252, 22</value>
</data>
<data name="menuAddShadowsocksServer.Text" xml:space="preserve">
<value>添加[Shadowsocks]服务器</value>
</data>
<data name="menuAddSocksServer.Size" type="System.Drawing.Size, System.Drawing">
<value>278, 22</value>
<value>252, 22</value>
</data>
<data name="menuAddSocksServer.Text" xml:space="preserve">
<value>添加[Socks]服务器</value>
</data>
<data name="menuAddCustomServer.Size" type="System.Drawing.Size, System.Drawing">
<value>278, 22</value>
<value>252, 22</value>
</data>
<data name="menuAddCustomServer.Text" xml:space="preserve">
<value>添加自定义配置服务器</value>
</data>
<data name="menuAddServers.Size" type="System.Drawing.Size, System.Drawing">
<value>278, 22</value>
<value>252, 22</value>
</data>
<data name="menuAddServers.Text" xml:space="preserve">
<value>从剪贴板导入批量URL</value>
</data>
<data name="menuScanScreen.Size" type="System.Drawing.Size, System.Drawing">
<value>278, 22</value>
<value>252, 22</value>
</data>
<data name="menuScanScreen.Text" xml:space="preserve">
<value>扫描屏幕上的二维码</value>
</data>
<data name="toolStripSeparator1.Size" type="System.Drawing.Size, System.Drawing">
<value>275, 6</value>
<value>249, 6</value>
</data>
<data name="menuRemoveServer.Size" type="System.Drawing.Size, System.Drawing">
<value>278, 22</value>
<value>252, 22</value>
</data>
<data name="menuRemoveServer.Text" xml:space="preserve">
<value>移除所选服务器(多选) (Delete)</value>
</data>
<data name="menuRemoveDuplicateServer.Size" type="System.Drawing.Size, System.Drawing">
<value>278, 22</value>
</data>
<data name="menuRemoveDuplicateServer.Text" xml:space="preserve">
<value>移除重复的服务器</value>
</data>
<data name="menuCopyServer.Size" type="System.Drawing.Size, System.Drawing">
<value>278, 22</value>
<value>252, 22</value>
</data>
<data name="menuCopyServer.Text" xml:space="preserve">
<value>复制所选服务器</value>
</data>
<data name="menuSetDefaultServer.Size" type="System.Drawing.Size, System.Drawing">
<value>278, 22</value>
<value>252, 22</value>
</data>
<data name="menuSetDefaultServer.Text" xml:space="preserve">
<value>设为活动服务器 (Enter)</value>
</data>
<data name="toolStripSeparator3.Size" type="System.Drawing.Size, System.Drawing">
<value>275, 6</value>
<value>249, 6</value>
</data>
<data name="menuMoveTop.Size" type="System.Drawing.Size, System.Drawing">
<value>278, 22</value>
<value>252, 22</value>
</data>
<data name="menuMoveTop.Text" xml:space="preserve">
<value>上移至顶</value>
</data>
<data name="menuMoveUp.Size" type="System.Drawing.Size, System.Drawing">
<value>278, 22</value>
<value>252, 22</value>
</data>
<data name="menuMoveUp.Text" xml:space="preserve">
<value>上移 (U)</value>
</data>
<data name="menuMoveDown.Size" type="System.Drawing.Size, System.Drawing">
<value>278, 22</value>
<value>252, 22</value>
</data>
<data name="menuMoveDown.Text" xml:space="preserve">
<value>下移 (D)</value>
</data>
<data name="menuMoveBottom.Size" type="System.Drawing.Size, System.Drawing">
<value>278, 22</value>
<value>252, 22</value>
</data>
<data name="menuMoveBottom.Text" xml:space="preserve">
<value>下移至底</value>
</data>
<data name="menuSelectAll.Size" type="System.Drawing.Size, System.Drawing">
<value>278, 22</value>
<value>252, 22</value>
</data>
<data name="menuSelectAll.Text" xml:space="preserve">
<value>全选 (Ctrl+A)</value>
</data>
<data name="toolStripSeparator9.Size" type="System.Drawing.Size, System.Drawing">
<value>275, 6</value>
<value>249, 6</value>
</data>
<data name="menuPingServer.Size" type="System.Drawing.Size, System.Drawing">
<value>278, 22</value>
<value>252, 22</value>
</data>
<data name="menuPingServer.Text" xml:space="preserve">
<value>测试服务器延迟Ping(多选)(Ctrl+P)</value>
</data>
<data name="menuTcpingServer.Size" type="System.Drawing.Size, System.Drawing">
<value>278, 22</value>
</data>
<data name="menuTcpingServer.Text" xml:space="preserve">
<value>测试服务器延迟Tcping(多选)(Ctrl+O)</value>
</data>
<data name="menuRealPingServer.Size" type="System.Drawing.Size, System.Drawing">
<value>278, 22</value>
</data>
<data name="menuRealPingServer.Text" xml:space="preserve">
<value>测试服务器真连接延迟(多选)(Ctrl+R)</value>
<value>测试服务器延迟(多选)</value>
</data>
<data name="menuSpeedServer.Size" type="System.Drawing.Size, System.Drawing">
<value>278, 22</value>
<value>252, 22</value>
</data>
<data name="menuSpeedServer.Text" xml:space="preserve">
<value>测试服务器速度(多选)(Ctrl+T)</value>
<value>测试服务器速度(多选)</value>
</data>
<data name="toolStripSeparator6.Size" type="System.Drawing.Size, System.Drawing">
<value>275, 6</value>
<value>249, 6</value>
</data>
<data name="menuExport2ClientConfig.Size" type="System.Drawing.Size, System.Drawing">
<value>278, 22</value>
<value>252, 22</value>
</data>
<data name="menuExport2ClientConfig.Text" xml:space="preserve">
<value>导出所选服务器为客户端配置</value>
</data>
<data name="menuExport2ServerConfig.Size" type="System.Drawing.Size, System.Drawing">
<value>278, 22</value>
<value>252, 22</value>
</data>
<data name="menuExport2ServerConfig.Text" xml:space="preserve">
<value>导出所选服务器为服务端配置</value>
</data>
<data name="menuExport2ShareUrl.Size" type="System.Drawing.Size, System.Drawing">
<value>278, 22</value>
<value>252, 22</value>
</data>
<data name="menuExport2ShareUrl.Text" xml:space="preserve">
<value>批量导出分享URL至剪贴板(多选)</value>
</data>
<data name="menuExport2SubContent.Size" type="System.Drawing.Size, System.Drawing">
<value>278, 22</value>
<value>252, 22</value>
</data>
<data name="menuExport2SubContent.Text" xml:space="preserve">
<value>批量导出订阅内容至剪贴板(多选)</value>
</data>
<data name="tsbServer.Size" type="System.Drawing.Size, System.Drawing">
<value>73, 53</value>
</data>
<data name="tsbServer.Text" xml:space="preserve">
<value> 服务器 </value>
</data>
<data name="cmsLv.Size" type="System.Drawing.Size, System.Drawing">
<value>279, 534</value>
<value>253, 468</value>
</data>
<data name="lvServers.Items" mimetype="application/x-microsoft.net.object.binary.base64">
<value>
@@ -288,27 +276,12 @@
ZW0uRHJhd2luZy5HcmFwaGljc1VuaXQBAAAAB3ZhbHVlX18ACAMAAAADAAAACw==
</value>
</data>
<data name="tsbServer.Size" type="System.Drawing.Size, System.Drawing">
<value>73, 53</value>
</data>
<data name="tsbServer.Text" xml:space="preserve">
<value> 服务器 </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>
@@ -333,6 +306,12 @@
<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>
@@ -366,21 +345,15 @@
<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="toolSslServerSpeed.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="tsbSubSetting.Size" type="System.Drawing.Size, System.Drawing">
<value>124, 22</value>
</data>
@@ -393,6 +366,12 @@
<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>
@@ -416,12 +395,6 @@
<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>
@@ -446,15 +419,21 @@
<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>
-52
View File
@@ -28,7 +28,6 @@
/// </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();
@@ -83,11 +82,6 @@
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();
@@ -95,7 +89,6 @@
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();
@@ -109,7 +102,6 @@
this.tabPage6.SuspendLayout();
this.tabPage7.SuspendLayout();
this.panel2.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.configBindingSource)).BeginInit();
this.SuspendLayout();
//
// btnClose
@@ -481,11 +473,6 @@
//
// 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);
@@ -494,34 +481,6 @@
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");
@@ -563,10 +522,6 @@
resources.ApplyResources(this.panel1, "panel1");
this.panel1.Name = "panel1";
//
// configBindingSource
//
this.configBindingSource.DataSource = typeof(v2rayN.Mode.Config);
//
// OptionSettingForm
//
resources.ApplyResources(this, "$this");
@@ -598,7 +553,6 @@
this.tabPage7.ResumeLayout(false);
this.tabPage7.PerformLayout();
this.panel2.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.configBindingSource)).EndInit();
this.ResumeLayout(false);
}
@@ -665,11 +619,5 @@
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;
}
}
+18 -77
View File
@@ -1,5 +1,7 @@
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Text;
using System.Windows.Forms;
using v2rayN.Handler;
@@ -42,10 +44,6 @@ namespace v2rayN.Forms
cmbprotocol.Text = config.inbound[0].protocol.ToString();
chkudpEnabled.Checked = config.inbound[0].udpEnabled;
chksniffingEnabled.Checked = config.inbound[0].sniffingEnabled;
txtlocalPort2.Text = "socks + 1";
cmbprotocol2.Text = "http";
if (config.inbound.Count > 1)
{
txtlocalPort2.Text = config.inbound[1].localPort.ToString();
@@ -108,37 +106,6 @@ 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)
@@ -181,14 +148,14 @@ namespace v2rayN.Forms
{
//日志
bool logEnabled = chklogEnabled.Checked;
string loglevel = cmbloglevel.Text.TrimEx();
string loglevel = cmbloglevel.Text.Trim();
//Mux
bool muxEnabled = chkmuxEnabled.Checked;
//本地监听
string localPort = txtlocalPort.Text.TrimEx();
string protocol = cmbprotocol.Text.TrimEx();
string localPort = txtlocalPort.Text.Trim();
string protocol = cmbprotocol.Text.Trim();
bool udpEnabled = chkudpEnabled.Checked;
bool sniffingEnabled = chksniffingEnabled.Checked;
if (Utils.IsNullOrEmpty(localPort) || !Utils.IsNumberic(localPort))
@@ -207,8 +174,8 @@ namespace v2rayN.Forms
config.inbound[0].sniffingEnabled = sniffingEnabled;
//本地监听2
string localPort2 = txtlocalPort2.Text.TrimEx();
string protocol2 = cmbprotocol2.Text.TrimEx();
string localPort2 = txtlocalPort2.Text.Trim();
string protocol2 = cmbprotocol2.Text.Trim();
bool udpEnabled2 = chkudpEnabled2.Checked;
bool sniffingEnabled2 = chksniffingEnabled2.Checked;
if (chkAllowIn2.Checked)
@@ -248,7 +215,7 @@ namespace v2rayN.Forms
config.muxEnabled = muxEnabled;
//remoteDNS
config.remoteDNS = txtremoteDNS.Text.TrimEx();
config.remoteDNS = txtremoteDNS.Text.Trim();
return 0;
}
@@ -263,9 +230,9 @@ namespace v2rayN.Forms
string domainStrategy = cmbdomainStrategy.Text;
string routingMode = cmbroutingMode.SelectedIndex.ToString();
string useragent = txtUseragent.Text.TrimEx();
string userdirect = txtUserdirect.Text.TrimEx();
string userblock = txtUserblock.Text.TrimEx();
string useragent = txtUseragent.Text.Trim();
string userdirect = txtUserdirect.Text.Trim();
string userblock = txtUserblock.Text.Trim();
config.domainStrategy = domainStrategy;
config.routingMode = routingMode;
@@ -283,12 +250,12 @@ namespace v2rayN.Forms
/// <returns></returns>
private int SaveKCP()
{
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();
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();
bool congestion = chkKcpcongestion.Checked;
if (Utils.IsNullOrEmpty(mtu) || !Utils.IsNumberic(mtu)
@@ -322,30 +289,10 @@ namespace v2rayN.Forms
Utils.SetAutoRun(chkAutoRun.Checked);
//自定义GFWList
config.urlGFWList = txturlGFWList.Text.TrimEx();
config.urlGFWList = txturlGFWList.Text.Trim();
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;
}
@@ -411,10 +358,4 @@ 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
@@ -288,13 +288,4 @@
<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>
+1 -1
View File
@@ -26,7 +26,7 @@ namespace v2rayN.Forms
if (Index >= 0)
{
string url = ConfigHandler.GetVmessQRCode(config, Index);
if (Utils.IsNullOrEmpty(url))
if (string.IsNullOrEmpty(url))
{
picQRCode.Image = null;
txtUrl.Text = string.Empty;
+2 -2
View File
@@ -35,8 +35,8 @@ namespace v2rayN.Forms
{
if (subItem != null)
{
subItem.remarks = txtRemarks.Text.TrimEx();
subItem.url = txtUrl.Text.TrimEx();
subItem.remarks = txtRemarks.Text.Trim();
subItem.url = txtUrl.Text.Trim();
subItem.enabled = chkEnabled.Checked;
}
}
-26
View File
@@ -18,7 +18,6 @@ namespace v2rayN
/// SpeedTestUrl
/// </summary>
public const string SpeedTestUrl = @"http://speedtest-sfo2.digitalocean.com/10mb.test";
public const string SpeedPingTestUrl = @"https://www.google.com/generate_204";
/// <summary>
/// CustomRoutingListUrl
@@ -96,11 +95,6 @@ namespace v2rayN
/// 阻止 tag值
/// </summary>
public const string blockTag = "block";
/// <summary>
///
/// </summary>
public const string StreamSecurity = "tls";
/// <summary>
/// vmess
@@ -147,21 +141,6 @@ 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
@@ -191,11 +170,6 @@ namespace v2rayN
/// </summary>
public static int pacPort { get; set; }
/// <summary>
///
/// </summary>
public static int statePort { get; set; }
#endregion
+13 -22
View File
@@ -40,15 +40,6 @@ namespace v2rayN.Handler
////默认监听端口
//config.pacPort = 8888;
// 默认缓存七天
config.CacheDays = 7;
// 默认不开启统计
config.enableStatistics = false;
// 默认中等刷新率
config.statisticsFreshRate = (int)Global.StatisticsFreshRate.medium;
}
//本地监听
@@ -161,14 +152,14 @@ namespace v2rayN.Handler
vmessItem.configVersion = 2;
vmessItem.configType = (int)EConfigType.Vmess;
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();
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();
if (index >= 0)
{
@@ -337,7 +328,7 @@ namespace v2rayN.Handler
{
VmessQRCode vmessQRCode = new VmessQRCode();
vmessQRCode.v = vmessItem.configVersion.ToString();
vmessQRCode.ps = vmessItem.remarks.TrimEx(); //备注也许很长 ;
vmessQRCode.ps = vmessItem.remarks.Trim(); //备注也许很长 ;
vmessQRCode.add = vmessItem.address;
vmessQRCode.port = vmessItem.port.ToString();
vmessQRCode.id = vmessItem.id;
@@ -575,9 +566,9 @@ namespace v2rayN.Handler
vmessItem.configVersion = 2;
vmessItem.configType = (int)EConfigType.Shadowsocks;
vmessItem.address = vmessItem.address.TrimEx();
vmessItem.id = vmessItem.id.TrimEx();
vmessItem.security = vmessItem.security.TrimEx();
vmessItem.address = vmessItem.address.Trim();
vmessItem.id = vmessItem.id.Trim();
vmessItem.security = vmessItem.security.Trim();
if (index >= 0)
{
@@ -616,7 +607,7 @@ namespace v2rayN.Handler
vmessItem.configVersion = 2;
vmessItem.configType = (int)EConfigType.Socks;
vmessItem.address = vmessItem.address.TrimEx();
vmessItem.address = vmessItem.address.Trim();
if (index >= 0)
{
-305
View File
@@ -1,305 +0,0 @@
using Grpc.Core;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Net;
using System.Net.Sockets;
using System.Threading;
using v2rayN.Mode;
namespace v2rayN.Handler
{
class SpeedtestHandler
{
private V2rayUpdateHandle v2rayUpdateHandle2;
private Config _config;
private V2rayHandler _v2rayHandler;
private List<int> _selecteds;
private Thread _workThread;
Action<int, string> _updateFunc;
private int testCounter = 0;
private int ItemIndex
{
get
{
return _selecteds[testCounter - 1];
}
}
public SpeedtestHandler(ref Config config, ref V2rayHandler v2rayHandler, List<int> selecteds, string actionType, Action<int, string> update)
{
_config = config;
_v2rayHandler = v2rayHandler;
_selecteds = selecteds;
_updateFunc = update;
if (actionType == "ping")
{
_workThread = new Thread(new ThreadStart(RunPing));
_workThread.Start();
}
if (actionType == "tcping")
{
_workThread = new Thread(new ThreadStart(RunTcping));
_workThread.Start();
}
else if (actionType == "realping")
{
_workThread = new Thread(new ThreadStart(RunRealPing));
_workThread.Start();
}
else if (actionType == "speedtest")
{
RunSpeedTest();
}
}
public void Close()
{
try
{
}
catch (Exception ex)
{
Utils.SaveLog(ex.Message, ex);
}
}
public void RunPing()
{
try
{
for (int k = 0; k < _selecteds.Count; k++)
{
int index = _selecteds[k];
if (_config.vmess[index].configType == (int)EConfigType.Custom)
{
continue;
}
try
{
long time = Utils.Ping(_config.vmess[index].address);
_updateFunc(index, string.Format("{0}ms", time));
}
catch (Exception ex)
{
Utils.SaveLog(ex.Message, ex);
}
}
Thread.Sleep(1);
}
catch (Exception ex)
{
Utils.SaveLog(ex.Message, ex);
}
}
public void RunTcping()
{
try
{
for (int k = 0; k < _selecteds.Count; k++)
{
int index = _selecteds[k];
if (_config.vmess[index].configType == (int)EConfigType.Custom)
{
continue;
}
try
{
var time = GetTcpingTime(_config.vmess[index].address, _config.vmess[index].port);
_updateFunc(index, string.Format("{0}ms", time));
}
catch (Exception ex)
{
Utils.SaveLog(ex.Message, ex);
}
}
Thread.Sleep(1);
}
catch (Exception ex)
{
Utils.SaveLog(ex.Message, ex);
}
}
public void RunRealPing()
{
try
{
for (int k = 0; k < _selecteds.Count; k++)
{
int index = _selecteds[k];
if (_config.vmess[index].configType == (int)EConfigType.Custom)
{
continue;
}
try
{
if (ConfigHandler.SetDefaultServer(ref _config, index) == 0)
{
_v2rayHandler.LoadV2ray(_config);
}
else
{
return;
}
Thread.Sleep(1000 * 5);
int responseTime = -1;
var status = GetRealPingTime(Global.SpeedPingTestUrl, out responseTime);
if (!Utils.IsNullOrEmpty(status))
{
_updateFunc(index, string.Format("{0}", status));
}
else
{
_updateFunc(index, string.Format("{0}ms", responseTime));
}
}
catch (Exception ex)
{
Utils.SaveLog(ex.Message, ex);
}
}
Thread.Sleep(1);
}
catch (Exception ex)
{
Utils.SaveLog(ex.Message, ex);
}
}
private void RunSpeedTest()
{
if (_config.vmess.Count <= 0)
{
return;
}
string url = Global.SpeedTestUrl;
testCounter = 0;
if (v2rayUpdateHandle2 == null)
{
v2rayUpdateHandle2 = new V2rayUpdateHandle();
v2rayUpdateHandle2.UpdateCompleted += (sender2, args) =>
{
if (args.Success)
{
_updateFunc(ItemIndex, args.Msg);
if (ServerSpeedTestSub(testCounter, url) != 0)
{
return;
}
}
else
{
_updateFunc(ItemIndex, args.Msg);
}
};
v2rayUpdateHandle2.Error += (sender2, args) =>
{
_updateFunc(ItemIndex, args.GetException().Message);
if (ServerSpeedTestSub(testCounter, url) != 0)
{
return;
}
};
}
if (ServerSpeedTestSub(testCounter, url) != 0)
{
return;
}
}
private int ServerSpeedTestSub(int index, string url)
{
if (index >= _selecteds.Count)
{
return -1;
}
if (ConfigHandler.SetDefaultServer(ref _config, _selecteds[index]) == 0)
{
_v2rayHandler.LoadV2ray(_config);
testCounter++;
v2rayUpdateHandle2.DownloadFileAsync(_config, url);
return 0;
}
else
{
return -1;
}
}
private int GetTcpingTime(string url, int port)
{
var responseTime = -1;
try
{
IPHostEntry ipHostInfo = System.Net.Dns.Resolve(url);
IPAddress ipAddress = ipHostInfo.AddressList[0];
var timer = new Stopwatch();
timer.Start();
Socket clientSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
clientSocket.Connect(new IPEndPoint(ipAddress, port));
timer.Stop();
responseTime = timer.Elapsed.Milliseconds;
clientSocket.Close();
}
catch (Exception ex)
{
Utils.SaveLog(ex.Message, ex);
}
return responseTime;
}
private string GetRealPingTime(string url, out int responseTime)
{
string msg = string.Empty;
responseTime = -1;
try
{
HttpWebRequest myHttpWebRequest = (HttpWebRequest)WebRequest.Create(url);
myHttpWebRequest.Timeout = 5000;
var timer = new Stopwatch();
timer.Start();
HttpWebResponse myHttpWebResponse = (HttpWebResponse)myHttpWebRequest.GetResponse();
if (myHttpWebResponse.StatusCode != HttpStatusCode.OK
&& myHttpWebResponse.StatusCode != HttpStatusCode.NoContent)
{
msg = myHttpWebResponse.StatusDescription;
}
timer.Stop();
responseTime = timer.Elapsed.Milliseconds;
myHttpWebResponse.Close();
}
catch (Exception ex)
{
Utils.SaveLog(ex.Message, ex);
msg = ex.Message;
}
return msg;
}
}
}
-446
View File
@@ -1,446 +0,0 @@
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;
}
}
}
}
+13 -88
View File
@@ -4,7 +4,6 @@ using System.IO;
using v2rayN.Mode;
using System.Net;
using System.Text;
using System.Linq;
namespace v2rayN.Handler
{
@@ -79,9 +78,6 @@ 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());
@@ -239,7 +235,7 @@ namespace v2rayN.Handler
for (int k = 0; k < userRule.Count; k++)
{
string url = userRule[k].TrimEx();
string url = userRule[k].Trim();
if (Utils.IsNullOrEmpty(url))
{
continue;
@@ -404,8 +400,8 @@ namespace v2rayN.Handler
serversItem.address = config.address();
serversItem.port = config.port();
if (!Utils.IsNullOrEmpty(config.security())
&& !Utils.IsNullOrEmpty(config.id()))
if (!string.IsNullOrEmpty(config.security())
&& !string.IsNullOrEmpty(config.id()))
{
var socksUsersItem = new SocksUsersItem();
socksUsersItem.user = config.security();
@@ -443,7 +439,7 @@ namespace v2rayN.Handler
var host = config.requestHost();
//if tls
if (config.streamSecurity() == Global.StreamSecurity)
if (config.streamSecurity() == "tls")
{
streamSettings.security = config.streamSecurity();
@@ -617,53 +613,6 @@ 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>
@@ -964,13 +913,6 @@ namespace v2rayN.Handler
}
}
//tls
if (outbound.streamSettings != null
&& outbound.streamSettings.security != null
&& outbound.streamSettings.security == Global.StreamSecurity)
{
vmessItem.streamSecurity = Global.StreamSecurity;
}
}
catch
{
@@ -1108,14 +1050,6 @@ 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
{
@@ -1139,7 +1073,7 @@ namespace v2rayN.Handler
try
{
//载入配置文件
string result = clipboardData.TrimEx();// Utils.GetClipboardData();
string result = clipboardData.Trim();// Utils.GetClipboardData();
if (Utils.IsNullOrEmpty(result))
{
msg = UIRes.I18N("FailedReadConfiguration");
@@ -1170,26 +1104,17 @@ namespace v2rayN.Handler
vmessItem.network = Global.DefaultNetwork;
vmessItem.headerType = Global.None;
vmessItem.configVersion = Utils.ToInt(vmessQRCode.v);
vmessItem.remarks = Utils.ToString(vmessQRCode.ps);
vmessItem.address = Utils.ToString(vmessQRCode.add);
vmessItem.remarks = vmessQRCode.ps;
vmessItem.address = vmessQRCode.add;
vmessItem.port = Utils.ToInt(vmessQRCode.port);
vmessItem.id = Utils.ToString(vmessQRCode.id);
vmessItem.id = vmessQRCode.id;
vmessItem.alterId = Utils.ToInt(vmessQRCode.aid);
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);
vmessItem.network = vmessQRCode.net;
vmessItem.headerType = vmessQRCode.type;
vmessItem.requestHost = vmessQRCode.host;
vmessItem.path = vmessQRCode.path;
vmessItem.streamSecurity = vmessQRCode.tls;
}
ConfigHandler.UpgradeServerVersion(ref vmessItem);
+4 -11
View File
@@ -7,7 +7,6 @@ using Newtonsoft.Json;
using v2rayN.Mode;
using v2rayN.Properties;
using v2rayN.HttpProxyHandler;
using System.Diagnostics;
namespace v2rayN.Handler
{
@@ -24,10 +23,7 @@ namespace v2rayN.Handler
public string DownloadFileName
{
get
{
return "v2ray-windows.zip";
}
get { return "v2ray-windows.zip"; }
}
public class ResultEventArgs : EventArgs
@@ -49,16 +45,15 @@ namespace v2rayN.Handler
private long totalBytesToReceive = 0;
private DateTime totalDatetime = new DateTime();
public void AbsoluteV2rayCore(Config config)
{
ServicePointManager.SecurityProtocol = (SecurityProtocolType)3072; //TLS 1.2
ServicePointManager.DefaultConnectionLimit = 256;
WebRequest request = WebRequest.Create(latestUrl);
request.BeginGetResponse(new AsyncCallback(OnResponseV2rayCore), request);
request.BeginGetResponse(new AsyncCallback(OnResponse), request);
}
private void OnResponseV2rayCore(IAsyncResult ar)
private void OnResponse(IAsyncResult ar)
{
try
{
@@ -133,7 +128,7 @@ namespace v2rayN.Handler
if (progressPercentage != e.ProgressPercentage && e.ProgressPercentage % 10 == 0)
{
progressPercentage = e.ProgressPercentage;
string msg = string.Format("...{0}%", e.ProgressPercentage);
string msg = string.Format("......{0}%", e.ProgressPercentage);
UpdateCompleted(this, new ResultEventArgs(false, msg));
}
}
@@ -215,7 +210,5 @@ namespace v2rayN.Handler
Error(this, new ErrorEventArgs(ex));
}
}
}
}
@@ -12,7 +12,7 @@ namespace v2rayN.HttpProxyHandler
{
private static string GetTimestamp(DateTime value)
{
return value.ToString("MMddHHmmssfff");
return value.ToString("yyyyMMddHHmmssfff");
}
public static void ReSetPACProxy(Config config)
@@ -8,9 +8,9 @@ namespace v2rayN.HttpProxyHandler
public class HttpWebServer
{
private HttpListener _listener;
private Func<string, string> _responderMethod;
private Func<HttpListenerRequest, string> _responderMethod;
public HttpWebServer(string[] prefixes, Func<string, string> method)
public HttpWebServer(string[] prefixes, Func<HttpListenerRequest, string> method)
{
try
{
@@ -39,11 +39,10 @@ namespace v2rayN.HttpProxyHandler
catch (Exception ex)
{
Utils.SaveLog(ex.Message, ex);
throw;
}
}
public HttpWebServer(Func<string, string> method, params string[] prefixes)
public HttpWebServer(Func<HttpListenerRequest, string> method, params string[] prefixes)
: this(prefixes, method) { }
public void Run()
@@ -60,8 +59,7 @@ namespace v2rayN.HttpProxyHandler
var ctx = c as HttpListenerContext;
try
{
string address = ctx.Request.LocalEndPoint.Address.ToString();
string rstr = _responderMethod(address);
string rstr = _responderMethod(ctx.Request);
byte[] buf = Encoding.UTF8.GetBytes(rstr);
ctx.Response.StatusCode = 200;
ctx.Response.ContentType = "application/x-ns-proxy-autoconfig";
@@ -1,5 +1,4 @@
using System;
using System.Collections;
using System.IO;
using System.Net;
using System.Net.Sockets;
@@ -10,20 +9,84 @@ namespace v2rayN.HttpProxyHandler
{
public class HttpWebServerB
{
private TcpListener listener;
private int port;
private Func<string, string> _responderMethod;
private TcpListener listener;
public HttpWebServerB(int port, Func<string, string> method)
private Func<TcpClient, string> _responderMethod;
public HttpWebServerB(int port, Func<TcpClient, string> method)
{
this.port = port;
this._responderMethod = method;
try
{
this.port = port;
this._responderMethod = method;
Thread thread = new Thread(StartListen);
thread.IsBackground = true;
thread.Start();
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)
@@ -32,93 +95,38 @@ namespace v2rayN.HttpProxyHandler
listener = null;
}
}
private void StartListen()
//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)
{
listener = new TcpListener(IPAddress.Any, port);
listener.Start();
Utils.SaveLog("WebserverB running...");
StringBuilder sb = new StringBuilder();
string content_type = "application/x-ns-proxy-autoconfig";
while (true)
{
TcpClient socket = listener.AcceptTcpClient();
Thread thread = new Thread(new ParameterizedThreadStart(ProcessThread));
thread.Start(socket);
Thread.Sleep(1);
}
}
private void ProcessThread(object obj)
{
try
{
var socket = obj as TcpClient;
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();
var inputStream = new BufferedStream(socket.GetStream());
var outputStream = new StreamWriter(new BufferedStream(socket.GetStream()));
if (inputStream.CanRead)
{
var data = ReadStream(inputStream);
if (data.Contains("/pac/"))
{
if (_responderMethod != null)
{
var address = ((IPEndPoint)socket.Client.LocalEndPoint).Address.ToString();
string pac = _responderMethod(address);
if (inputStream.CanWrite)
{
WriteStream(outputStream, pac);
}
}
}
}
outputStream.BaseStream.Flush();
inputStream = null;
outputStream = null;
socket.Close();
}
catch (Exception ex)
{
Utils.SaveLog(ex.Message, ex);
}
return sb.ToString();
}
private string ReadStream(Stream inputStream)
{
int nextchar;
string data = "";
while (true)
{
nextchar = inputStream.ReadByte();
if (nextchar == '\n')
{
break;
}
if (nextchar == '\r')
{
continue;
}
if (nextchar == -1)
{
Thread.Sleep(1);
continue;
};
data += Convert.ToChar(nextchar);
}
return data;
}
private void WriteStream(StreamWriter outputStream, string pac)
{
var content_type = "application/x-ns-proxy-autoconfig";
outputStream.WriteLine("HTTP/1.1 200 OK");
outputStream.WriteLine(String.Format("Content-Type:{0}", content_type));
outputStream.WriteLine("Connection: close");
outputStream.WriteLine("");
outputStream.WriteLine(pac);
outputStream.Flush();
}
}
}
@@ -75,7 +75,7 @@ namespace v2rayN.HttpProxyHandler
public static List<string> ParseResult(string response)
{
byte[] bytes = Convert.FromBase64String(response);
string content = Encoding.UTF8.GetString(bytes);
string content = Encoding.ASCII.GetString(bytes);
List<string> valid_lines = new List<string>();
using (var sr = new StringReader(content))
{
@@ -1,6 +1,8 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Net;
using System.Net.Sockets;
using System.Text;
using v2rayN.Mode;
using v2rayN.Properties;
@@ -17,36 +19,19 @@ namespace v2rayN.HttpProxyHandler
private static HttpWebServer server;
private static HttpWebServerB serverB;
public static bool IsRunning
{
get
{
return (pacPort > 0);
}
}
public static void Init(Config config)
{
//if (InitServer("*"))
//{
// pacPort = Global.pacPort;
//}
if (InitServer("127.0.0.1"))
if (Utils.IsAdministrator())
{
pacPort = Global.pacPort;
}
else if (InitServerB("127.0.0.1"))
{
pacPort = Global.pacPort;
InitServer("127.0.0.1");
}
else
{
Utils.SaveLog("Webserver init failed ");
pacPort = 0;
InitServerB("127.0.0.1");
}
}
private static bool InitServer(string address)
public static void InitServer(string address)
{
try
{
@@ -60,13 +45,13 @@ namespace v2rayN.HttpProxyHandler
if (server == null)
{
string prefixes = string.Format("http://{0}:{1}/pac/", address, Global.pacPort);
string prefixes = string.Format("http://{0}:{1}/pac/", "+", Global.pacPort);
Utils.SaveLog("Webserver prefixes " + prefixes);
server = new HttpWebServer(SendResponse, prefixes);
server.Run();
HttpWebServer ws = new HttpWebServer(SendResponse, prefixes);
ws.Run();
//pacPort = Global.pacPort;
pacPort = Global.pacPort;
}
}
Utils.SaveLog("Webserver at " + address);
@@ -74,12 +59,11 @@ namespace v2rayN.HttpProxyHandler
catch (Exception ex)
{
Utils.SaveLog("Webserver InitServer " + ex.Message);
return false;
}
return true;
}
public static bool InitServerB(string address)
public static void InitServerB(string address)
{
try
{
@@ -94,23 +78,22 @@ namespace v2rayN.HttpProxyHandler
if (serverB == null)
{
serverB = new HttpWebServerB(Global.pacPort, SendResponse);
//pacPort = Global.pacPort;
pacPort = Global.pacPort;
}
}
Utils.SaveLog("WebserverB at " + address);
Utils.SaveLog("Webserver at " + address);
}
catch (Exception ex)
{
Utils.SaveLog("WebserverB InitServer " + ex.Message);
return false;
Utils.SaveLog("Webserver InitServer " + ex.Message);
}
return true;
}
public static string SendResponse(string address)
public static string SendResponse(HttpListenerRequest request)
{
try
{
string address = request.LocalEndPoint.Address.ToString();
var pac = GetPacList(address);
return pac;
}
@@ -120,6 +103,27 @@ 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()
{
@@ -155,7 +159,6 @@ namespace v2rayN.HttpProxyHandler
//}
}
private static string GetPacList(string address)
{
var port = Global.sysAgentPort;
@@ -179,10 +182,8 @@ namespace v2rayN.HttpProxyHandler
return pac;
}
catch
{
}
{ }
return "No pac content";
}
}
}
@@ -19,7 +19,7 @@ namespace v2rayN.HttpProxyHandler
{
InternetPerConnOptionList list = new InternetPerConnOptionList();
int optionCount = Utils.IsNullOrEmpty(strProxy) ? 1 : (Utils.IsNullOrEmpty(exceptions) ? 2 : 3);
int optionCount = string.IsNullOrEmpty(strProxy) ? 1 : (string.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.
+8 -34
View File
@@ -91,32 +91,6 @@ 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>
@@ -138,7 +112,7 @@ namespace v2rayN.Mode
{
return string.Empty;
}
return vmess[index].address.TrimEx();
return vmess[index].address.Trim();
}
public int port()
@@ -156,7 +130,7 @@ namespace v2rayN.Mode
{
return string.Empty;
}
return vmess[index].id.TrimEx();
return vmess[index].id.Trim();
}
public int alterId()
@@ -174,7 +148,7 @@ namespace v2rayN.Mode
{
return string.Empty;
}
return vmess[index].security.TrimEx();
return vmess[index].security.Trim();
}
public string remarks()
@@ -183,7 +157,7 @@ namespace v2rayN.Mode
{
return string.Empty;
}
return vmess[index].remarks.TrimEx();
return vmess[index].remarks.Trim();
}
public string network()
{
@@ -191,7 +165,7 @@ namespace v2rayN.Mode
{
return Global.DefaultNetwork;
}
return vmess[index].network.TrimEx();
return vmess[index].network.Trim();
}
public string headerType()
{
@@ -199,7 +173,7 @@ namespace v2rayN.Mode
{
return Global.None;
}
return vmess[index].headerType.Replace(" ", "").TrimEx();
return vmess[index].headerType.Replace(" ", "").Trim();
}
public string requestHost()
{
@@ -207,7 +181,7 @@ namespace v2rayN.Mode
{
return string.Empty;
}
return vmess[index].requestHost.Replace(" ", "").TrimEx();
return vmess[index].requestHost.Replace(" ", "").Trim();
}
public string path()
{
@@ -215,7 +189,7 @@ namespace v2rayN.Mode
{
return string.Empty;
}
return vmess[index].path.Replace(" ", "").TrimEx();
return vmess[index].path.Replace(" ", "").Trim();
}
public string streamSecurity()
{
-35
View File
@@ -1,35 +0,0 @@
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;
}
}
}
-38
View File
@@ -21,17 +21,6 @@ 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>
@@ -42,25 +31,6 @@ 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>
@@ -79,7 +49,6 @@ namespace v2rayN.Mode
public class Inbounds
{
public string tag { get; set; }
/// <summary>
///
/// </summary>
@@ -123,11 +92,6 @@ namespace v2rayN.Mode
/// </summary>
public string ip { get; set; }
/// <summary>
/// api 使用
/// </summary>
public string address { get; set; }
/// <summary>
///
/// </summary>
@@ -309,8 +273,6 @@ namespace v2rayN.Mode
///
/// </summary>
public string port { get; set; }
public string inboundTag { get; set; }
/// <summary>
///
/// </summary>
+1 -1
View File
@@ -49,5 +49,5 @@ namespace v2rayN.Mode
/// 底层传输安全
/// </summary>
public string tls { get; set; } = string.Empty;
}
}
}
+2 -3
View File
@@ -28,7 +28,6 @@ namespace v2rayN
AppDomain.CurrentDomain.AssemblyResolve += CurrentDomain_AssemblyResolve;
Process instance = RunningInstance();
if (instance == null)
{
@@ -44,7 +43,7 @@ namespace v2rayN
}
else
{
UI.Show($"v2rayN is already running(v2rayN已经运行)");
UI.Show("v2rayN is already running(v2rayN已经运行)");
}
}
@@ -52,7 +51,7 @@ namespace v2rayN
{
try
{
string resourceName = "v2rayN.LIB." + new AssemblyName(args.Name).Name + ".dll";
string resourceName = "v2rayN." + new AssemblyName(args.Name).Name + ".dll";
using (var stream = Assembly.GetExecutingAssembly().GetManifestResourceStream(resourceName))
{
if (stream == null)
+1 -1
View File
@@ -33,4 +33,4 @@ using System.Runtime.InteropServices;
// 方法是按如下所示使用“*”:
//[assembly: AssemblyVersion("1.0.*")]
//[assembly: AssemblyVersion("1.0.0")]
[assembly: AssemblyFileVersion("2.43")]
[assembly: AssemblyFileVersion("2.35")]
+1 -11
View File
@@ -19,7 +19,7 @@ namespace v2rayN.Properties {
// 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
// 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen
// (以 /str 作为命令选项),或重新生成 VS 项目。
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.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 Resources {
@@ -120,16 +120,6 @@ namespace v2rayN.Properties {
}
}
/// <summary>
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
/// </summary>
internal static System.Drawing.Bitmap notify {
get {
object obj = ResourceManager.GetObject("notify", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
/// </summary>
-3
View File
@@ -136,9 +136,6 @@
<data name="minimize" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\minimize.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="notify" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\notify.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="option" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\option.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
-53
View File
@@ -1,53 +0,0 @@
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 {}
Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.
-1
View File
@@ -4,5 +4,4 @@ logfile v2ray_privoxy.log
show-on-task-bar 0
activity-animation 0
forward-socks5 / 127.0.0.1:__SOCKS_PORT__ .
max-client-connections 2048
hide-console
+2 -83
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", "15.0.0.0")]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.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,15 +105,6 @@ namespace v2rayN.Resx {
}
}
/// <summary>
/// 查找类似 DOWN 的本地化字符串。
/// </summary>
internal static string downloadSpeed {
get {
return ResourceManager.GetString("downloadSpeed", resourceCulture);
}
}
/// <summary>
/// 查找类似 Whether to download? {0} 的本地化字符串。
/// </summary>
@@ -330,42 +321,6 @@ 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>
@@ -375,15 +330,6 @@ namespace v2rayN.Resx {
}
}
/// <summary>
/// 查找类似 MediumFresh 的本地化字符串。
/// </summary>
internal static string MediumFresh {
get {
return ResourceManager.GetString("MediumFresh", resourceCulture);
}
}
/// <summary>
/// 查找类似 Clear original subscription content 的本地化字符串。
/// </summary>
@@ -636,15 +582,6 @@ 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>
@@ -672,15 +609,6 @@ 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>
@@ -690,15 +618,6 @@ 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>
-27
View File
@@ -319,31 +319,4 @@
<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>
-27
View File
@@ -319,31 +319,4 @@
<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>
+17 -31
View File
@@ -1,33 +1,25 @@
{
"log": {
"access": "",
"error": "",
"loglevel": "error"
},
{
"log": {
"access": "Vaccess.log",
"error": "Verror.log",
"loglevel": "warning"
},
"inbounds": [
{
"tag": "proxy",
"port": 10808,
"protocol": "socks",
"listen": "127.0.0.1",
"settings": {
"auth": "noauth",
"udp": true
},
"sniffing": {
"enabled": true,
"destOverride": [
"http",
"tls"
]
}
"inbounds": [{
"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",
@@ -74,12 +66,6 @@
],
"routing": {
"domainStrategy": "IPIfNonMatch",
"rules": [
{
"inboundTag": "api",
"outboundTag": "api",
"type": "field"
}
]
"rules": []
}
}
-5
View File
@@ -43,10 +43,5 @@ namespace v2rayN
yield return line;
}
}
public static string TrimEx(this string value)
{
return value == null ? string.Empty : value.Trim();
}
}
}
+3 -95
View File
@@ -212,7 +212,7 @@ namespace v2rayN
{
try
{
plainText = plainText.TrimEx()
plainText = plainText.Trim()
.Replace("\n", "")
.Replace("\r\n", "")
.Replace("\r", "")
@@ -250,89 +250,6 @@ 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
@@ -387,7 +304,7 @@ namespace v2rayN
}
//清除要验证字符串中的空格
//ip = ip.TrimEx();
//ip = ip.Trim();
//可能是CIDR
if (ip.IndexOf(@"/") > 0)
{
@@ -423,7 +340,7 @@ namespace v2rayN
}
//清除要验证字符串中的空格
//domain = domain.TrimEx();
//domain = domain.Trim();
//模式字符串
string pattern = @"^(?=^.{3,255}$)[a-zA-Z0-9][-a-zA-Z0-9]{0,62}(\.[a-zA-Z0-9][-a-zA-Z0-9]{0,62})+$";
@@ -442,15 +359,6 @@ 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.
-4
View File
@@ -1,4 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Grpc.Tools" version="2.23.0" targetFramework="net46" developmentDependency="true" />
</packages>
+560
View File
@@ -0,0 +1,560 @@
// 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
+97
View File
@@ -0,0 +1,97 @@
// <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
+14 -74
View File
@@ -1,6 +1,5 @@
<?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>
@@ -75,32 +74,11 @@
<PropertyGroup />
<PropertyGroup />
<ItemGroup>
<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>
<Reference Include="Newtonsoft.Json">
<HintPath>.\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" />
@@ -109,27 +87,15 @@
<Reference Include="System.Drawing" />
<Reference Include="System.IO.Compression" />
<Reference Include="System.IO.Compression.FileSystem" />
<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="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>
<Reference Include="zxing">
<HintPath>.\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>
<Reference Include="zxing.presentation">
<HintPath>.\zxing.presentation.dll</HintPath>
<Private>False</Private>
</Reference>
</ItemGroup>
@@ -140,9 +106,6 @@
<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>
@@ -179,8 +142,6 @@
<Compile Include="Forms\SubSettingControl.Designer.cs">
<DependentUpon>SubSettingControl.cs</DependentUpon>
</Compile>
<Compile Include="Handler\SpeedtestHandler.cs" />
<Compile Include="Handler\StatisticsHandler.cs" />
<Compile Include="Handler\V2rayUpdateHandle.cs" />
<Compile Include="HttpProxyHandler\HttpWebServer.cs" />
<Compile Include="HttpProxyHandler\HttpWebServerB.cs" />
@@ -195,7 +156,6 @@
<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">
@@ -330,7 +290,6 @@
<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>
@@ -340,7 +299,6 @@
<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" />
@@ -362,6 +320,9 @@
<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" />
@@ -411,40 +372,19 @@
<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" />
<None Include="Resources\notify.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">
-5
View File
@@ -14,9 +14,4 @@
<PropertyGroup>
<EnableSecurityDebugging>false</EnableSecurityDebugging>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'">
<StartAction>Project</StartAction>
<StartArguments>
</StartArguments>
</PropertyGroup>
</Project>