Compare commits

...

12 Commits
5.6 ... 5.9

Author SHA1 Message Date
2dust
606da79372 Update AssemblyInfo.cs 2022-04-01 18:10:48 +08:00
2dust
0801c3db64 Refactor stat update 2022-04-01 18:09:58 +08:00
2dust
35deb0c915 Merge pull request #2148 from zhaogarvie/master
保存自定义路由信息时先排序后输出
2022-04-01 18:07:25 +08:00
uniceguy
fd4d712688 保存自定义路由信息时先排序后输出 2022-04-01 13:21:22 +08:00
2dust
354fc618b0 fix encode issue 2022-03-31 20:19:15 +08:00
2dust
82b6ee5ad2 Refactor ResUI 2022-03-31 19:53:58 +08:00
2dust
645e6c4ec0 Update ConfigHandler.cs 2022-03-28 19:21:31 +08:00
2dust
cdc83bc9d7 Update AssemblyInfo.cs 2022-03-28 19:09:27 +08:00
2dust
70feacd276 Add hysteria support 2022-03-28 19:08:54 +08:00
2dust
ece4572058 Refactor and improve 2022-03-28 18:54:05 +08:00
2dust
4d16a5e801 Update AssemblyInfo.cs 2022-03-24 19:09:15 +08:00
2dust
1493a8b03f add drag to sort 2022-03-24 19:07:45 +08:00
30 changed files with 497 additions and 309 deletions

View File

@@ -1,10 +1,13 @@
using System.Drawing; using System;
using System.Drawing;
using System.Windows.Forms; using System.Windows.Forms;
namespace v2rayN.Base namespace v2rayN.Base
{ {
class ListViewFlickerFree : ListView class ListViewFlickerFree : ListView
{ {
Action<int, int> _updateFunc;
public ListViewFlickerFree() public ListViewFlickerFree()
{ {
SetStyle(ControlStyles.OptimizedDoubleBuffer SetStyle(ControlStyles.OptimizedDoubleBuffer
@@ -13,40 +16,82 @@ namespace v2rayN.Base
UpdateStyles(); UpdateStyles();
} }
public void RegisterDragEvent(Action<int, int> _update)
public void AutoResizeColumns()
{ {
try _updateFunc = _update;
{ this.AllowDrop = true;
this.SuspendLayout();
Graphics graphics = this.CreateGraphics();
// 原生 ColumnHeaderAutoResizeStyle.ColumnContent 将忽略列头宽度 this.ItemDrag += new ItemDragEventHandler(this.lv_ItemDrag);
this.AutoResizeColumns(ColumnHeaderAutoResizeStyle.HeaderSize); this.DragDrop += new DragEventHandler(this.lv_DragDrop);
this.DragEnter += new DragEventHandler(this.lv_DragEnter);
for (int i = 0; i < this.Columns.Count; i++) this.DragOver += new DragEventHandler(this.lv_DragOver);
{ this.DragLeave += new EventHandler(this.lv_DragLeave);
ColumnHeader c = this.Columns[i];
int cWidth = c.Width;
string MaxStr = "";
Font font = this.Items[0].SubItems[0].Font;
foreach (ListViewItem item in this.Items)
{
// 整行视作相同字形,不单独计算每个单元格
font = item.SubItems[i].Font;
string str = item.SubItems[i].Text;
if (str.Length > MaxStr.Length) // 未考虑非等宽问题
MaxStr = str;
}
int strWidth = (int)graphics.MeasureString(MaxStr, font).Width;
c.Width = System.Math.Max(cWidth, strWidth);
}
this.ResumeLayout();
}
catch { }
} }
private void lv_DragDrop(object sender, DragEventArgs e)
{
int targetIndex = this.InsertionMark.Index;
if (targetIndex == -1)
{
return;
}
if (this.InsertionMark.AppearsAfterItem)
{
targetIndex++;
}
if (this.SelectedIndices.Count <= 0)
{
return;
}
_updateFunc(this.SelectedIndices[0], targetIndex);
//ListViewItem draggedItem = (ListViewItem)e.Data.GetData(typeof(ListViewItem));
//this.BeginUpdate();
//this.Items.Insert(targetIndex, (ListViewItem)draggedItem.Clone());
//this.Items.Remove(draggedItem);
//this.EndUpdate();
}
private void lv_DragEnter(object sender, DragEventArgs e)
{
e.Effect = e.AllowedEffect;
}
private void lv_DragLeave(object sender, EventArgs e)
{
this.InsertionMark.Index = -1;
}
private void lv_DragOver(object sender, DragEventArgs e)
{
Point targetPoint = this.PointToClient(new Point(e.X, e.Y));
int targetIndex = this.InsertionMark.NearestIndex(targetPoint);
if (targetIndex > -1)
{
Rectangle itemBounds = this.GetItemRect(targetIndex);
this.EnsureVisible(targetIndex);
if (targetPoint.Y > itemBounds.Top + (itemBounds.Height / 2))
{
this.InsertionMark.AppearsAfterItem = true;
}
else
{
this.InsertionMark.AppearsAfterItem = false;
}
}
this.InsertionMark.Index = targetIndex;
}
private void lv_ItemDrag(object sender, ItemDragEventArgs e)
{
this.DoDragDrop(e.Item, DragDropEffects.Move);
this.InsertionMark.Index = -1;
}
} }
} }

View File

@@ -4,6 +4,7 @@ using System.IO;
using System.Windows.Forms; using System.Windows.Forms;
using v2rayN.Handler; using v2rayN.Handler;
using v2rayN.Mode; using v2rayN.Mode;
using v2rayN.Resx;
namespace v2rayN.Forms namespace v2rayN.Forms
{ {
@@ -19,6 +20,7 @@ namespace v2rayN.Forms
{ {
cmbCoreType.Items.AddRange(Global.coreTypes.ToArray()); cmbCoreType.Items.AddRange(Global.coreTypes.ToArray());
cmbCoreType.Items.Add("clash"); cmbCoreType.Items.Add("clash");
cmbCoreType.Items.Add("hysteria");
cmbCoreType.Items.Add(string.Empty); cmbCoreType.Items.Add(string.Empty);
txtAddress.ReadOnly = true; txtAddress.ReadOnly = true;
@@ -66,12 +68,12 @@ namespace v2rayN.Forms
string remarks = txtRemarks.Text; string remarks = txtRemarks.Text;
if (Utils.IsNullOrEmpty(remarks)) if (Utils.IsNullOrEmpty(remarks))
{ {
UI.Show(UIRes.I18N("PleaseFillRemarks")); UI.Show(ResUI.PleaseFillRemarks);
return; return;
} }
if (Utils.IsNullOrEmpty(txtAddress.Text)) if (Utils.IsNullOrEmpty(txtAddress.Text))
{ {
UI.Show(UIRes.I18N("FillServerAddressCustom")); UI.Show(ResUI.FillServerAddressCustom);
return; return;
} }
vmessItem.remarks = remarks; vmessItem.remarks = remarks;
@@ -90,7 +92,7 @@ namespace v2rayN.Forms
} }
else else
{ {
UI.ShowWarning(UIRes.I18N("OperationFailed")); UI.ShowWarning(ResUI.OperationFailed);
} }
} }
@@ -108,7 +110,7 @@ namespace v2rayN.Forms
private void btnBrowse_Click(object sender, EventArgs e) private void btnBrowse_Click(object sender, EventArgs e)
{ {
UI.Show(UIRes.I18N("CustomServerTips")); UI.Show(ResUI.CustomServerTips);
OpenFileDialog fileDialog = new OpenFileDialog OpenFileDialog fileDialog = new OpenFileDialog
{ {
@@ -131,11 +133,11 @@ namespace v2rayN.Forms
if (ConfigHandler.AddCustomServer(ref config, vmessItem, false) == 0) if (ConfigHandler.AddCustomServer(ref config, vmessItem, false) == 0)
{ {
BindingServer(); BindingServer();
UI.Show(UIRes.I18N("SuccessfullyImportedCustomServer")); UI.Show(ResUI.SuccessfullyImportedCustomServer);
} }
else else
{ {
UI.ShowWarning(UIRes.I18N("FailedImportedCustomServer")); UI.ShowWarning(ResUI.FailedImportedCustomServer);
} }
} }
@@ -144,7 +146,7 @@ namespace v2rayN.Forms
var address = txtAddress.Text; var address = txtAddress.Text;
if (Utils.IsNullOrEmpty(address)) if (Utils.IsNullOrEmpty(address))
{ {
UI.Show(UIRes.I18N("FillServerAddressCustom")); UI.Show(ResUI.FillServerAddressCustom);
return; return;
} }

View File

@@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Windows.Forms; using System.Windows.Forms;
using v2rayN.Handler; using v2rayN.Handler;
using v2rayN.Mode; using v2rayN.Mode;
using v2rayN.Resx;
namespace v2rayN.Forms namespace v2rayN.Forms
{ {
@@ -194,24 +195,24 @@ namespace v2rayN.Forms
if (Utils.IsNullOrEmpty(address)) if (Utils.IsNullOrEmpty(address))
{ {
UI.Show(UIRes.I18N("FillServerAddress")); UI.Show(ResUI.FillServerAddress);
return; return;
} }
if (Utils.IsNullOrEmpty(port) || !Utils.IsNumberic(port)) if (Utils.IsNullOrEmpty(port) || !Utils.IsNumberic(port))
{ {
UI.Show(UIRes.I18N("FillCorrectServerPort")); UI.Show(ResUI.FillCorrectServerPort);
return; return;
} }
if (eConfigType == EConfigType.Shadowsocks) if (eConfigType == EConfigType.Shadowsocks)
{ {
if (Utils.IsNullOrEmpty(id)) if (Utils.IsNullOrEmpty(id))
{ {
UI.Show(UIRes.I18N("FillPassword")); UI.Show(ResUI.FillPassword);
return; return;
} }
if (Utils.IsNullOrEmpty(security)) if (Utils.IsNullOrEmpty(security))
{ {
UI.Show(UIRes.I18N("PleaseSelectEncryption")); UI.Show(ResUI.PleaseSelectEncryption);
return; return;
} }
} }
@@ -219,7 +220,7 @@ namespace v2rayN.Forms
{ {
if (Utils.IsNullOrEmpty(id)) if (Utils.IsNullOrEmpty(id))
{ {
UI.Show(UIRes.I18N("FillUUID")); UI.Show(ResUI.FillUUID);
return; return;
} }
} }
@@ -270,7 +271,7 @@ namespace v2rayN.Forms
} }
else else
{ {
UI.ShowWarning(UIRes.I18N("OperationFailed")); UI.ShowWarning(ResUI.OperationFailed);
} }
} }

View File

@@ -4,6 +4,7 @@ using System.Windows.Forms;
using v2rayN.Base; using v2rayN.Base;
using v2rayN.Handler; using v2rayN.Handler;
using v2rayN.Mode; using v2rayN.Mode;
using v2rayN.Resx;
namespace v2rayN.Forms namespace v2rayN.Forms
{ {
@@ -104,7 +105,7 @@ namespace v2rayN.Forms
} }
else else
{ {
UI.ShowWarning(UIRes.I18N("OperationFailed")); UI.ShowWarning(ResUI.OperationFailed);
} }
} }

View File

@@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Windows.Forms; using System.Windows.Forms;
using v2rayN.Handler; using v2rayN.Handler;
using v2rayN.Mode; using v2rayN.Mode;
using v2rayN.Resx;
namespace v2rayN.Forms namespace v2rayN.Forms
{ {
@@ -73,7 +74,7 @@ namespace v2rayN.Forms
} }
else else
{ {
UI.ShowWarning(UIRes.I18N("OperationFailed")); UI.ShowWarning(ResUI.OperationFailed);
} }
} }

View File

@@ -12,6 +12,7 @@ using v2rayN.Handler;
using v2rayN.Mode; using v2rayN.Mode;
using v2rayN.Tool; using v2rayN.Tool;
using System.Linq; using System.Linq;
using v2rayN.Resx;
namespace v2rayN.Forms namespace v2rayN.Forms
{ {
@@ -149,12 +150,17 @@ namespace v2rayN.Forms
{ {
scMain.Panel2Collapsed = true; scMain.Panel2Collapsed = true;
if (!config.uiItem.mainLocation.IsEmpty)
{
this.Location = config.uiItem.mainLocation;
}
if (!config.uiItem.mainSize.IsEmpty) if (!config.uiItem.mainSize.IsEmpty)
{ {
this.Width = config.uiItem.mainSize.Width; this.Width = config.uiItem.mainSize.Width;
this.Height = config.uiItem.mainSize.Height; this.Height = config.uiItem.mainSize.Height;
} }
for (int k = 0; k < lvServers.Columns.Count; k++) for (int k = 0; k < lvServers.Columns.Count; k++)
{ {
var width = ConfigHandler.GetformMainLvColWidth(ref config, ((EServerColName)k).ToString(), lvServers.Columns[k].Width); var width = ConfigHandler.GetformMainLvColWidth(ref config, ((EServerColName)k).ToString(), lvServers.Columns[k].Width);
@@ -164,6 +170,8 @@ namespace v2rayN.Forms
private void StorageUI() private void StorageUI()
{ {
config.uiItem.mainLocation = this.Location;
config.uiItem.mainSize = new Size(this.Width, this.Height); config.uiItem.mainSize = new Size(this.Width, this.Height);
for (int k = 0; k < lvServers.Columns.Count; k++) for (int k = 0; k < lvServers.Columns.Count; k++)
@@ -225,28 +233,41 @@ namespace v2rayN.Forms
lvServers.Scrollable = true; lvServers.Scrollable = true;
lvServers.MultiSelect = true; lvServers.MultiSelect = true;
lvServers.HeaderStyle = ColumnHeaderStyle.Clickable; lvServers.HeaderStyle = ColumnHeaderStyle.Clickable;
lvServers.RegisterDragEvent(UpdateDragEventHandler);
lvServers.Columns.Add("", 30); lvServers.Columns.Add("", 30);
lvServers.Columns.Add(UIRes.I18N("LvServiceType"), 80); lvServers.Columns.Add(ResUI.LvServiceType, 80);
lvServers.Columns.Add(UIRes.I18N("LvAlias"), 100); lvServers.Columns.Add(ResUI.LvAlias, 100);
lvServers.Columns.Add(UIRes.I18N("LvAddress"), 120); lvServers.Columns.Add(ResUI.LvAddress, 120);
lvServers.Columns.Add(UIRes.I18N("LvPort"), 100); lvServers.Columns.Add(ResUI.LvPort, 100);
lvServers.Columns.Add(UIRes.I18N("LvEncryptionMethod"), 120); lvServers.Columns.Add(ResUI.LvEncryptionMethod, 120);
lvServers.Columns.Add(UIRes.I18N("LvTransportProtocol"), 120); lvServers.Columns.Add(ResUI.LvTransportProtocol, 120);
lvServers.Columns.Add(UIRes.I18N("LvTLS"), 100); lvServers.Columns.Add(ResUI.LvTLS, 100);
lvServers.Columns.Add(UIRes.I18N("LvSubscription"), 100); lvServers.Columns.Add(ResUI.LvSubscription, 100);
lvServers.Columns.Add(UIRes.I18N("LvTestResults"), 120, HorizontalAlignment.Right); lvServers.Columns.Add(ResUI.LvTestResults, 120, HorizontalAlignment.Right);
if (statistics != null && statistics.Enable) if (statistics != null && statistics.Enable)
{ {
lvServers.Columns.Add(UIRes.I18N("LvTodayDownloadDataAmount"), 70); lvServers.Columns.Add(ResUI.LvTodayDownloadDataAmount, 70);
lvServers.Columns.Add(UIRes.I18N("LvTodayUploadDataAmount"), 70); lvServers.Columns.Add(ResUI.LvTodayUploadDataAmount, 70);
lvServers.Columns.Add(UIRes.I18N("LvTotalDownloadDataAmount"), 70); lvServers.Columns.Add(ResUI.LvTotalDownloadDataAmount, 70);
lvServers.Columns.Add(UIRes.I18N("LvTotalUploadDataAmount"), 70); lvServers.Columns.Add(ResUI.LvTotalUploadDataAmount, 70);
} }
lvServers.EndUpdate(); lvServers.EndUpdate();
} }
private void UpdateDragEventHandler(int index, int targetIndex)
{
if (index < 0 || targetIndex < 0)
{
return;
}
if (ConfigHandler.MoveServer(ref config, ref lstVmess, index, EMove.Position, targetIndex) == 0)
{
RefreshServers();
}
}
/// <summary> /// <summary>
/// 刷新服务器列表 /// 刷新服务器列表
/// </summary> /// </summary>
@@ -472,7 +493,7 @@ namespace v2rayN.Forms
{ {
tabGroup.TabPages.Clear(); tabGroup.TabPages.Clear();
string title = $" {UIRes.I18N("AllGroupServers")} "; string title = $" {ResUI.AllGroupServers} ";
var tabPage = new TabPage(title); var tabPage = new TabPage(title);
tabPage.Name = ""; tabPage.Name = "";
tabGroup.TabPages.Add(tabPage); tabGroup.TabPages.Add(tabPage);
@@ -714,7 +735,7 @@ namespace v2rayN.Forms
{ {
return; return;
} }
if (UI.ShowYesNo(UIRes.I18N("RemoveServer")) == DialogResult.No) if (UI.ShowYesNo(ResUI.RemoveServer) == DialogResult.No)
{ {
return; return;
} }
@@ -731,7 +752,7 @@ namespace v2rayN.Forms
int newCount = ConfigHandler.DedupServerList(ref config, ref lstVmess); int newCount = ConfigHandler.DedupServerList(ref config, ref lstVmess);
RefreshServers(); RefreshServers();
_ = LoadV2ray(); _ = LoadV2ray();
UI.Show(string.Format(UIRes.I18N("RemoveDuplicateServerResult"), oldCount, newCount)); UI.Show(string.Format(ResUI.RemoveDuplicateServerResult, oldCount, newCount));
} }
private void menuCopyServer_Click(object sender, EventArgs e) private void menuCopyServer_Click(object sender, EventArgs e)
@@ -771,11 +792,11 @@ namespace v2rayN.Forms
{ {
//if (!config.sysAgentEnabled) //if (!config.sysAgentEnabled)
//{ //{
// UI.Show(UIRes.I18N("NeedHttpGlobalProxy")); // UI.Show(ResUI.NeedHttpGlobalProxy"));
// return; // return;
//} //}
//UI.Show(UIRes.I18N("SpeedServerTips")); //UI.Show(ResUI.SpeedServerTips"));
Speedtest(ESpeedActionType.Realping); Speedtest(ESpeedActionType.Realping);
} }
@@ -784,11 +805,11 @@ namespace v2rayN.Forms
{ {
//if (!config.sysAgentEnabled) //if (!config.sysAgentEnabled)
//{ //{
// UI.Show(UIRes.I18N("NeedHttpGlobalProxy")); // UI.Show(ResUI.NeedHttpGlobalProxy"));
// return; // return;
//} //}
//UI.Show(UIRes.I18N("SpeedServerTips")); //UI.Show(ResUI.SpeedServerTips"));
Speedtest(ESpeedActionType.Speedtest); Speedtest(ESpeedActionType.Speedtest);
} }
@@ -803,7 +824,7 @@ namespace v2rayN.Forms
{ {
SpeedtestHandler statistics = new SpeedtestHandler(ref config); SpeedtestHandler statistics = new SpeedtestHandler(ref config);
string result = statistics.RunAvailabilityCheck() + "ms"; string result = statistics.RunAvailabilityCheck() + "ms";
AppendText(false, string.Format(UIRes.I18N("TestMeOutput"), result)); AppendText(false, string.Format(ResUI.TestMeOutput, result));
} }
private void menuClearStatistic_Click(object sender, EventArgs e) private void menuClearStatistic_Click(object sender, EventArgs e)
@@ -844,8 +865,8 @@ namespace v2rayN.Forms
if (sb.Length > 0) if (sb.Length > 0)
{ {
Utils.SetClipboardData(sb.ToString()); Utils.SetClipboardData(sb.ToString());
AppendText(false, UIRes.I18N("BatchExportURLSuccessfully")); AppendText(false, ResUI.BatchExportURLSuccessfully);
//UI.Show(UIRes.I18N("BatchExportURLSuccessfully")); //UI.Show(ResUI.BatchExportURLSuccessfully"));
} }
} }
@@ -867,7 +888,7 @@ namespace v2rayN.Forms
if (sb.Length > 0) if (sb.Length > 0)
{ {
Utils.SetClipboardData(Utils.Base64Encode(sb.ToString())); Utils.SetClipboardData(Utils.Base64Encode(sb.ToString()));
UI.Show(UIRes.I18N("BatchExportSubscriptionSuccessfully")); UI.Show(ResUI.BatchExportSubscriptionSuccessfully);
} }
} }
@@ -937,7 +958,7 @@ namespace v2rayN.Forms
{ {
if (index < 0) if (index < 0)
{ {
UI.Show(UIRes.I18N("PleaseSelectServer")); UI.Show(ResUI.PleaseSelectServer);
return -1; return -1;
} }
if (ConfigHandler.SetDefaultServer(ref config, lstVmess[index]) == 0) if (ConfigHandler.SetDefaultServer(ref config, lstVmess[index]) == 0)
@@ -960,7 +981,7 @@ namespace v2rayN.Forms
{ {
if (lvServers.SelectedIndices.Count <= 0) if (lvServers.SelectedIndices.Count <= 0)
{ {
UI.Show(UIRes.I18N("PleaseSelectServer")); UI.Show(ResUI.PleaseSelectServer);
return index; return index;
} }
@@ -1007,7 +1028,7 @@ namespace v2rayN.Forms
if (ret > 0) if (ret > 0)
{ {
RefreshServers(); RefreshServers();
UI.Show(string.Format(UIRes.I18N("SuccessfullyImportedServerViaClipboard"), ret)); UI.Show(string.Format(ResUI.SuccessfullyImportedServerViaClipboard, ret));
} }
} }
@@ -1029,7 +1050,7 @@ namespace v2rayN.Forms
if (Utils.IsNullOrEmpty(result)) if (Utils.IsNullOrEmpty(result))
{ {
UI.ShowWarning(UIRes.I18N("NoValidQRcodeFound")); UI.ShowWarning(ResUI.NoValidQRcodeFound);
} }
else else
{ {
@@ -1037,7 +1058,7 @@ namespace v2rayN.Forms
if (ret > 0) if (ret > 0)
{ {
RefreshServers(); RefreshServers();
UI.Show(UIRes.I18N("SuccessfullyImportedServerViaScan")); UI.Show(ResUI.SuccessfullyImportedServerViaScan);
} }
} }
} }
@@ -1239,7 +1260,28 @@ namespace v2rayN.Forms
down /= (ulong)(config.statisticsFreshRate / 1000f); down /= (ulong)(config.statisticsFreshRate / 1000f);
toolSslServerSpeed.Text = string.Format("{0}/s↑ | {1}/s↓", Utils.HumanFy(up), Utils.HumanFy(down)); toolSslServerSpeed.Text = string.Format("{0}/s↑ | {1}/s↓", Utils.HumanFy(up), Utils.HumanFy(down));
List<string[]> datas = new List<string[]>(); foreach (var it in statistics)
{
int index = lstVmess.FindIndex(item => item.indexId == it.itemId);
if (index < 0)
{
continue;
}
lvServers.Invoke((MethodInvoker)delegate
{
lvServers.BeginUpdate();
lvServers.Items[index].SubItems["todayDown"].Text = Utils.HumanFy(it.todayDown);
lvServers.Items[index].SubItems["todayUp"].Text = Utils.HumanFy(it.todayUp);
lvServers.Items[index].SubItems["totalDown"].Text = Utils.HumanFy(it.totalDown);
lvServers.Items[index].SubItems["totalUp"].Text = Utils.HumanFy(it.totalUp);
lvServers.EndUpdate();
});
}
for (int i = 0; i < lstVmess.Count; i++) for (int i = 0; i < lstVmess.Count; i++)
{ {
int index = statistics.FindIndex(item_ => item_.itemId == lstVmess[i].indexId); int index = statistics.FindIndex(item_ => item_.itemId == lstVmess[i].indexId);
@@ -1303,7 +1345,7 @@ namespace v2rayN.Forms
int index = GetLvSelectedIndex(); int index = GetLvSelectedIndex();
if (index < 0) if (index < 0)
{ {
UI.Show(UIRes.I18N("PleaseSelectServer")); UI.Show(ResUI.PleaseSelectServer);
return; return;
} }
if (ConfigHandler.MoveServer(ref config, ref lstVmess, index, eMove) == 0) if (ConfigHandler.MoveServer(ref config, ref lstVmess, index, eMove) == 0)
@@ -1379,15 +1421,15 @@ namespace v2rayN.Forms
private void tsbCheckUpdateCore_Click(object sender, EventArgs e) private void tsbCheckUpdateCore_Click(object sender, EventArgs e)
{ {
CheckUpdateCore("v2fly"); CheckUpdateCore(ECoreType.v2fly);
} }
private void tsbCheckUpdateXrayCore_Click(object sender, EventArgs e) private void tsbCheckUpdateXrayCore_Click(object sender, EventArgs e)
{ {
CheckUpdateCore("xray"); CheckUpdateCore(ECoreType.Xray);
} }
private void CheckUpdateCore(string type) private void CheckUpdateCore(ECoreType type)
{ {
void _updateUI(bool success, string msg) void _updateUI(bool success, string msg)
{ {
@@ -1399,12 +1441,12 @@ namespace v2rayN.Forms
string fileName = Utils.GetPath(Utils.GetDownloadFileName(msg)); string fileName = Utils.GetPath(Utils.GetDownloadFileName(msg));
FileManager.ZipExtractToFile(fileName, config.ignoreGeoUpdateCore ? "geo" : ""); FileManager.ZipExtractToFile(fileName, config.ignoreGeoUpdateCore ? "geo" : "");
AppendText(false, UIRes.I18N("MsgUpdateV2rayCoreSuccessfullyMore")); AppendText(false, ResUI.MsgUpdateV2rayCoreSuccessfullyMore);
Global.reloadV2ray = true; Global.reloadV2ray = true;
_ = LoadV2ray(); _ = LoadV2ray();
AppendText(false, UIRes.I18N("MsgUpdateV2rayCoreSuccessfully")); AppendText(false, ResUI.MsgUpdateV2rayCoreSuccessfully);
} }
}; };
(new UpdateHandle()).CheckUpdateCore(type, config, _updateUI); (new UpdateHandle()).CheckUpdateCore(type, config, _updateUI);
@@ -1646,7 +1688,7 @@ namespace v2rayN.Forms
if (fm.ShowDialog() == DialogResult.OK) if (fm.ShowDialog() == DialogResult.OK)
{ {
MsgFilter = fm.MsgFilter; MsgFilter = fm.MsgFilter;
gbMsgTitle.Text = string.Format(UIRes.I18N("MsgInformationTitle"), MsgFilter); gbMsgTitle.Text = string.Format(ResUI.MsgInformationTitle, MsgFilter);
} }
} }
#endregion #endregion

View File

@@ -5,6 +5,7 @@ using System.Windows.Forms;
using v2rayN.Base; using v2rayN.Base;
using v2rayN.Handler; using v2rayN.Handler;
using v2rayN.Mode; using v2rayN.Mode;
using v2rayN.Resx;
namespace v2rayN.Forms namespace v2rayN.Forms
{ {
@@ -101,9 +102,9 @@ namespace v2rayN.Forms
ComboItem[] cbSource = new ComboItem[] ComboItem[] cbSource = new ComboItem[]
{ {
new ComboItem{ID = (int)Global.StatisticsFreshRate.quick, Text = UIRes.I18N("QuickFresh")}, new ComboItem{ID = (int)Global.StatisticsFreshRate.quick, Text = ResUI.QuickFresh},
new ComboItem{ID = (int)Global.StatisticsFreshRate.medium, Text = UIRes.I18N("MediumFresh")}, new ComboItem{ID = (int)Global.StatisticsFreshRate.medium, Text = ResUI.MediumFresh},
new ComboItem{ID = (int)Global.StatisticsFreshRate.slow, Text = UIRes.I18N("SlowFresh")}, new ComboItem{ID = (int)Global.StatisticsFreshRate.slow, Text = ResUI.SlowFresh},
}; };
cbFreshrate.DataSource = cbSource; cbFreshrate.DataSource = cbSource;
@@ -187,7 +188,7 @@ namespace v2rayN.Forms
} }
else else
{ {
UI.ShowWarning(UIRes.I18N("OperationFailed")); UI.ShowWarning(ResUI.OperationFailed);
} }
} }
@@ -211,12 +212,12 @@ namespace v2rayN.Forms
bool sniffingEnabled = chksniffingEnabled.Checked; bool sniffingEnabled = chksniffingEnabled.Checked;
if (Utils.IsNullOrEmpty(localPort) || !Utils.IsNumberic(localPort)) if (Utils.IsNullOrEmpty(localPort) || !Utils.IsNumberic(localPort))
{ {
UI.Show(UIRes.I18N("FillLocalListeningPort")); UI.Show(ResUI.FillLocalListeningPort);
return -1; return -1;
} }
if (Utils.IsNullOrEmpty(protocol)) if (Utils.IsNullOrEmpty(protocol))
{ {
UI.Show(UIRes.I18N("PleaseSelectProtocol")); UI.Show(ResUI.PleaseSelectProtocol);
return -1; return -1;
} }
@@ -229,7 +230,7 @@ namespace v2rayN.Forms
{ {
if (remoteDNS.Contains("{") || remoteDNS.Contains("}")) if (remoteDNS.Contains("{") || remoteDNS.Contains("}"))
{ {
UI.Show(UIRes.I18N("FillCorrectDNSText")); UI.Show(ResUI.FillCorrectDNSText);
return -1; return -1;
} }
} }
@@ -248,12 +249,12 @@ namespace v2rayN.Forms
{ {
if (Utils.IsNullOrEmpty(localPort2) || !Utils.IsNumberic(localPort2)) if (Utils.IsNullOrEmpty(localPort2) || !Utils.IsNumberic(localPort2))
{ {
UI.Show(UIRes.I18N("FillLocalListeningPort")); UI.Show(ResUI.FillLocalListeningPort);
return -1; return -1;
} }
if (Utils.IsNullOrEmpty(protocol2)) if (Utils.IsNullOrEmpty(protocol2))
{ {
UI.Show(UIRes.I18N("PleaseSelectProtocol")); UI.Show(ResUI.PleaseSelectProtocol);
return -1; return -1;
} }
if (config.inbound.Count < 2) if (config.inbound.Count < 2)
@@ -312,7 +313,7 @@ namespace v2rayN.Forms
|| Utils.IsNullOrEmpty(readBufferSize) || !Utils.IsNumberic(readBufferSize) || Utils.IsNullOrEmpty(readBufferSize) || !Utils.IsNumberic(readBufferSize)
|| Utils.IsNullOrEmpty(writeBufferSize) || !Utils.IsNumberic(writeBufferSize)) || Utils.IsNullOrEmpty(writeBufferSize) || !Utils.IsNumberic(writeBufferSize))
{ {
UI.Show(UIRes.I18N("FillKcpParameters")); UI.Show(ResUI.FillKcpParameters);
return -1; return -1;
} }
config.kcpItem.mtu = Utils.ToInt(mtu); config.kcpItem.mtu = Utils.ToInt(mtu);

View File

@@ -4,6 +4,7 @@ using System.Windows.Forms;
using v2rayN.Base; using v2rayN.Base;
using v2rayN.Handler; using v2rayN.Handler;
using v2rayN.Mode; using v2rayN.Mode;
using v2rayN.Resx;
namespace v2rayN.Forms namespace v2rayN.Forms
{ {
@@ -47,8 +48,8 @@ namespace v2rayN.Forms
} }
rulesItem.inboundTag = inboundTag; rulesItem.inboundTag = inboundTag;
rulesItem.outboundTag = cmbOutboundTag.Text; rulesItem.outboundTag = cmbOutboundTag.Text;
rulesItem.domain = Utils.String2List(txtDomain.Text); rulesItem.domain = Utils.String2ListSorted(txtDomain.Text);
rulesItem.ip = Utils.String2List(txtIP.Text); rulesItem.ip = Utils.String2ListSorted(txtIP.Text);
var protocol = new List<string>(); var protocol = new List<string>();
for (int i = 0; i < clbProtocol.Items.Count; i++) for (int i = 0; i < clbProtocol.Items.Count; i++)
@@ -125,7 +126,7 @@ namespace v2rayN.Forms
} }
if (!hasRule) if (!hasRule)
{ {
UI.ShowWarning(string.Format(UIRes.I18N("RoutingRuleDetailRequiredTips"), "Port/Protocol/Domain/IP")); UI.ShowWarning(string.Format(ResUI.RoutingRuleDetailRequiredTips, "Port/Protocol/Domain/IP"));
return; return;
} }
this.DialogResult = DialogResult.OK; this.DialogResult = DialogResult.OK;

View File

@@ -4,6 +4,7 @@ using System.Windows.Forms;
using v2rayN.Base; using v2rayN.Base;
using v2rayN.Handler; using v2rayN.Handler;
using v2rayN.Mode; using v2rayN.Mode;
using v2rayN.Resx;
namespace v2rayN.Forms namespace v2rayN.Forms
{ {
@@ -54,6 +55,7 @@ namespace v2rayN.Forms
lvRoutings.View = View.Details; lvRoutings.View = View.Details;
lvRoutings.MultiSelect = true; lvRoutings.MultiSelect = true;
lvRoutings.HeaderStyle = ColumnHeaderStyle.Clickable; lvRoutings.HeaderStyle = ColumnHeaderStyle.Clickable;
lvRoutings.RegisterDragEvent(UpdateDragEventHandler);
lvRoutings.Columns.Add("", 30); lvRoutings.Columns.Add("", 30);
lvRoutings.Columns.Add("outboundTag", 80); lvRoutings.Columns.Add("outboundTag", 80);
@@ -61,11 +63,22 @@ namespace v2rayN.Forms
lvRoutings.Columns.Add("protocol", 80); lvRoutings.Columns.Add("protocol", 80);
lvRoutings.Columns.Add("inboundTag", 80); lvRoutings.Columns.Add("inboundTag", 80);
lvRoutings.Columns.Add("domain", 160); lvRoutings.Columns.Add("domain", 160);
lvRoutings.Columns.Add("ip", 160); lvRoutings.Columns.Add("ip", 160);
lvRoutings.Columns.Add("enable", 60); lvRoutings.Columns.Add("enable", 60);
lvRoutings.EndUpdate(); lvRoutings.EndUpdate();
} }
private void UpdateDragEventHandler(int index, int targetIndex)
{
if (index < 0 || targetIndex < 0)
{
return;
}
if (ConfigHandler.MoveRoutingRule(ref routingItem, index, EMove.Position, targetIndex) == 0)
{
RefreshRoutingsView();
}
}
private void RefreshRoutingsView() private void RefreshRoutingsView()
{ {
@@ -102,7 +115,7 @@ namespace v2rayN.Forms
} }
else else
{ {
UI.ShowWarning(UIRes.I18N("OperationFailed")); UI.ShowWarning(ResUI.OperationFailed);
} }
} }
@@ -142,7 +155,7 @@ namespace v2rayN.Forms
{ {
if (lvRoutings.SelectedIndices.Count <= 0) if (lvRoutings.SelectedIndices.Count <= 0)
{ {
UI.Show(UIRes.I18N("PleaseSelectRules")); UI.Show(ResUI.PleaseSelectRules);
return index; return index;
} }
@@ -186,7 +199,7 @@ namespace v2rayN.Forms
int index = GetLvSelectedIndex(); int index = GetLvSelectedIndex();
if (index < 0) if (index < 0)
{ {
UI.Show(UIRes.I18N("PleaseSelectRules")); UI.Show(ResUI.PleaseSelectRules);
return; return;
} }
if (ConfigHandler.MoveRoutingRule(ref routingItem, index, eMove) == 0) if (ConfigHandler.MoveRoutingRule(ref routingItem, index, eMove) == 0)
@@ -220,7 +233,7 @@ namespace v2rayN.Forms
{ {
return; return;
} }
if (UI.ShowYesNo(UIRes.I18N("RemoveRules")) == DialogResult.No) if (UI.ShowYesNo(ResUI.RemoveRules) == DialogResult.No)
{ {
return; return;
} }
@@ -241,7 +254,7 @@ namespace v2rayN.Forms
if (lst.Count > 0) if (lst.Count > 0)
{ {
Utils.SetClipboardData(Utils.ToJson(lst)); Utils.SetClipboardData(Utils.ToJson(lst));
//UI.Show(UIRes.I18N("OperationSuccess")); //UI.Show(ResUI.OperationSuccess"));
} }
} }
@@ -311,7 +324,7 @@ namespace v2rayN.Forms
if (AddBatchRoutingRules(ref routingItem, result) == 0) if (AddBatchRoutingRules(ref routingItem, result) == 0)
{ {
RefreshRoutingsView(); RefreshRoutingsView();
UI.Show(UIRes.I18N("OperationSuccess")); UI.Show(ResUI.OperationSuccess);
} }
} }
@@ -321,7 +334,7 @@ namespace v2rayN.Forms
if (AddBatchRoutingRules(ref routingItem, clipboardData) == 0) if (AddBatchRoutingRules(ref routingItem, clipboardData) == 0)
{ {
RefreshRoutingsView(); RefreshRoutingsView();
UI.Show(UIRes.I18N("OperationSuccess")); UI.Show(ResUI.OperationSuccess);
} }
} }
private void menuImportRulesFromUrl_Click(object sender, EventArgs e) private void menuImportRulesFromUrl_Click(object sender, EventArgs e)
@@ -329,7 +342,7 @@ namespace v2rayN.Forms
var url = txtUrl.Text.Trim(); var url = txtUrl.Text.Trim();
if (Utils.IsNullOrEmpty(url)) if (Utils.IsNullOrEmpty(url))
{ {
UI.Show(UIRes.I18N("MsgNeedUrl")); UI.Show(ResUI.MsgNeedUrl);
return; return;
} }
DownloadHandle downloadHandle = new DownloadHandle(); DownloadHandle downloadHandle = new DownloadHandle();
@@ -337,13 +350,13 @@ namespace v2rayN.Forms
if (AddBatchRoutingRules(ref routingItem, clipboardData) == 0) if (AddBatchRoutingRules(ref routingItem, clipboardData) == 0)
{ {
RefreshRoutingsView(); RefreshRoutingsView();
UI.Show(UIRes.I18N("OperationSuccess")); UI.Show(ResUI.OperationSuccess);
} }
} }
private int AddBatchRoutingRules(ref RoutingItem routingItem, string clipboardData) private int AddBatchRoutingRules(ref RoutingItem routingItem, string clipboardData)
{ {
bool blReplace = false; bool blReplace = false;
if (UI.ShowYesNo(UIRes.I18N("AddBatchRoutingRulesYesNo")) == DialogResult.No) if (UI.ShowYesNo(ResUI.AddBatchRoutingRulesYesNo) == DialogResult.No)
{ {
blReplace = true; blReplace = true;
} }
@@ -353,6 +366,6 @@ namespace v2rayN.Forms
#endregion #endregion
} }
} }

View File

@@ -4,6 +4,7 @@ using System.Windows.Forms;
using v2rayN.Base; using v2rayN.Base;
using v2rayN.Handler; using v2rayN.Handler;
using v2rayN.Mode; using v2rayN.Mode;
using v2rayN.Resx;
namespace v2rayN.Forms namespace v2rayN.Forms
{ {
@@ -61,7 +62,7 @@ namespace v2rayN.Forms
} }
else else
{ {
UI.ShowWarning(UIRes.I18N("OperationFailed")); UI.ShowWarning(ResUI.OperationFailed);
} }
} }
@@ -144,10 +145,10 @@ namespace v2rayN.Forms
lvRoutings.HeaderStyle = ColumnHeaderStyle.Clickable; lvRoutings.HeaderStyle = ColumnHeaderStyle.Clickable;
lvRoutings.Columns.Add("", 30); lvRoutings.Columns.Add("", 30);
lvRoutings.Columns.Add(UIRes.I18N("LvAlias"), 200); lvRoutings.Columns.Add(ResUI.LvAlias, 200);
lvRoutings.Columns.Add(UIRes.I18N("LvCount"), 60); lvRoutings.Columns.Add(ResUI.LvCount, 60);
lvRoutings.Columns.Add(UIRes.I18N("LvUrl"), 240); lvRoutings.Columns.Add(ResUI.LvUrl, 240);
lvRoutings.Columns.Add(UIRes.I18N("LvCustomIcon"), 240); lvRoutings.Columns.Add(ResUI.LvCustomIcon, 240);
lvRoutings.EndUpdate(); lvRoutings.EndUpdate();
} }
@@ -211,7 +212,7 @@ namespace v2rayN.Forms
{ {
if (lvRoutings.SelectedIndices.Count <= 0) if (lvRoutings.SelectedIndices.Count <= 0)
{ {
UI.Show(UIRes.I18N("PleaseSelectRules")); UI.Show(ResUI.PleaseSelectRules);
return index; return index;
} }
@@ -259,7 +260,7 @@ namespace v2rayN.Forms
{ {
return; return;
} }
if (UI.ShowYesNo(UIRes.I18N("RemoveRules")) == DialogResult.No) if (UI.ShowYesNo(ResUI.RemoveRules) == DialogResult.No)
{ {
return; return;
} }
@@ -282,7 +283,7 @@ namespace v2rayN.Forms
{ {
if (index < 0) if (index < 0)
{ {
UI.Show(UIRes.I18N("PleaseSelectServer")); UI.Show(ResUI.PleaseSelectServer);
return -1; return -1;
} }
if (ConfigHandler.SetDefaultRouting(ref config, index) == 0) if (ConfigHandler.SetDefaultRouting(ref config, index) == 0)
@@ -301,7 +302,7 @@ namespace v2rayN.Forms
txtBlockDomain.Text = "geosite:category-ads-all"; txtBlockDomain.Text = "geosite:category-ads-all";
UI.Show(UIRes.I18N("OperationSuccess")); UI.Show(ResUI.OperationSuccess);
} }
private void menuImportAdvancedRules_Click(object sender, EventArgs e) private void menuImportAdvancedRules_Click(object sender, EventArgs e)

View File

@@ -2,6 +2,7 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Windows.Forms; using System.Windows.Forms;
using v2rayN.Mode; using v2rayN.Mode;
using v2rayN.Resx;
namespace v2rayN.Forms namespace v2rayN.Forms
{ {
@@ -156,34 +157,34 @@ namespace v2rayN.Forms
if (network.Equals(Global.DefaultNetwork)) if (network.Equals(Global.DefaultNetwork))
{ {
tipRequestHost.Text = UIRes.I18N("TransportRequestHostTip1"); tipRequestHost.Text = ResUI.TransportRequestHostTip1;
tipHeaderType.Text = UIRes.I18N("TransportHeaderTypeTip1"); tipHeaderType.Text = ResUI.TransportHeaderTypeTip1;
} }
else if (network.Equals("kcp")) else if (network.Equals("kcp"))
{ {
tipHeaderType.Text = UIRes.I18N("TransportHeaderTypeTip2"); tipHeaderType.Text = ResUI.TransportHeaderTypeTip2;
tipPath.Text = UIRes.I18N("TransportPathTip5"); tipPath.Text = ResUI.TransportPathTip5;
} }
else if (network.Equals("ws")) else if (network.Equals("ws"))
{ {
tipRequestHost.Text = UIRes.I18N("TransportRequestHostTip2"); tipRequestHost.Text = ResUI.TransportRequestHostTip2;
tipPath.Text = UIRes.I18N("TransportPathTip1"); tipPath.Text = ResUI.TransportPathTip1;
} }
else if (network.Equals("h2")) else if (network.Equals("h2"))
{ {
tipRequestHost.Text = UIRes.I18N("TransportRequestHostTip3"); tipRequestHost.Text = ResUI.TransportRequestHostTip3;
tipPath.Text = UIRes.I18N("TransportPathTip2"); tipPath.Text = ResUI.TransportPathTip2;
} }
else if (network.Equals("quic")) else if (network.Equals("quic"))
{ {
tipRequestHost.Text = UIRes.I18N("TransportRequestHostTip4"); tipRequestHost.Text = ResUI.TransportRequestHostTip4;
tipPath.Text = UIRes.I18N("TransportPathTip3"); tipPath.Text = ResUI.TransportPathTip3;
tipHeaderType.Text = UIRes.I18N("TransportHeaderTypeTip3"); tipHeaderType.Text = ResUI.TransportHeaderTypeTip3;
} }
else if (network.Equals("grpc")) else if (network.Equals("grpc"))
{ {
tipPath.Text = UIRes.I18N("TransportPathTip4"); tipPath.Text = ResUI.TransportPathTip4;
tipHeaderType.Text = UIRes.I18N("TransportHeaderTypeTip4"); tipHeaderType.Text = ResUI.TransportHeaderTypeTip4;
labHeaderType.Visible = false; labHeaderType.Visible = false;
} }
} }

View File

@@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Windows.Forms; using System.Windows.Forms;
using v2rayN.Handler; using v2rayN.Handler;
using v2rayN.Mode; using v2rayN.Mode;
using v2rayN.Resx;
namespace v2rayN.Forms namespace v2rayN.Forms
{ {
@@ -74,7 +75,7 @@ namespace v2rayN.Forms
} }
else else
{ {
UI.ShowWarning(UIRes.I18N("OperationFailed")); UI.ShowWarning(ResUI.OperationFailed);
} }
} }

View File

@@ -15,8 +15,9 @@ namespace v2rayN
public const string xrayCoreUrl = "https://github.com/XTLS/Xray-core/releases"; public const string xrayCoreUrl = "https://github.com/XTLS/Xray-core/releases";
public const string NUrl = @"https://github.com/2dust/v2rayN/releases"; public const string NUrl = @"https://github.com/2dust/v2rayN/releases";
public const string clashCoreUrl = "https://github.com/Dreamacro/clash/releases"; public const string clashCoreUrl = "https://github.com/Dreamacro/clash/releases";
public const string hysteriaCoreUrl = "https://github.com/HyNetwork/hysteria/releases";
/// <summary> /// <summary>

View File

@@ -15,6 +15,7 @@ namespace v2rayN.Handler
class ConfigHandler class ConfigHandler
{ {
private static string configRes = Global.ConfigFileName; private static string configRes = Global.ConfigFileName;
private static object objLock = new object();
#region ConfigHandler #region ConfigHandler
@@ -204,7 +205,10 @@ namespace v2rayN.Handler
/// <param name="config"></param> /// <param name="config"></param>
private static void ToJsonFile(Config config) private static void ToJsonFile(Config config)
{ {
Utils.ToJsonFile(config, Utils.GetPath(configRes)); lock (objLock)
{
Utils.ToJsonFile(config, Utils.GetPath(configRes));
}
} }
#endregion #endregion
@@ -353,7 +357,7 @@ namespace v2rayN.Handler
/// <param name="index"></param> /// <param name="index"></param>
/// <param name="eMove"></param> /// <param name="eMove"></param>
/// <returns></returns> /// <returns></returns>
public static int MoveServer(ref Config config, ref List<VmessItem> lstVmess, int index, EMove eMove) public static int MoveServer(ref Config config, ref List<VmessItem> lstVmess, int index, EMove eMove, int pos = -1)
{ {
int count = lstVmess.Count; int count = lstVmess.Count;
if (index < 0 || index > lstVmess.Count - 1) if (index < 0 || index > lstVmess.Count - 1)
@@ -409,6 +413,9 @@ namespace v2rayN.Handler
break; break;
} }
case EMove.Position:
lstVmess[index].sort = pos * 10 + 1;
break;
} }
ToJsonFile(config); ToJsonFile(config);
@@ -740,6 +747,10 @@ namespace v2rayN.Handler
{ {
vmessItem.indexId = Utils.GetGUID(false); vmessItem.indexId = Utils.GetGUID(false);
} }
else if (vmessItem.indexId == config.indexId)
{
Global.reloadV2ray = true;
}
if (!config.vmess.Exists(it => it.indexId == vmessItem.indexId)) if (!config.vmess.Exists(it => it.indexId == vmessItem.indexId))
{ {
var maxSort = config.vmess.Any() ? config.vmess.Max(t => t.sort) : 0; var maxSort = config.vmess.Any() ? config.vmess.Max(t => t.sort) : 0;
@@ -748,11 +759,6 @@ namespace v2rayN.Handler
config.vmess.Add(vmessItem); config.vmess.Add(vmessItem);
} }
//if (config.vmess.Count == 1)
//{
// config.indexId = config.vmess[0].indexId;
// Global.reloadV2ray = true;
//}
return 0; return 0;
} }
@@ -934,6 +940,15 @@ namespace v2rayN.Handler
vmessItem.address = fileName; vmessItem.address = fileName;
vmessItem.remarks = "clash_custom"; vmessItem.remarks = "clash_custom";
} }
//Is Other configuration
else
{
var fileName = Utils.GetTempPath($"{Utils.GetGUID(false)}.txt");
File.WriteAllText(fileName, clipboardData);
vmessItem.address = fileName;
vmessItem.remarks = "other_custom";
}
if (!Utils.IsNullOrEmpty(subid)) if (!Utils.IsNullOrEmpty(subid))
{ {
@@ -1144,6 +1159,8 @@ namespace v2rayN.Handler
{ {
config.uiItem.mainLvColWidth.Add(name, width); config.uiItem.mainLvColWidth.Add(name, width);
} }
ToJsonFile(config);
return 0; return 0;
} }
public static int GetformMainLvColWidth(ref Config config, string name, int width) public static int GetformMainLvColWidth(ref Config config, string name, int width)
@@ -1258,7 +1275,7 @@ namespace v2rayN.Handler
/// <param name="index"></param> /// <param name="index"></param>
/// <param name="eMove"></param> /// <param name="eMove"></param>
/// <returns></returns> /// <returns></returns>
public static int MoveRoutingRule(ref RoutingItem routingItem, int index, EMove eMove) public static int MoveRoutingRule(ref RoutingItem routingItem, int index, EMove eMove, int pos = -1)
{ {
int count = routingItem.rules.Count; int count = routingItem.rules.Count;
if (index < 0 || index > routingItem.rules.Count - 1) if (index < 0 || index > routingItem.rules.Count - 1)
@@ -1316,6 +1333,14 @@ namespace v2rayN.Handler
break; break;
} }
case EMove.Position:
{
var removeItem = routingItem.rules[index];
var item = Utils.DeepCopy(routingItem.rules[index]);
routingItem.rules.Insert(pos, item);
routingItem.rules.Remove(removeItem);
break;
}
} }
return 0; return 0;

View File

@@ -3,6 +3,7 @@ using System.IO;
using System.Net; using System.Net;
using System.Text; using System.Text;
using v2rayN.Base; using v2rayN.Base;
using v2rayN.Resx;
namespace v2rayN.Handler namespace v2rayN.Handler
{ {
@@ -39,7 +40,7 @@ namespace v2rayN.Handler
try try
{ {
Utils.SetSecurityProtocol(LazyConfig.Instance.GetConfig().enableSecurityProtocolTls13); Utils.SetSecurityProtocol(LazyConfig.Instance.GetConfig().enableSecurityProtocolTls13);
UpdateCompleted?.Invoke(this, new ResultEventArgs(false, UIRes.I18N("Downloading"))); UpdateCompleted?.Invoke(this, new ResultEventArgs(false, ResUI.Downloading));
progressPercentage = -1; progressPercentage = -1;
totalBytesToReceive = 0; totalBytesToReceive = 0;
@@ -215,7 +216,7 @@ namespace v2rayN.Handler
try try
{ {
Utils.SetSecurityProtocol(LazyConfig.Instance.GetConfig().enableSecurityProtocolTls13); Utils.SetSecurityProtocol(LazyConfig.Instance.GetConfig().enableSecurityProtocolTls13);
UpdateCompleted?.Invoke(this, new ResultEventArgs(false, UIRes.I18N("Downloading"))); UpdateCompleted?.Invoke(this, new ResultEventArgs(false, ResUI.Downloading));
progressPercentage = -1; progressPercentage = -1;
totalBytesToReceive = 0; totalBytesToReceive = 0;

View File

@@ -9,6 +9,7 @@ namespace v2rayN.Handler
{ {
private static readonly Lazy<LazyConfig> _instance = new Lazy<LazyConfig>(() => new LazyConfig()); private static readonly Lazy<LazyConfig> _instance = new Lazy<LazyConfig>(() => new LazyConfig());
private Config _config; private Config _config;
private List<CoreInfo> coreInfos;
public static LazyConfig Instance public static LazyConfig Instance
{ {
@@ -51,5 +52,53 @@ namespace v2rayN.Handler
} }
return item.coreType; return item.coreType;
} }
public CoreInfo GetCoreInfo(ECoreType coreType)
{
if (coreInfos == null)
{
InitCoreInfo();
}
return coreInfos.Where(t => t.coreType == coreType).FirstOrDefault();
}
private void InitCoreInfo()
{
coreInfos = new List<CoreInfo>();
coreInfos.Add(new CoreInfo
{
coreType = ECoreType.v2fly,
coreExes = new List<string> { "wv2ray", "v2ray" },
arguments = "",
coreUrl = Global.v2flyCoreUrl
});
coreInfos.Add(new CoreInfo
{
coreType = ECoreType.Xray,
coreExes = new List<string> { "xray" },
arguments = "",
coreUrl = Global.xrayCoreUrl
});
coreInfos.Add(new CoreInfo
{
coreType = ECoreType.clash,
coreExes = new List<string> { "clash-windows-amd64", "clash-windows-386", "clash" },
arguments = "-f config.json",
coreUrl = Global.clashCoreUrl
});
coreInfos.Add(new CoreInfo
{
coreType = ECoreType.hysteria,
coreExes = new List<string> { "hysteria-tun-windows-6.0-amd64", "hysteria-tun-windows-6.0-386", "hysteria" },
arguments = "",
coreUrl = Global.hysteriaCoreUrl
});
}
} }
} }

View File

@@ -9,6 +9,7 @@ using System.Threading.Tasks;
using System.Windows.Forms; using System.Windows.Forms;
using v2rayN.Mode; using v2rayN.Mode;
using System.Linq; using System.Linq;
using v2rayN.Resx;
namespace v2rayN.Handler namespace v2rayN.Handler
{ {
@@ -88,7 +89,7 @@ namespace v2rayN.Handler
if (item.configType != EConfigType.Vmess if (item.configType != EConfigType.Vmess
&& item.configType != EConfigType.VLESS) && item.configType != EConfigType.VLESS)
{ {
UI.Show(UIRes.I18N("NonVmessService")); UI.Show(ResUI.NonVmessService);
return; return;
} }
@@ -115,7 +116,7 @@ namespace v2rayN.Handler
} }
else else
{ {
UI.ShowWarning(string.Format(UIRes.I18N("SaveClientConfigurationIn"), fileName)); UI.ShowWarning(string.Format(ResUI.SaveClientConfigurationIn, fileName));
} }
} }
@@ -128,7 +129,7 @@ namespace v2rayN.Handler
if (item.configType != EConfigType.Vmess if (item.configType != EConfigType.Vmess
&& item.configType != EConfigType.VLESS) && item.configType != EConfigType.VLESS)
{ {
UI.Show(UIRes.I18N("NonVmessService")); UI.Show(ResUI.NonVmessService);
return; return;
} }
@@ -155,7 +156,7 @@ namespace v2rayN.Handler
} }
else else
{ {
UI.ShowWarning(string.Format(UIRes.I18N("SaveServerConfigurationIn"), fileName)); UI.ShowWarning(string.Format(ResUI.SaveServerConfigurationIn, fileName));
} }
} }
@@ -191,11 +192,11 @@ namespace v2rayN.Handler
if (ret == 0) if (ret == 0)
{ {
UI.Show(UIRes.I18N("OperationSuccess")); UI.Show(ResUI.OperationSuccess);
} }
else else
{ {
UI.ShowWarning(UIRes.I18N("OperationFailed")); UI.ShowWarning(ResUI.OperationFailed);
} }
} }
} }
@@ -268,12 +269,12 @@ namespace v2rayN.Handler
try try
{ {
HotkeyManager.Current.AddOrReplace(((int)item.eGlobalHotkey).ToString(), keys, handler); HotkeyManager.Current.AddOrReplace(((int)item.eGlobalHotkey).ToString(), keys, handler);
var msg = string.Format(UIRes.I18N("RegisterGlobalHotkeySuccessfully"), $"{item.eGlobalHotkey.ToString()} = {keys}"); var msg = string.Format(ResUI.RegisterGlobalHotkeySuccessfully, $"{item.eGlobalHotkey.ToString()} = {keys}");
update(false, msg); update(false, msg);
} }
catch (Exception ex) catch (Exception ex)
{ {
var msg = string.Format(UIRes.I18N("RegisterGlobalHotkeyFailed"), $"{item.eGlobalHotkey.ToString()} = {keys}", ex.Message); var msg = string.Format(ResUI.RegisterGlobalHotkeyFailed, $"{item.eGlobalHotkey.ToString()} = {keys}", ex.Message);
update(false, msg); update(false, msg);
Utils.SaveLog(msg); Utils.SaveLog(msg);
} }

View File

@@ -9,6 +9,7 @@ using System.Threading.Tasks;
using System.Web; using System.Web;
using v2rayN.Base; using v2rayN.Base;
using v2rayN.Mode; using v2rayN.Mode;
using v2rayN.Resx;
namespace v2rayN.Handler namespace v2rayN.Handler
{ {
@@ -318,7 +319,7 @@ namespace v2rayN.Handler
string result = clipboardData.TrimEx();// Utils.GetClipboardData(); string result = clipboardData.TrimEx();// Utils.GetClipboardData();
if (Utils.IsNullOrEmpty(result)) if (Utils.IsNullOrEmpty(result))
{ {
msg = UIRes.I18N("FailedReadConfiguration"); msg = ResUI.FailedReadConfiguration;
return null; return null;
} }
@@ -338,7 +339,7 @@ namespace v2rayN.Handler
} }
else if (result.StartsWith(Global.ssProtocol)) else if (result.StartsWith(Global.ssProtocol))
{ {
msg = UIRes.I18N("ConfigurationFormatIncorrect"); msg = ResUI.ConfigurationFormatIncorrect;
vmessItem = ResolveSSLegacy(result); vmessItem = ResolveSSLegacy(result);
if (vmessItem == null) if (vmessItem == null)
@@ -358,7 +359,7 @@ namespace v2rayN.Handler
} }
else if (result.StartsWith(Global.socksProtocol)) else if (result.StartsWith(Global.socksProtocol))
{ {
msg = UIRes.I18N("ConfigurationFormatIncorrect"); msg = ResUI.ConfigurationFormatIncorrect;
vmessItem = ResolveSocksNew(result); vmessItem = ResolveSocksNew(result);
if (vmessItem == null) if (vmessItem == null)
@@ -378,7 +379,7 @@ namespace v2rayN.Handler
} }
else if (result.StartsWith(Global.trojanProtocol)) else if (result.StartsWith(Global.trojanProtocol))
{ {
msg = UIRes.I18N("ConfigurationFormatIncorrect"); msg = ResUI.ConfigurationFormatIncorrect;
vmessItem = ResolveTrojan(result); vmessItem = ResolveTrojan(result);
} }
@@ -390,13 +391,13 @@ namespace v2rayN.Handler
} }
else else
{ {
msg = UIRes.I18N("NonvmessOrssProtocol"); msg = ResUI.NonvmessOrssProtocol;
return null; return null;
} }
} }
catch catch
{ {
msg = UIRes.I18N("Incorrectconfiguration"); msg = ResUI.Incorrectconfiguration;
return null; return null;
} }
@@ -416,7 +417,7 @@ namespace v2rayN.Handler
VmessQRCode vmessQRCode = Utils.FromJson<VmessQRCode>(result); VmessQRCode vmessQRCode = Utils.FromJson<VmessQRCode>(result);
if (vmessQRCode == null) if (vmessQRCode == null)
{ {
msg = UIRes.I18N("FailedConversionConfiguration"); msg = ResUI.FailedConversionConfiguration;
return null; return null;
} }
@@ -507,7 +508,7 @@ namespace v2rayN.Handler
i.address = u.IdnHost; i.address = u.IdnHost;
i.port = u.Port; i.port = u.Port;
i.remarks = Utils.UrlDecode(u.GetComponents(UriComponents.Fragment, UriFormat.Unescaped)); i.remarks = u.GetComponents(UriComponents.Fragment, UriFormat.Unescaped);
var q = HttpUtility.ParseQueryString(u.Query); var q = HttpUtility.ParseQueryString(u.Query);
var m = StdVmessUserInfo.Match(u.UserInfo); var m = StdVmessUserInfo.Match(u.UserInfo);
@@ -589,13 +590,13 @@ namespace v2rayN.Handler
} }
VmessItem server = new VmessItem VmessItem server = new VmessItem
{ {
remarks = Utils.UrlDecode(parsedUrl.GetComponents(UriComponents.Fragment, UriFormat.Unescaped)), remarks = parsedUrl.GetComponents(UriComponents.Fragment, UriFormat.Unescaped),
address = parsedUrl.IdnHost, address = parsedUrl.IdnHost,
port = parsedUrl.Port, port = parsedUrl.Port,
}; };
// parse base64 UserInfo // parse base64 UserInfo
string rawUserInfo = parsedUrl.GetComponents(UriComponents.UserInfo, UriFormat.Unescaped); string rawUserInfo = parsedUrl.GetComponents(UriComponents.UserInfo, UriFormat.UriEscaped);
string userInfo = Utils.Base64Decode(rawUserInfo); string userInfo = Utils.Base64Decode(rawUserInfo);
string[] userInfoParts = userInfo.Split(new char[] { ':' }, 2); string[] userInfoParts = userInfo.Split(new char[] { ':' }, 2);
if (userInfoParts.Length != 2) if (userInfoParts.Length != 2)
@@ -711,7 +712,7 @@ namespace v2rayN.Handler
} }
VmessItem server = new VmessItem VmessItem server = new VmessItem
{ {
remarks = Utils.UrlDecode(parsedUrl.GetComponents(UriComponents.Fragment, UriFormat.Unescaped)), remarks = parsedUrl.GetComponents(UriComponents.Fragment, UriFormat.Unescaped),
address = parsedUrl.IdnHost, address = parsedUrl.IdnHost,
port = parsedUrl.Port, port = parsedUrl.Port,
}; };
@@ -740,7 +741,7 @@ namespace v2rayN.Handler
item.address = url.IdnHost; item.address = url.IdnHost;
item.port = url.Port; item.port = url.Port;
item.remarks = Utils.UrlDecode(url.GetComponents(UriComponents.Fragment, UriFormat.Unescaped)); item.remarks = url.GetComponents(UriComponents.Fragment, UriFormat.Unescaped);
item.id = url.UserInfo; item.id = url.UserInfo;
var query = HttpUtility.ParseQueryString(url.Query); var query = HttpUtility.ParseQueryString(url.Query);
@@ -760,7 +761,7 @@ namespace v2rayN.Handler
item.address = url.IdnHost; item.address = url.IdnHost;
item.port = url.Port; item.port = url.Port;
item.remarks = Utils.UrlDecode(url.GetComponents(UriComponents.Fragment, UriFormat.Unescaped)); item.remarks = url.GetComponents(UriComponents.Fragment, UriFormat.Unescaped);
item.id = url.UserInfo; item.id = url.UserInfo;
var query = HttpUtility.ParseQueryString(url.Query); var query = HttpUtility.ParseQueryString(url.Query);

View File

@@ -6,6 +6,7 @@ using System.Net.Sockets;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using v2rayN.Mode; using v2rayN.Mode;
using v2rayN.Resx;
namespace v2rayN.Handler namespace v2rayN.Handler
{ {
@@ -117,7 +118,7 @@ namespace v2rayN.Handler
pid = _v2rayHandler.LoadV2rayConfigString(_config, _selecteds); pid = _v2rayHandler.LoadV2rayConfigString(_config, _selecteds);
if (pid < 0) if (pid < 0)
{ {
_updateFunc(_selecteds[0].indexId, UIRes.I18N("OperationFailed")); _updateFunc(_selecteds[0].indexId, ResUI.OperationFailed);
return; return;
} }
@@ -203,7 +204,7 @@ namespace v2rayN.Handler
pid = _v2rayHandler.LoadV2rayConfigString(_config, _selecteds); pid = _v2rayHandler.LoadV2rayConfigString(_config, _selecteds);
if (pid < 0) if (pid < 0)
{ {
_updateFunc(_selecteds[0].indexId, UIRes.I18N("OperationFailed")); _updateFunc(_selecteds[0].indexId, ResUI.OperationFailed);
return; return;
} }

View File

@@ -8,6 +8,7 @@ using System.Text.RegularExpressions;
using System.Windows.Forms; using System.Windows.Forms;
using v2rayN.Base; using v2rayN.Base;
using v2rayN.Mode; using v2rayN.Mode;
using v2rayN.Resx;
namespace v2rayN.Handler namespace v2rayN.Handler
{ {
@@ -53,7 +54,7 @@ namespace v2rayN.Handler
{ {
if (args.Success) if (args.Success)
{ {
_updateFunc(false, UIRes.I18N("MsgDownloadV2rayCoreSuccessfully")); _updateFunc(false, ResUI.MsgDownloadV2rayCoreSuccessfully);
try try
{ {
@@ -93,7 +94,7 @@ namespace v2rayN.Handler
{ {
if (args.Success) if (args.Success)
{ {
_updateFunc(false, string.Format(UIRes.I18N("MsgParsingSuccessfully"), "v2rayN")); _updateFunc(false, string.Format(ResUI.MsgParsingSuccessfully, "v2rayN"));
url = args.Msg; url = args.Msg;
askToDownload(downloadHandle, url, true); askToDownload(downloadHandle, url, true);
@@ -103,12 +104,12 @@ namespace v2rayN.Handler
_updateFunc(false, args.Msg); _updateFunc(false, args.Msg);
} }
}; };
_updateFunc(false, string.Format(UIRes.I18N("MsgStartUpdating"), "v2rayN")); _updateFunc(false, string.Format(ResUI.MsgStartUpdating, "v2rayN"));
CheckUpdateAsync("v2rayN"); CheckUpdateAsync(ECoreType.v2rayN);
} }
public void CheckUpdateCore(string type, Config config, Action<bool, string> update) public void CheckUpdateCore(ECoreType type, Config config, Action<bool, string> update)
{ {
_config = config; _config = config;
_updateFunc = update; _updateFunc = update;
@@ -122,8 +123,8 @@ namespace v2rayN.Handler
{ {
if (args.Success) if (args.Success)
{ {
_updateFunc(false, UIRes.I18N("MsgDownloadV2rayCoreSuccessfully")); _updateFunc(false, ResUI.MsgDownloadV2rayCoreSuccessfully);
_updateFunc(false, UIRes.I18N("MsgUnpacking")); _updateFunc(false, ResUI.MsgUnpacking);
try try
{ {
@@ -149,7 +150,7 @@ namespace v2rayN.Handler
{ {
if (args.Success) if (args.Success)
{ {
_updateFunc(false, string.Format(UIRes.I18N("MsgParsingSuccessfully"), "Core")); _updateFunc(false, string.Format(ResUI.MsgParsingSuccessfully, "Core"));
url = args.Msg; url = args.Msg;
askToDownload(downloadHandle, url, true); askToDownload(downloadHandle, url, true);
} }
@@ -158,7 +159,7 @@ namespace v2rayN.Handler
_updateFunc(false, args.Msg); _updateFunc(false, args.Msg);
} }
}; };
_updateFunc(false, string.Format(UIRes.I18N("MsgStartUpdating"), "Core")); _updateFunc(false, string.Format(ResUI.MsgStartUpdating, "Core"));
CheckUpdateAsync(type); CheckUpdateAsync(type);
} }
@@ -168,11 +169,11 @@ namespace v2rayN.Handler
_config = config; _config = config;
_updateFunc = update; _updateFunc = update;
_updateFunc(false, UIRes.I18N("MsgUpdateSubscriptionStart")); _updateFunc(false, ResUI.MsgUpdateSubscriptionStart);
if (config.subItem == null || config.subItem.Count <= 0) if (config.subItem == null || config.subItem.Count <= 0)
{ {
_updateFunc(false, UIRes.I18N("MsgNoValidSubscription")); _updateFunc(false, ResUI.MsgNoValidSubscription);
return; return;
} }
@@ -189,7 +190,7 @@ namespace v2rayN.Handler
} }
if (Utils.IsNullOrEmpty(id) || Utils.IsNullOrEmpty(url)) if (Utils.IsNullOrEmpty(id) || Utils.IsNullOrEmpty(url))
{ {
_updateFunc(false, $"{hashCode}{UIRes.I18N("MsgNoValidSubscription")}"); _updateFunc(false, $"{hashCode}{ResUI.MsgNoValidSubscription}");
continue; continue;
} }
@@ -198,17 +199,17 @@ namespace v2rayN.Handler
{ {
if (args.Success) if (args.Success)
{ {
_updateFunc(false, $"{hashCode}{UIRes.I18N("MsgGetSubscriptionSuccessfully")}"); _updateFunc(false, $"{hashCode}{ResUI.MsgGetSubscriptionSuccessfully}");
//string result = Utils.Base64Decode(args.Msg); //string result = Utils.Base64Decode(args.Msg);
string result = args.Msg; string result = args.Msg;
if (Utils.IsNullOrEmpty(result)) if (Utils.IsNullOrEmpty(result))
{ {
_updateFunc(false, $"{hashCode}{UIRes.I18N("MsgSubscriptionDecodingFailed")}"); _updateFunc(false, $"{hashCode}{ResUI.MsgSubscriptionDecodingFailed}");
return; return;
} }
//ConfigHandler.RemoveServerViaSubid(ref config, id); //ConfigHandler.RemoveServerViaSubid(ref config, id);
//_updateFunc(false, $"{hashCode}{UIRes.I18N("MsgClearSubscription")}"); //_updateFunc(false, $"{hashCode}{ResUI.MsgClearSubscription")}");
// RefreshServers(); // RefreshServers();
int ret = ConfigHandler.AddBatchServers(ref config, result, id, groupId); int ret = ConfigHandler.AddBatchServers(ref config, result, id, groupId);
if (ret > 0) if (ret > 0)
@@ -217,9 +218,9 @@ namespace v2rayN.Handler
} }
else else
{ {
_updateFunc(false, $"{hashCode}{UIRes.I18N("MsgFailedImportSubscription")}"); _updateFunc(false, $"{hashCode}{ResUI.MsgFailedImportSubscription}");
} }
_updateFunc(true, $"{hashCode}{UIRes.I18N("MsgUpdateSubscriptionEnd")}"); _updateFunc(true, $"{hashCode}{ResUI.MsgUpdateSubscriptionEnd}");
} }
else else
{ {
@@ -234,7 +235,7 @@ namespace v2rayN.Handler
WebProxy webProxy = blProxy ? new WebProxy(Global.Loopback, _config.GetLocalPort(Global.InboundHttp)) : null; WebProxy webProxy = blProxy ? new WebProxy(Global.Loopback, _config.GetLocalPort(Global.InboundHttp)) : null;
downloadHandle3.WebDownloadString(url, webProxy, userAgent); downloadHandle3.WebDownloadString(url, webProxy, userAgent);
_updateFunc(false, $"{hashCode}{UIRes.I18N("MsgStartGettingSubscriptions")}"); _updateFunc(false, $"{hashCode}{ResUI.MsgStartGettingSubscriptions}");
} }
} }
@@ -255,7 +256,7 @@ namespace v2rayN.Handler
{ {
if (args.Success) if (args.Success)
{ {
_updateFunc(false, string.Format(UIRes.I18N("MsgDownloadGeoFileSuccessfully"), geoName)); _updateFunc(false, string.Format(ResUI.MsgDownloadGeoFileSuccessfully, geoName));
try try
{ {
@@ -292,7 +293,7 @@ namespace v2rayN.Handler
#region private #region private
private async void CheckUpdateAsync(string type) private async void CheckUpdateAsync(ECoreType type)
{ {
try try
{ {
@@ -310,15 +311,15 @@ namespace v2rayN.Handler
HttpClient httpClient = new HttpClient(webRequestHandler); HttpClient httpClient = new HttpClient(webRequestHandler);
string url; string url;
if (type == "v2fly") if (type == ECoreType.v2fly)
{ {
url = v2flyCoreLatestUrl; url = v2flyCoreLatestUrl;
} }
else if (type == "xray") else if (type == ECoreType.Xray)
{ {
url = xrayCoreLatestUrl; url = xrayCoreLatestUrl;
} }
else if (type == "v2rayN") else if (type == ECoreType.v2rayN)
{ {
url = nLatestUrl; url = nLatestUrl;
} }
@@ -347,18 +348,18 @@ namespace v2rayN.Handler
/// <summary> /// <summary>
/// 获取V2RayCore版本 /// 获取V2RayCore版本
/// </summary> /// </summary>
private string getCoreVersion(string type) private string getCoreVersion(ECoreType type)
{ {
try try
{ {
var core = string.Empty; var core = string.Empty;
var match = string.Empty; var match = string.Empty;
if (type == "v2fly") if (type == ECoreType.v2fly)
{ {
core = "v2ray.exe"; core = "v2ray.exe";
match = "V2Ray"; match = "V2Ray";
} }
else if (type == "xray") else if (type == ECoreType.Xray)
{ {
core = "xray.exe"; core = "xray.exe";
match = "Xray"; match = "Xray";
@@ -366,7 +367,7 @@ namespace v2rayN.Handler
string filePath = Utils.GetPath(core); string filePath = Utils.GetPath(core);
if (!File.Exists(filePath)) if (!File.Exists(filePath))
{ {
string msg = string.Format(UIRes.I18N("NotFoundCore"), @""); string msg = string.Format(ResUI.NotFoundCore, @"");
//ShowMsg(true, msg); //ShowMsg(true, msg);
return ""; return "";
} }
@@ -392,7 +393,7 @@ namespace v2rayN.Handler
return ""; return "";
} }
} }
private void responseHandler(string type, string redirectUrl) private void responseHandler(ECoreType type, string redirectUrl)
{ {
try try
{ {
@@ -401,24 +402,24 @@ namespace v2rayN.Handler
string curVersion; string curVersion;
string message; string message;
string url; string url;
if (type == "v2fly") if (type == ECoreType.v2fly)
{ {
curVersion = "v" + getCoreVersion(type); curVersion = "v" + getCoreVersion(type);
message = string.Format(UIRes.I18N("IsLatestCore"), curVersion); message = string.Format(ResUI.IsLatestCore, curVersion);
string osBit = Environment.Is64BitProcess ? "64" : "32"; string osBit = Environment.Is64BitProcess ? "64" : "32";
url = string.Format(v2flyCoreUrl, version, osBit); url = string.Format(v2flyCoreUrl, version, osBit);
} }
else if (type == "xray") else if (type == ECoreType.Xray)
{ {
curVersion = "v" + getCoreVersion(type); curVersion = "v" + getCoreVersion(type);
message = string.Format(UIRes.I18N("IsLatestCore"), curVersion); message = string.Format(ResUI.IsLatestCore, curVersion);
string osBit = Environment.Is64BitProcess ? "64" : "32"; string osBit = Environment.Is64BitProcess ? "64" : "32";
url = string.Format(xrayCoreUrl, version, osBit); url = string.Format(xrayCoreUrl, version, osBit);
} }
else if (type == "v2rayN") else if (type == ECoreType.v2rayN)
{ {
curVersion = FileVersionInfo.GetVersionInfo(Utils.GetExePath()).FileVersion.ToString(); curVersion = FileVersionInfo.GetVersionInfo(Utils.GetExePath()).FileVersion.ToString();
message = string.Format(UIRes.I18N("IsLatestN"), curVersion); message = string.Format(ResUI.IsLatestN, curVersion);
url = string.Format(nUrl, version); url = string.Format(nUrl, version);
} }
else else
@@ -446,7 +447,7 @@ namespace v2rayN.Handler
bool blDownload = false; bool blDownload = false;
if (blAsk) if (blAsk)
{ {
if (UI.ShowYesNo(string.Format(UIRes.I18N("DownloadYesNo"), url)) == DialogResult.Yes) if (UI.ShowYesNo(string.Format(ResUI.DownloadYesNo, url)) == DialogResult.Yes)
{ {
blDownload = true; blDownload = true;
} }

View File

@@ -6,6 +6,7 @@ using System.Net;
using System.Net.NetworkInformation; using System.Net.NetworkInformation;
using v2rayN.Base; using v2rayN.Base;
using v2rayN.Mode; using v2rayN.Mode;
using v2rayN.Resx;
namespace v2rayN.Handler namespace v2rayN.Handler
{ {
@@ -32,11 +33,11 @@ namespace v2rayN.Handler
{ {
if (node == null) if (node == null)
{ {
msg = UIRes.I18N("CheckServerSettings"); msg = ResUI.CheckServerSettings;
return -1; return -1;
} }
msg = UIRes.I18N("InitialConfiguration"); msg = ResUI.InitialConfiguration;
if (node.configType == EConfigType.Custom) if (node.configType == EConfigType.Custom)
{ {
return GenerateClientCustomConfig(node, fileName, out msg); return GenerateClientCustomConfig(node, fileName, out msg);
@@ -46,7 +47,7 @@ namespace v2rayN.Handler
string result = Utils.GetEmbedText(SampleClient); string result = Utils.GetEmbedText(SampleClient);
if (Utils.IsNullOrEmpty(result)) if (Utils.IsNullOrEmpty(result))
{ {
msg = UIRes.I18N("FailedGetDefaultConfiguration"); msg = ResUI.FailedGetDefaultConfiguration;
return -1; return -1;
} }
@@ -54,7 +55,7 @@ namespace v2rayN.Handler
V2rayConfig v2rayConfig = Utils.FromJson<V2rayConfig>(result); V2rayConfig v2rayConfig = Utils.FromJson<V2rayConfig>(result);
if (v2rayConfig == null) if (v2rayConfig == null)
{ {
msg = UIRes.I18N("FailedGenDefaultConfiguration"); msg = ResUI.FailedGenDefaultConfiguration;
return -1; return -1;
} }
@@ -80,11 +81,11 @@ namespace v2rayN.Handler
Utils.ToJsonFile(v2rayConfig, fileName, false); Utils.ToJsonFile(v2rayConfig, fileName, false);
msg = string.Format(UIRes.I18N("SuccessfulConfiguration"), $"[{config.GetGroupRemarks(node.groupId)}] {node.GetSummary()}"); msg = string.Format(ResUI.SuccessfulConfiguration, $"[{config.GetGroupRemarks(node.groupId)}] {node.GetSummary()}");
} }
catch catch
{ {
msg = UIRes.I18N("FailedGenDefaultConfiguration"); msg = ResUI.FailedGenDefaultConfiguration;
return -1; return -1;
} }
return 0; return 0;
@@ -168,6 +169,7 @@ namespace v2rayN.Handler
inbound2.protocol = Global.InboundHttp; inbound2.protocol = Global.InboundHttp;
inbound2.listen = inbound.listen; inbound2.listen = inbound.listen;
inbound2.settings.allowTransparent = false; inbound2.settings.allowTransparent = false;
inbound2.sniffing.enabled = inbound.sniffing.enabled;
} }
catch catch
{ {
@@ -900,7 +902,7 @@ namespace v2rayN.Handler
//检查GUI设置 //检查GUI设置
if (node == null) if (node == null)
{ {
msg = UIRes.I18N("CheckServerSettings"); msg = ResUI.CheckServerSettings;
return -1; return -1;
} }
@@ -916,7 +918,7 @@ namespace v2rayN.Handler
} }
if (!File.Exists(addressFileName)) if (!File.Exists(addressFileName))
{ {
msg = UIRes.I18N("FailedGenDefaultConfiguration"); msg = ResUI.FailedGenDefaultConfiguration;
return -1; return -1;
} }
File.Copy(addressFileName, fileName); File.Copy(addressFileName, fileName);
@@ -924,7 +926,7 @@ namespace v2rayN.Handler
//check again //check again
if (!File.Exists(fileName)) if (!File.Exists(fileName))
{ {
msg = UIRes.I18N("FailedGenDefaultConfiguration"); msg = ResUI.FailedGenDefaultConfiguration;
return -1; return -1;
} }
@@ -943,12 +945,12 @@ namespace v2rayN.Handler
} }
File.WriteAllLines(fileName, fileContent); File.WriteAllLines(fileName, fileContent);
msg = string.Format(UIRes.I18N("SuccessfulConfiguration"), $"[{LazyConfig.Instance.GetConfig().GetGroupRemarks(node.groupId)}] {node.GetSummary()}"); msg = string.Format(ResUI.SuccessfulConfiguration, $"[{LazyConfig.Instance.GetConfig().GetGroupRemarks(node.groupId)}] {node.GetSummary()}");
} }
catch (Exception ex) catch (Exception ex)
{ {
Utils.SaveLog("GenerateClientCustomConfig", ex); Utils.SaveLog("GenerateClientCustomConfig", ex);
msg = UIRes.I18N("FailedGenDefaultConfiguration"); msg = ResUI.FailedGenDefaultConfiguration;
return -1; return -1;
} }
return 0; return 0;
@@ -972,17 +974,17 @@ namespace v2rayN.Handler
//检查GUI设置 //检查GUI设置
if (node == null) if (node == null)
{ {
msg = UIRes.I18N("CheckServerSettings"); msg = ResUI.CheckServerSettings;
return -1; return -1;
} }
msg = UIRes.I18N("InitialConfiguration"); msg = ResUI.InitialConfiguration;
//取得默认配置 //取得默认配置
string result = Utils.GetEmbedText(SampleServer); string result = Utils.GetEmbedText(SampleServer);
if (Utils.IsNullOrEmpty(result)) if (Utils.IsNullOrEmpty(result))
{ {
msg = UIRes.I18N("FailedGetDefaultConfiguration"); msg = ResUI.FailedGetDefaultConfiguration;
return -1; return -1;
} }
@@ -990,7 +992,7 @@ namespace v2rayN.Handler
V2rayConfig v2rayConfig = Utils.FromJson<V2rayConfig>(result); V2rayConfig v2rayConfig = Utils.FromJson<V2rayConfig>(result);
if (v2rayConfig == null) if (v2rayConfig == null)
{ {
msg = UIRes.I18N("FailedGenDefaultConfiguration"); msg = ResUI.FailedGenDefaultConfiguration;
return -1; return -1;
} }
@@ -1007,11 +1009,11 @@ namespace v2rayN.Handler
Utils.ToJsonFile(v2rayConfig, fileName, false); Utils.ToJsonFile(v2rayConfig, fileName, false);
msg = string.Format(UIRes.I18N("SuccessfulConfiguration"), node.GetSummary()); msg = string.Format(ResUI.SuccessfulConfiguration, node.GetSummary());
} }
catch catch
{ {
msg = UIRes.I18N("FailedGenDefaultConfiguration"); msg = ResUI.FailedGenDefaultConfiguration;
return -1; return -1;
} }
return 0; return 0;
@@ -1109,7 +1111,7 @@ namespace v2rayN.Handler
string result = Utils.LoadResource(fileName); string result = Utils.LoadResource(fileName);
if (Utils.IsNullOrEmpty(result)) if (Utils.IsNullOrEmpty(result))
{ {
msg = UIRes.I18N("FailedReadConfiguration"); msg = ResUI.FailedReadConfiguration;
return null; return null;
} }
@@ -1117,14 +1119,14 @@ namespace v2rayN.Handler
V2rayConfig v2rayConfig = Utils.FromJson<V2rayConfig>(result); V2rayConfig v2rayConfig = Utils.FromJson<V2rayConfig>(result);
if (v2rayConfig == null) if (v2rayConfig == null)
{ {
msg = UIRes.I18N("FailedConversionConfiguration"); msg = ResUI.FailedConversionConfiguration;
return null; return null;
} }
if (v2rayConfig.outbounds == null if (v2rayConfig.outbounds == null
|| v2rayConfig.outbounds.Count <= 0) || v2rayConfig.outbounds.Count <= 0)
{ {
msg = UIRes.I18N("IncorrectClientConfiguration"); msg = ResUI.IncorrectClientConfiguration;
return null; return null;
} }
@@ -1138,7 +1140,7 @@ namespace v2rayN.Handler
|| outbound.settings.vnext[0].users == null || outbound.settings.vnext[0].users == null
|| outbound.settings.vnext[0].users.Count <= 0) || outbound.settings.vnext[0].users.Count <= 0)
{ {
msg = UIRes.I18N("IncorrectClientConfiguration"); msg = ResUI.IncorrectClientConfiguration;
return null; return null;
} }
@@ -1231,7 +1233,7 @@ namespace v2rayN.Handler
} }
catch catch
{ {
msg = UIRes.I18N("IncorrectClientConfiguration"); msg = ResUI.IncorrectClientConfiguration;
return null; return null;
} }
@@ -1255,7 +1257,7 @@ namespace v2rayN.Handler
string result = Utils.LoadResource(fileName); string result = Utils.LoadResource(fileName);
if (Utils.IsNullOrEmpty(result)) if (Utils.IsNullOrEmpty(result))
{ {
msg = UIRes.I18N("FailedReadConfiguration"); msg = ResUI.FailedReadConfiguration;
return null; return null;
} }
@@ -1263,14 +1265,14 @@ namespace v2rayN.Handler
V2rayConfig v2rayConfig = Utils.FromJson<V2rayConfig>(result); V2rayConfig v2rayConfig = Utils.FromJson<V2rayConfig>(result);
if (v2rayConfig == null) if (v2rayConfig == null)
{ {
msg = UIRes.I18N("FailedConversionConfiguration"); msg = ResUI.FailedConversionConfiguration;
return null; return null;
} }
if (v2rayConfig.inbounds == null if (v2rayConfig.inbounds == null
|| v2rayConfig.inbounds.Count <= 0) || v2rayConfig.inbounds.Count <= 0)
{ {
msg = UIRes.I18N("IncorrectServerConfiguration"); msg = ResUI.IncorrectServerConfiguration;
return null; return null;
} }
@@ -1282,7 +1284,7 @@ namespace v2rayN.Handler
|| inbound.settings.clients == null || inbound.settings.clients == null
|| inbound.settings.clients.Count <= 0) || inbound.settings.clients.Count <= 0)
{ {
msg = UIRes.I18N("IncorrectServerConfiguration"); msg = ResUI.IncorrectServerConfiguration;
return null; return null;
} }
@@ -1376,7 +1378,7 @@ namespace v2rayN.Handler
} }
catch catch
{ {
msg = UIRes.I18N("IncorrectClientConfiguration"); msg = ResUI.IncorrectClientConfiguration;
return null; return null;
} }
return vmessItem; return vmessItem;
@@ -1417,25 +1419,25 @@ namespace v2rayN.Handler
{ {
if (config == null) if (config == null)
{ {
msg = UIRes.I18N("CheckServerSettings"); msg = ResUI.CheckServerSettings;
return ""; return "";
} }
msg = UIRes.I18N("InitialConfiguration"); msg = ResUI.InitialConfiguration;
Config configCopy = Utils.DeepCopy(config); Config configCopy = Utils.DeepCopy(config);
string result = Utils.GetEmbedText(SampleClient); string result = Utils.GetEmbedText(SampleClient);
if (Utils.IsNullOrEmpty(result)) if (Utils.IsNullOrEmpty(result))
{ {
msg = UIRes.I18N("FailedGetDefaultConfiguration"); msg = ResUI.FailedGetDefaultConfiguration;
return ""; return "";
} }
V2rayConfig v2rayConfig = Utils.FromJson<V2rayConfig>(result); V2rayConfig v2rayConfig = Utils.FromJson<V2rayConfig>(result);
if (v2rayConfig == null) if (v2rayConfig == null)
{ {
msg = UIRes.I18N("FailedGenDefaultConfiguration"); msg = ResUI.FailedGenDefaultConfiguration;
return ""; return "";
} }
List<IPEndPoint> lstIpEndPoints = null; List<IPEndPoint> lstIpEndPoints = null;
@@ -1516,12 +1518,12 @@ namespace v2rayN.Handler
v2rayConfig.routing.rules.Add(rule); v2rayConfig.routing.rules.Add(rule);
} }
//msg = string.Format(UIRes.I18N("SuccessfulConfiguration"), node.getSummary()); //msg = string.Format(ResUI.SuccessfulConfiguration"), node.getSummary());
return Utils.ToJson(v2rayConfig); return Utils.ToJson(v2rayConfig);
} }
catch catch
{ {
msg = UIRes.I18N("FailedGenDefaultConfiguration"); msg = ResUI.FailedGenDefaultConfiguration;
return ""; return "";
} }
} }

View File

@@ -4,6 +4,7 @@ using System.Diagnostics;
using System.IO; using System.IO;
using System.Text; using System.Text;
using v2rayN.Mode; using v2rayN.Mode;
using v2rayN.Resx;
namespace v2rayN.Handler namespace v2rayN.Handler
{ {
@@ -21,9 +22,7 @@ namespace v2rayN.Handler
class V2rayHandler class V2rayHandler
{ {
private static string v2rayConfigRes = Global.v2rayConfigFileName; private static string v2rayConfigRes = Global.v2rayConfigFileName;
private List<string> lstCore; private CoreInfo coreInfo;
private string coreUrl;
private string coreArguments;
public event ProcessDelegate ProcessEvent; public event ProcessDelegate ProcessEvent;
//private int processId = 0; //private int processId = 0;
private Process _process; private Process _process;
@@ -42,11 +41,15 @@ namespace v2rayN.Handler
var item = ConfigHandler.GetDefaultServer(ref config); var item = ConfigHandler.GetDefaultServer(ref config);
if (item == null) if (item == null)
{ {
ShowMsg(false, UIRes.I18N("CheckServerSettings")); ShowMsg(false, ResUI.CheckServerSettings);
return; return;
} }
SetCore(config, item); if (SetCore(config, item) != 0)
{
ShowMsg(false, ResUI.CheckServerSettings);
return;
}
string fileName = Utils.GetPath(v2rayConfigRes); string fileName = Utils.GetPath(v2rayConfigRes);
if (V2rayConfigHandler.GenerateClientConfig(item, fileName, false, out string msg) != 0) if (V2rayConfigHandler.GenerateClientConfig(item, fileName, false, out string msg) != 0)
{ {
@@ -106,7 +109,7 @@ namespace v2rayN.Handler
} }
else else
{ {
foreach (string vName in lstCore) foreach (string vName in coreInfo.coreExes)
{ {
Process[] existing = Process.GetProcessesByName(vName); Process[] existing = Process.GetProcessesByName(vName);
foreach (Process p in existing) foreach (Process p in existing)
@@ -178,7 +181,7 @@ namespace v2rayN.Handler
} }
if (Utils.IsNullOrEmpty(fileName)) if (Utils.IsNullOrEmpty(fileName))
{ {
string msg = string.Format(UIRes.I18N("NotFoundCore"), coreUrl); string msg = string.Format(ResUI.NotFoundCore, coreInfo.coreUrl);
ShowMsg(false, msg); ShowMsg(false, msg);
} }
return fileName; return fileName;
@@ -189,11 +192,11 @@ namespace v2rayN.Handler
/// </summary> /// </summary>
private void V2rayStart() private void V2rayStart()
{ {
ShowMsg(false, string.Format(UIRes.I18N("StartService"), DateTime.Now.ToString())); ShowMsg(false, string.Format(ResUI.StartService, DateTime.Now.ToString()));
try try
{ {
string fileName = V2rayFindexe(lstCore); string fileName = V2rayFindexe(coreInfo.coreExes);
if (fileName == "") return; if (fileName == "") return;
Process p = new Process Process p = new Process
@@ -201,7 +204,7 @@ namespace v2rayN.Handler
StartInfo = new ProcessStartInfo StartInfo = new ProcessStartInfo
{ {
FileName = fileName, FileName = fileName,
Arguments = coreArguments, Arguments = coreInfo.arguments,
WorkingDirectory = Utils.StartupPath(), WorkingDirectory = Utils.StartupPath(),
UseShellExecute = false, UseShellExecute = false,
RedirectStandardOutput = true, RedirectStandardOutput = true,
@@ -243,11 +246,10 @@ namespace v2rayN.Handler
/// </summary> /// </summary>
private int V2rayStartNew(string configStr) private int V2rayStartNew(string configStr)
{ {
ShowMsg(false, string.Format(UIRes.I18N("StartService"), DateTime.Now.ToString())); ShowMsg(false, string.Format(ResUI.StartService, DateTime.Now.ToString()));
try try
{ {
coreUrl = Global.xrayCoreUrl;
string fileName = V2rayFindexe(new List<string> { "xray" }); string fileName = V2rayFindexe(new List<string> { "xray" });
if (fileName == "") return -1; if (fileName == "") return -1;
@@ -325,44 +327,21 @@ namespace v2rayN.Handler
} }
} }
private void SetCore(Config config, VmessItem item) private int SetCore(Config config, VmessItem item)
{ {
if (item == null) if (item == null)
{ {
return; return -1;
} }
var coreType = LazyConfig.Instance.GetCoreType(item, item.configType); var coreType = LazyConfig.Instance.GetCoreType(item, item.configType);
if (coreType == ECoreType.v2fly) coreInfo = LazyConfig.Instance.GetCoreInfo(coreType);
if (coreInfo == null)
{ {
lstCore = new List<string> return -1;
{
"wv2ray",
"v2ray"
};
coreUrl = Global.v2flyCoreUrl;
coreArguments = string.Empty;
}
else if (coreType == ECoreType.Xray)
{
lstCore = new List<string>
{
"xray"
};
coreUrl = Global.xrayCoreUrl;
coreArguments = string.Empty;
}
else if (coreType == ECoreType.clash)
{
lstCore = new List<string>
{
"clash-windows-amd64",
"clash-windows-386",
"clash"
};
coreUrl = Global.clashCoreUrl;
coreArguments = "-f config.json";
} }
return 0;
} }
} }
} }

View File

@@ -3,7 +3,7 @@ using System.Collections.Generic;
using System.Windows.Forms; using System.Windows.Forms;
using v2rayN.Base; using v2rayN.Base;
using System.Linq; using System.Linq;
using System.Drawing;
namespace v2rayN.Mode namespace v2rayN.Mode
{ {
@@ -692,7 +692,9 @@ namespace v2rayN.Mode
get; set; get; set;
} }
public System.Drawing.Size mainSize public Point mainLocation { get; set; }
public Size mainSize
{ {
get; set; get; set;
} }

View File

@@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
namespace v2rayN.Mode
{
[Serializable]
public class CoreInfo
{
public ECoreType coreType { get; set; }
public List<string> coreExes { get; set; }
public string arguments { get; set; }
public string coreUrl { get; set; }
}
}

View File

@@ -5,6 +5,8 @@ namespace v2rayN.Mode
{ {
v2fly = 1, v2fly = 1,
Xray = 2, Xray = 2,
clash = 3 clash = 11,
hysteria = 21,
v2rayN = 99
} }
} }

View File

@@ -6,6 +6,7 @@ namespace v2rayN.Mode
Top = 1, Top = 1,
Up = 2, Up = 2,
Down = 3, Down = 3,
Bottom = 4 Bottom = 4,
Position = 5
} }
} }

View File

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

View File

@@ -1,26 +0,0 @@
using System.Collections.Generic;
using System.Reflection;
using System.Resources;
namespace v2rayN
{
public class UIRes
{
static ResourceManager res = new ResourceManager("v2rayN.Resx.ResUI", Assembly.GetExecutingAssembly());
static string LoadString(ResourceManager resMgr, string key)
{
string value = resMgr.GetString(key);
if (value == null)
{
throw new KeyNotFoundException($"key: {key}");
}
return value;
}
public static string I18N(string key)
{
return LoadString(res, key);
}
}
}

View File

@@ -219,6 +219,26 @@ namespace v2rayN
} }
} }
/// <summary>
/// 逗号分隔的字符串,先排序后转List<string>
/// </summary>
/// <param name="str"></param>
/// <returns></returns>
public static List<string> String2ListSorted(string str)
{
try
{
str = str.Replace(Environment.NewLine, "");
List<string> list = new List<string>(str.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries));
return list.OrderBy(x => x).ToList();
}
catch (Exception ex)
{
SaveLog(ex.Message, ex);
return new List<string>();
}
}
/// <summary> /// <summary>
/// Base64编码 /// Base64编码
/// </summary> /// </summary>
@@ -370,7 +390,8 @@ namespace v2rayN
public static string UrlEncode(string url) public static string UrlEncode(string url)
{ {
return HttpUtility.UrlEncode(url); return Uri.EscapeDataString(url);
//return HttpUtility.UrlEncode(url);
} }
public static string UrlDecode(string url) public static string UrlDecode(string url)
{ {

View File

@@ -208,6 +208,7 @@
<Compile Include="Mode\RoutingItem.cs" /> <Compile Include="Mode\RoutingItem.cs" />
<Compile Include="Mode\RulesItem.cs" /> <Compile Include="Mode\RulesItem.cs" />
<Compile Include="Mode\ServerStatistics.cs" /> <Compile Include="Mode\ServerStatistics.cs" />
<Compile Include="Mode\CoreInfo.cs" />
<Compile Include="Mode\SysproxyConfig.cs" /> <Compile Include="Mode\SysproxyConfig.cs" />
<Compile Include="Mode\EConfigType.cs" /> <Compile Include="Mode\EConfigType.cs" />
<Compile Include="Mode\ServerTestItem.cs" /> <Compile Include="Mode\ServerTestItem.cs" />
@@ -261,7 +262,6 @@
<Compile Include="Tool\Job.cs" /> <Compile Include="Tool\Job.cs" />
<Compile Include="Tool\Logging.cs" /> <Compile Include="Tool\Logging.cs" />
<Compile Include="Tool\QueryableExtension.cs" /> <Compile Include="Tool\QueryableExtension.cs" />
<Compile Include="Tool\UIRes.cs" />
<Compile Include="Tool\UI.cs" /> <Compile Include="Tool\UI.cs" />
<Compile Include="Tool\Utils.cs" /> <Compile Include="Tool\Utils.cs" />
<Compile Include="Handler\V2rayConfigHandler.cs" /> <Compile Include="Handler\V2rayConfigHandler.cs" />