Compare commits
30 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b919422ec4 | ||
|
|
a8bc9ce605 | ||
|
|
e2f399eeb1 | ||
|
|
82924278b5 | ||
|
|
bb828a4e06 | ||
|
|
74933ac146 | ||
|
|
0d315f0dc3 | ||
|
|
372ee346dc | ||
|
|
cb462ab944 | ||
|
|
606da79372 | ||
|
|
0801c3db64 | ||
|
|
35deb0c915 | ||
|
|
fd4d712688 | ||
|
|
354fc618b0 | ||
|
|
82b6ee5ad2 | ||
|
|
645e6c4ec0 | ||
|
|
cdc83bc9d7 | ||
|
|
70feacd276 | ||
|
|
ece4572058 | ||
|
|
4d16a5e801 | ||
|
|
1493a8b03f | ||
|
|
d20791bf73 | ||
|
|
7bb91f57ac | ||
|
|
b7a6004830 | ||
|
|
dee5613f2f | ||
|
|
e58e0d6ac7 | ||
|
|
a2679e009d | ||
|
|
78d6bcd57a | ||
|
|
026936c92f | ||
|
|
5e5893362c |
@@ -1,12 +1,18 @@
|
|||||||
# v2rayN
|
# v2rayN
|
||||||
A V2Ray client for Windows, support [Xray core](https://github.com/XTLS/Xray-core) and [v2fly core](https://github.com/v2fly/v2ray-core)
|
A V2Ray client for Windows, support [Xray core](https://github.com/XTLS/Xray-core) and [v2fly core](https://github.com/v2fly/v2ray-core)
|
||||||
|
|
||||||
|
|
||||||
|
[](https://github.com/2dust/v2rayN/commits/master)
|
||||||
|
[](https://www.codefactor.io/repository/github/2dust/v2rayn)
|
||||||
|
[](https://github.com/2dust/v2rayN/releases)
|
||||||
|
[](https://t.me/v2rayn)
|
||||||
|
|
||||||
### How to use
|
### How to use
|
||||||
- If you are newbie please download v2rayN-Core.zip from releases
|
- If you are newbie please download v2rayN-Core.zip from releases
|
||||||
- Otherwise please download v2rayN.zip (Also need to download v2ray core in the same folder)
|
- Otherwise please download v2rayN.zip (Also need to download v2ray core in the same folder)
|
||||||
- Run v2rayN.exe
|
- Run v2rayN.exe
|
||||||
|
|
||||||
### Requirements
|
### Requirements
|
||||||
- Microsoft [.NET Framework 4.8](https://docs.microsoft.com/zh-cn/dotnet/framework/install/guide-for-developers)
|
- Microsoft [.NET Framework 4.8](https://dotnet.microsoft.com/zh-cn/download/dotnet-framework/thank-you/net48-web-installer)
|
||||||
- v2fly core [https://github.com/v2fly/v2ray-core/releases](https://github.com/v2fly/v2ray-core/releases)
|
- v2fly core [https://github.com/v2fly/v2ray-core/releases](https://github.com/v2fly/v2ray-core/releases)
|
||||||
- Xray core [https://github.com/XTLS/Xray-core/releases](https://github.com/XTLS/Xray-core/releases)
|
- Xray core [https://github.com/XTLS/Xray-core/releases](https://github.com/XTLS/Xray-core/releases)
|
||||||
|
|||||||
@@ -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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -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
|
||||||
{
|
{
|
||||||
@@ -18,6 +19,8 @@ namespace v2rayN.Forms
|
|||||||
private void AddServer2Form_Load(object sender, EventArgs e)
|
private void AddServer2Form_Load(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
cmbCoreType.Items.AddRange(Global.coreTypes.ToArray());
|
cmbCoreType.Items.AddRange(Global.coreTypes.ToArray());
|
||||||
|
cmbCoreType.Items.Add("clash");
|
||||||
|
cmbCoreType.Items.Add("hysteria");
|
||||||
cmbCoreType.Items.Add(string.Empty);
|
cmbCoreType.Items.Add(string.Empty);
|
||||||
|
|
||||||
txtAddress.ReadOnly = true;
|
txtAddress.ReadOnly = true;
|
||||||
@@ -65,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;
|
||||||
@@ -89,7 +92,7 @@ namespace v2rayN.Forms
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
UI.ShowWarning(UIRes.I18N("OperationFailed"));
|
UI.ShowWarning(ResUI.OperationFailed);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -107,12 +110,12 @@ 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
|
||||||
{
|
{
|
||||||
Multiselect = false,
|
Multiselect = false,
|
||||||
Filter = "Config|*.json|All|*.*"
|
Filter = "Config|*.json|YAML|*.yaml|All|*.*"
|
||||||
};
|
};
|
||||||
if (fileDialog.ShowDialog() != DialogResult.OK)
|
if (fileDialog.ShowDialog() != DialogResult.OK)
|
||||||
{
|
{
|
||||||
@@ -127,14 +130,14 @@ namespace v2rayN.Forms
|
|||||||
vmessItem.address = fileName;
|
vmessItem.address = fileName;
|
||||||
vmessItem.remarks = txtRemarks.Text;
|
vmessItem.remarks = txtRemarks.Text;
|
||||||
|
|
||||||
if (ConfigHandler.AddCustomServer(ref config, vmessItem) == 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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -143,11 +146,11 @@ 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;
|
||||||
}
|
}
|
||||||
|
|
||||||
address = Path.Combine(Utils.GetTempPath(), address);
|
address = Path.Combine(Utils.GetConfigPath(), address);
|
||||||
Process.Start(address);
|
Process.Start(address);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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
|
||||||
{
|
{
|
||||||
@@ -16,13 +17,7 @@ namespace v2rayN.Forms
|
|||||||
private void AddServerForm_Load(object sender, EventArgs e)
|
private void AddServerForm_Load(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
this.Text = (eConfigType).ToString();
|
this.Text = (eConfigType).ToString();
|
||||||
|
|
||||||
cmbSecurity.Items.AddRange(Global.vmessSecuritys.ToArray());
|
|
||||||
cmbSecurity3.Items.AddRange(config.GetShadowsocksSecuritys().ToArray());
|
|
||||||
|
|
||||||
cmbFlow5.Items.AddRange(Global.xtlsFlows.ToArray());
|
|
||||||
cmbFlow6.Items.AddRange(Global.xtlsFlows.ToArray());
|
|
||||||
|
|
||||||
cmbCoreType.Items.AddRange(Global.coreTypes.ToArray());
|
cmbCoreType.Items.AddRange(Global.coreTypes.ToArray());
|
||||||
cmbCoreType.Items.Add(string.Empty);
|
cmbCoreType.Items.Add(string.Empty);
|
||||||
|
|
||||||
@@ -31,12 +26,16 @@ namespace v2rayN.Forms
|
|||||||
case EConfigType.Vmess:
|
case EConfigType.Vmess:
|
||||||
panVmess.Dock = DockStyle.Fill;
|
panVmess.Dock = DockStyle.Fill;
|
||||||
panVmess.Visible = true;
|
panVmess.Visible = true;
|
||||||
|
|
||||||
|
cmbSecurity.Items.AddRange(Global.vmessSecuritys.ToArray());
|
||||||
break;
|
break;
|
||||||
case EConfigType.Shadowsocks:
|
case EConfigType.Shadowsocks:
|
||||||
panSs.Dock = DockStyle.Fill;
|
panSs.Dock = DockStyle.Fill;
|
||||||
panSs.Visible = true;
|
panSs.Visible = true;
|
||||||
panTran.Visible = false;
|
panTran.Visible = false;
|
||||||
this.Height = this.Height - panTran.Height;
|
this.Height = this.Height - panTran.Height;
|
||||||
|
|
||||||
|
cmbSecurity3.Items.AddRange(LazyConfig.Instance.GetShadowsocksSecuritys().ToArray());
|
||||||
break;
|
break;
|
||||||
case EConfigType.Socks:
|
case EConfigType.Socks:
|
||||||
panSocks.Dock = DockStyle.Fill;
|
panSocks.Dock = DockStyle.Fill;
|
||||||
@@ -48,11 +47,15 @@ namespace v2rayN.Forms
|
|||||||
panVless.Dock = DockStyle.Fill;
|
panVless.Dock = DockStyle.Fill;
|
||||||
panVless.Visible = true;
|
panVless.Visible = true;
|
||||||
transportControl.AllowXtls = true;
|
transportControl.AllowXtls = true;
|
||||||
|
|
||||||
|
cmbFlow5.Items.AddRange(Global.xtlsFlows.ToArray());
|
||||||
break;
|
break;
|
||||||
case EConfigType.Trojan:
|
case EConfigType.Trojan:
|
||||||
panTrojan.Dock = DockStyle.Fill;
|
panTrojan.Dock = DockStyle.Fill;
|
||||||
panTrojan.Visible = true;
|
panTrojan.Visible = true;
|
||||||
transportControl.AllowXtls = true;
|
transportControl.AllowXtls = true;
|
||||||
|
|
||||||
|
cmbFlow6.Items.AddRange(Global.xtlsFlows.ToArray());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -192,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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -217,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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -268,7 +271,7 @@ namespace v2rayN.Forms
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
UI.ShowWarning(UIRes.I18N("OperationFailed"));
|
UI.ShowWarning(ResUI.OperationFailed);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
26
v2rayN/v2rayN/Forms/MainForm.Designer.cs
generated
26
v2rayN/v2rayN/Forms/MainForm.Designer.cs
generated
@@ -47,6 +47,7 @@
|
|||||||
this.menuCopyServer = new System.Windows.Forms.ToolStripMenuItem();
|
this.menuCopyServer = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.menuSetDefaultServer = new System.Windows.Forms.ToolStripMenuItem();
|
this.menuSetDefaultServer = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.toolStripSeparator3 = new System.Windows.Forms.ToolStripSeparator();
|
this.toolStripSeparator3 = new System.Windows.Forms.ToolStripSeparator();
|
||||||
|
this.menuMoveToGroup = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.menuMoveTop = new System.Windows.Forms.ToolStripMenuItem();
|
this.menuMoveTop = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.menuMoveUp = new System.Windows.Forms.ToolStripMenuItem();
|
this.menuMoveUp = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.menuMoveDown = new System.Windows.Forms.ToolStripMenuItem();
|
this.menuMoveDown = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
@@ -64,9 +65,9 @@
|
|||||||
this.menuExport2ServerConfig = new System.Windows.Forms.ToolStripMenuItem();
|
this.menuExport2ServerConfig = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.menuExport2ShareUrl = new System.Windows.Forms.ToolStripMenuItem();
|
this.menuExport2ShareUrl = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.menuExport2SubContent = new System.Windows.Forms.ToolStripMenuItem();
|
this.menuExport2SubContent = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
|
this.tsbServer = new System.Windows.Forms.ToolStripDropDownButton();
|
||||||
this.tabGroup = new System.Windows.Forms.TabControl();
|
this.tabGroup = new System.Windows.Forms.TabControl();
|
||||||
this.qrCodeControl = new v2rayN.Forms.QRCodeControl();
|
this.qrCodeControl = new v2rayN.Forms.QRCodeControl();
|
||||||
this.tsbServer = new System.Windows.Forms.ToolStripDropDownButton();
|
|
||||||
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
|
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
|
||||||
this.groupBox1 = new System.Windows.Forms.GroupBox();
|
this.groupBox1 = new System.Windows.Forms.GroupBox();
|
||||||
this.gbMsgTitle = new System.Windows.Forms.GroupBox();
|
this.gbMsgTitle = new System.Windows.Forms.GroupBox();
|
||||||
@@ -208,6 +209,7 @@
|
|||||||
this.menuCopyServer,
|
this.menuCopyServer,
|
||||||
this.menuSetDefaultServer,
|
this.menuSetDefaultServer,
|
||||||
this.toolStripSeparator3,
|
this.toolStripSeparator3,
|
||||||
|
this.menuMoveToGroup,
|
||||||
this.menuMoveTop,
|
this.menuMoveTop,
|
||||||
this.menuMoveUp,
|
this.menuMoveUp,
|
||||||
this.menuMoveDown,
|
this.menuMoveDown,
|
||||||
@@ -226,6 +228,7 @@
|
|||||||
this.menuExport2ShareUrl,
|
this.menuExport2ShareUrl,
|
||||||
this.menuExport2SubContent});
|
this.menuExport2SubContent});
|
||||||
this.cmsLv.Name = "cmsLv";
|
this.cmsLv.Name = "cmsLv";
|
||||||
|
this.cmsLv.OwnerItem = this.tsbServer;
|
||||||
resources.ApplyResources(this.cmsLv, "cmsLv");
|
resources.ApplyResources(this.cmsLv, "cmsLv");
|
||||||
//
|
//
|
||||||
// menuAddVmessServer
|
// menuAddVmessServer
|
||||||
@@ -310,6 +313,12 @@
|
|||||||
this.toolStripSeparator3.Name = "toolStripSeparator3";
|
this.toolStripSeparator3.Name = "toolStripSeparator3";
|
||||||
resources.ApplyResources(this.toolStripSeparator3, "toolStripSeparator3");
|
resources.ApplyResources(this.toolStripSeparator3, "toolStripSeparator3");
|
||||||
//
|
//
|
||||||
|
// menuMoveToGroup
|
||||||
|
//
|
||||||
|
this.menuMoveToGroup.Name = "menuMoveToGroup";
|
||||||
|
resources.ApplyResources(this.menuMoveToGroup, "menuMoveToGroup");
|
||||||
|
this.menuMoveToGroup.Click += new System.EventHandler(this.menuMoveToGroup_Click);
|
||||||
|
//
|
||||||
// menuMoveTop
|
// menuMoveTop
|
||||||
//
|
//
|
||||||
this.menuMoveTop.Name = "menuMoveTop";
|
this.menuMoveTop.Name = "menuMoveTop";
|
||||||
@@ -410,6 +419,13 @@
|
|||||||
resources.ApplyResources(this.menuExport2SubContent, "menuExport2SubContent");
|
resources.ApplyResources(this.menuExport2SubContent, "menuExport2SubContent");
|
||||||
this.menuExport2SubContent.Click += new System.EventHandler(this.menuExport2SubContent_Click);
|
this.menuExport2SubContent.Click += new System.EventHandler(this.menuExport2SubContent_Click);
|
||||||
//
|
//
|
||||||
|
// tsbServer
|
||||||
|
//
|
||||||
|
this.tsbServer.DropDown = this.cmsLv;
|
||||||
|
this.tsbServer.Image = global::v2rayN.Properties.Resources.server;
|
||||||
|
resources.ApplyResources(this.tsbServer, "tsbServer");
|
||||||
|
this.tsbServer.Name = "tsbServer";
|
||||||
|
//
|
||||||
// tabGroup
|
// tabGroup
|
||||||
//
|
//
|
||||||
resources.ApplyResources(this.tabGroup, "tabGroup");
|
resources.ApplyResources(this.tabGroup, "tabGroup");
|
||||||
@@ -422,13 +438,6 @@
|
|||||||
resources.ApplyResources(this.qrCodeControl, "qrCodeControl");
|
resources.ApplyResources(this.qrCodeControl, "qrCodeControl");
|
||||||
this.qrCodeControl.Name = "qrCodeControl";
|
this.qrCodeControl.Name = "qrCodeControl";
|
||||||
//
|
//
|
||||||
// tsbServer
|
|
||||||
//
|
|
||||||
this.tsbServer.DropDown = this.cmsLv;
|
|
||||||
this.tsbServer.Image = global::v2rayN.Properties.Resources.server;
|
|
||||||
resources.ApplyResources(this.tsbServer, "tsbServer");
|
|
||||||
this.tsbServer.Name = "tsbServer";
|
|
||||||
//
|
|
||||||
// splitContainer1
|
// splitContainer1
|
||||||
//
|
//
|
||||||
resources.ApplyResources(this.splitContainer1, "splitContainer1");
|
resources.ApplyResources(this.splitContainer1, "splitContainer1");
|
||||||
@@ -1076,6 +1085,7 @@
|
|||||||
private System.Windows.Forms.ToolStripMenuItem tsbGlobalHotkeySetting;
|
private System.Windows.Forms.ToolStripMenuItem tsbGlobalHotkeySetting;
|
||||||
private System.Windows.Forms.TabControl tabGroup;
|
private System.Windows.Forms.TabControl tabGroup;
|
||||||
private System.Windows.Forms.ToolStripMenuItem tsbGroupSetting;
|
private System.Windows.Forms.ToolStripMenuItem tsbGroupSetting;
|
||||||
|
private System.Windows.Forms.ToolStripMenuItem menuMoveToGroup;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -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>
|
||||||
@@ -414,13 +435,6 @@ namespace v2rayN.Forms
|
|||||||
//qrCodeControl.showQRCode(index, config);
|
//qrCodeControl.showQRCode(index, config);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void DisplayToolStatus()
|
|
||||||
{
|
|
||||||
toolSslInboundInfo.Text = $"{Global.InboundSocks} {Global.Loopback}:{config.inbound[0].localPort} | "
|
|
||||||
+ $"{ Global.InboundHttp} { Global.Loopback}:{Global.httpPort}";
|
|
||||||
|
|
||||||
notifyMain.Icon = MainFormHandler.Instance.GetNotifyIcon(config, this.Icon);
|
|
||||||
}
|
|
||||||
private void ssMain_ItemClicked(object sender, ToolStripItemClickedEventArgs e)
|
private void ssMain_ItemClicked(object sender, ToolStripItemClickedEventArgs e)
|
||||||
{
|
{
|
||||||
if (!Utils.IsNullOrEmpty(e.ClickedItem.Text))
|
if (!Utils.IsNullOrEmpty(e.ClickedItem.Text))
|
||||||
@@ -472,7 +486,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);
|
||||||
@@ -485,6 +499,23 @@ namespace v2rayN.Forms
|
|||||||
}
|
}
|
||||||
|
|
||||||
tabGroup.SelectedIndex = 0;
|
tabGroup.SelectedIndex = 0;
|
||||||
|
|
||||||
|
//menuMoveToGroup
|
||||||
|
menuMoveToGroup.DropDownItems.Clear();
|
||||||
|
|
||||||
|
List<ToolStripMenuItem> lst = new List<ToolStripMenuItem>();
|
||||||
|
foreach (var item in config.groupItem)
|
||||||
|
{
|
||||||
|
string name = item.remarks;
|
||||||
|
|
||||||
|
ToolStripMenuItem ts = new ToolStripMenuItem(name)
|
||||||
|
{
|
||||||
|
Tag = item.id,
|
||||||
|
};
|
||||||
|
ts.Click += new EventHandler(ts_Group_Click);
|
||||||
|
lst.Add(ts);
|
||||||
|
}
|
||||||
|
menuMoveToGroup.DropDownItems.AddRange(lst.ToArray());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void tabGroup_SelectedIndexChanged(object sender, EventArgs e)
|
private void tabGroup_SelectedIndexChanged(object sender, EventArgs e)
|
||||||
@@ -501,6 +532,29 @@ namespace v2rayN.Forms
|
|||||||
|
|
||||||
lvServers.Focus();
|
lvServers.Focus();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void ts_Group_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
ToolStripItem ts = (ToolStripItem)sender;
|
||||||
|
var groupIdSelected = Utils.ToString(ts.Tag);
|
||||||
|
|
||||||
|
int index = GetLvSelectedIndex();
|
||||||
|
if (index < 0)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ConfigHandler.MoveServerToGroup(config, lstSelecteds, groupIdSelected) == 0)
|
||||||
|
{
|
||||||
|
RefreshServers();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region v2ray 操作
|
#region v2ray 操作
|
||||||
@@ -586,7 +640,7 @@ namespace v2rayN.Forms
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
fm = new AddServerForm();
|
fm = new AddServerForm();
|
||||||
}
|
}
|
||||||
fm.vmessItem = index >= 0 ? lstVmess[index] : null;
|
fm.vmessItem = index >= 0 ? lstVmess[index] : null;
|
||||||
fm.groupId = groupId;
|
fm.groupId = groupId;
|
||||||
fm.eConfigType = configType;
|
fm.eConfigType = configType;
|
||||||
@@ -674,7 +728,7 @@ namespace v2rayN.Forms
|
|||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (UI.ShowYesNo(UIRes.I18N("RemoveServer")) == DialogResult.No)
|
if (UI.ShowYesNo(ResUI.RemoveServer) == DialogResult.No)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -688,11 +742,10 @@ namespace v2rayN.Forms
|
|||||||
private void menuRemoveDuplicateServer_Click(object sender, EventArgs e)
|
private void menuRemoveDuplicateServer_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
int oldCount = lstVmess.Count;
|
int oldCount = lstVmess.Count;
|
||||||
ConfigHandler.DedupServerList(ref config, ref lstVmess);
|
int newCount = ConfigHandler.DedupServerList(ref config, ref lstVmess);
|
||||||
int newCount = lstVmess.Count;
|
|
||||||
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)
|
||||||
@@ -721,50 +774,50 @@ namespace v2rayN.Forms
|
|||||||
|
|
||||||
private void menuPingServer_Click(object sender, EventArgs e)
|
private void menuPingServer_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
Speedtest("ping");
|
Speedtest(ESpeedActionType.Ping);
|
||||||
}
|
}
|
||||||
private void menuTcpingServer_Click(object sender, EventArgs e)
|
private void menuTcpingServer_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
Speedtest("tcping");
|
Speedtest(ESpeedActionType.Tcping);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void menuRealPingServer_Click(object sender, EventArgs e)
|
private void menuRealPingServer_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
//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("realping");
|
Speedtest(ESpeedActionType.Realping);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void menuSpeedServer_Click(object sender, EventArgs e)
|
private void menuSpeedServer_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
//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("speedtest");
|
Speedtest(ESpeedActionType.Speedtest);
|
||||||
}
|
}
|
||||||
private void Speedtest(string actionType)
|
private void Speedtest(ESpeedActionType actionType)
|
||||||
{
|
{
|
||||||
if (GetLvSelectedIndex() < 0) return;
|
if (GetLvSelectedIndex() < 0) return;
|
||||||
ClearTestResult();
|
ClearTestResult();
|
||||||
SpeedtestHandler statistics = new SpeedtestHandler(ref config, ref v2rayHandler, lstSelecteds, actionType, UpdateSpeedtestHandler);
|
SpeedtestHandler statistics = new SpeedtestHandler(ref config, v2rayHandler, lstSelecteds, actionType, UpdateSpeedtestHandler);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void tsbTestMe_Click(object sender, EventArgs e)
|
private void tsbTestMe_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
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)
|
||||||
@@ -805,8 +858,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"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -828,7 +881,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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -898,7 +951,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)
|
||||||
@@ -921,7 +974,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;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -964,11 +1017,11 @@ namespace v2rayN.Forms
|
|||||||
private void menuAddServers_Click(object sender, EventArgs e)
|
private void menuAddServers_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
string clipboardData = Utils.GetClipboardData();
|
string clipboardData = Utils.GetClipboardData();
|
||||||
int ret = MainFormHandler.Instance.AddBatchServers(config, clipboardData, "", groupId);
|
int ret = ConfigHandler.AddBatchServers(ref config, clipboardData, "", groupId);
|
||||||
if (ret > 0)
|
if (ret > 0)
|
||||||
{
|
{
|
||||||
RefreshServers();
|
RefreshServers();
|
||||||
UI.Show(string.Format(UIRes.I18N("SuccessfullyImportedServerViaClipboard"), ret));
|
UI.Show(string.Format(ResUI.SuccessfullyImportedServerViaClipboard, ret));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -990,15 +1043,15 @@ namespace v2rayN.Forms
|
|||||||
|
|
||||||
if (Utils.IsNullOrEmpty(result))
|
if (Utils.IsNullOrEmpty(result))
|
||||||
{
|
{
|
||||||
UI.ShowWarning(UIRes.I18N("NoValidQRcodeFound"));
|
UI.ShowWarning(ResUI.NoValidQRcodeFound);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
int ret = MainFormHandler.Instance.AddBatchServers(config, result, "", groupId);
|
int ret = ConfigHandler.AddBatchServers(ref config, result, "", groupId);
|
||||||
if (ret > 0)
|
if (ret > 0)
|
||||||
{
|
{
|
||||||
RefreshServers();
|
RefreshServers();
|
||||||
UI.Show(UIRes.I18N("SuccessfullyImportedServerViaScan"));
|
UI.Show(ResUI.SuccessfullyImportedServerViaScan);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1200,7 +1253,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);
|
||||||
@@ -1264,7 +1338,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)
|
||||||
@@ -1281,7 +1355,9 @@ namespace v2rayN.Forms
|
|||||||
item.Selected = true;
|
item.Selected = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
private void menuMoveToGroup_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region 系统代理相关
|
#region 系统代理相关
|
||||||
@@ -1318,6 +1394,23 @@ namespace v2rayN.Forms
|
|||||||
DisplayToolStatus();
|
DisplayToolStatus();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void DisplayToolStatus()
|
||||||
|
{
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
sb.Append($"{Global.InboundSocks} {Global.Loopback}:{config.GetLocalPort(Global.InboundSocks)}");
|
||||||
|
sb.Append(" | ");
|
||||||
|
sb.Append($"{Global.InboundHttp} {Global.Loopback}:{config.GetLocalPort(Global.InboundHttp)}");
|
||||||
|
|
||||||
|
if (config.sysProxyType == ESysProxyType.ForcedChange)
|
||||||
|
{
|
||||||
|
sb.Append(" | ");
|
||||||
|
sb.Append($"{ResUI.SystemProxy} {Global.Loopback}:{config.GetLocalPort(Global.InboundHttp2)}");
|
||||||
|
}
|
||||||
|
|
||||||
|
toolSslInboundInfo.Text = sb.ToString();
|
||||||
|
|
||||||
|
notifyMain.Icon = MainFormHandler.Instance.GetNotifyIcon(config, this.Icon);
|
||||||
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
@@ -1338,15 +1431,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)
|
||||||
{
|
{
|
||||||
@@ -1358,12 +1451,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);
|
||||||
@@ -1605,7 +1698,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
|
||||||
|
|||||||
@@ -206,6 +206,12 @@
|
|||||||
<data name="toolStripSeparator3.Size" type="System.Drawing.Size, System.Drawing">
|
<data name="toolStripSeparator3.Size" type="System.Drawing.Size, System.Drawing">
|
||||||
<value>352, 6</value>
|
<value>352, 6</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="menuMoveToGroup.Size" type="System.Drawing.Size, System.Drawing">
|
||||||
|
<value>355, 22</value>
|
||||||
|
</data>
|
||||||
|
<data name="menuMoveToGroup.Text" xml:space="preserve">
|
||||||
|
<value>Move to Group</value>
|
||||||
|
</data>
|
||||||
<data name="menuMoveTop.Size" type="System.Drawing.Size, System.Drawing">
|
<data name="menuMoveTop.Size" type="System.Drawing.Size, System.Drawing">
|
||||||
<value>355, 22</value>
|
<value>355, 22</value>
|
||||||
</data>
|
</data>
|
||||||
@@ -302,8 +308,20 @@
|
|||||||
<data name="menuExport2SubContent.Text" xml:space="preserve">
|
<data name="menuExport2SubContent.Text" xml:space="preserve">
|
||||||
<value>Export subscription (base64) share to clipboard</value>
|
<value>Export subscription (base64) share to clipboard</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="tsbServer.ImageTransparentColor" type="System.Drawing.Color, System.Drawing">
|
||||||
|
<value>Magenta</value>
|
||||||
|
</data>
|
||||||
|
<data name="tsbServer.Size" type="System.Drawing.Size, System.Drawing">
|
||||||
|
<value>64, 53</value>
|
||||||
|
</data>
|
||||||
|
<data name="tsbServer.Text" xml:space="preserve">
|
||||||
|
<value>Servers</value>
|
||||||
|
</data>
|
||||||
|
<data name="tsbServer.TextImageRelation" type="System.Windows.Forms.TextImageRelation, System.Windows.Forms">
|
||||||
|
<value>ImageAboveText</value>
|
||||||
|
</data>
|
||||||
<data name="cmsLv.Size" type="System.Drawing.Size, System.Drawing">
|
<data name="cmsLv.Size" type="System.Drawing.Size, System.Drawing">
|
||||||
<value>356, 622</value>
|
<value>356, 666</value>
|
||||||
</data>
|
</data>
|
||||||
<data name=">>cmsLv.Name" xml:space="preserve">
|
<data name=">>cmsLv.Name" xml:space="preserve">
|
||||||
<value>cmsLv</value>
|
<value>cmsLv</value>
|
||||||
@@ -452,18 +470,6 @@
|
|||||||
<data name=">>scMain.ZOrder" xml:space="preserve">
|
<data name=">>scMain.ZOrder" xml:space="preserve">
|
||||||
<value>0</value>
|
<value>0</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="tsbServer.ImageTransparentColor" type="System.Drawing.Color, System.Drawing">
|
|
||||||
<value>Magenta</value>
|
|
||||||
</data>
|
|
||||||
<data name="tsbServer.Size" type="System.Drawing.Size, System.Drawing">
|
|
||||||
<value>64, 53</value>
|
|
||||||
</data>
|
|
||||||
<data name="tsbServer.Text" xml:space="preserve">
|
|
||||||
<value>Servers</value>
|
|
||||||
</data>
|
|
||||||
<data name="tsbServer.TextImageRelation" type="System.Windows.Forms.TextImageRelation, System.Windows.Forms">
|
|
||||||
<value>ImageAboveText</value>
|
|
||||||
</data>
|
|
||||||
<data name="splitContainer1.Dock" type="System.Windows.Forms.DockStyle, System.Windows.Forms">
|
<data name="splitContainer1.Dock" type="System.Windows.Forms.DockStyle, System.Windows.Forms">
|
||||||
<value>Fill</value>
|
<value>Fill</value>
|
||||||
</data>
|
</data>
|
||||||
@@ -549,7 +555,7 @@
|
|||||||
<value>Set message filters</value>
|
<value>Set message filters</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="cmsMsgBox.Size" type="System.Drawing.Size, System.Drawing">
|
<data name="cmsMsgBox.Size" type="System.Drawing.Size, System.Drawing">
|
||||||
<value>228, 158</value>
|
<value>228, 136</value>
|
||||||
</data>
|
</data>
|
||||||
<data name=">>cmsMsgBox.Name" xml:space="preserve">
|
<data name=">>cmsMsgBox.Name" xml:space="preserve">
|
||||||
<value>cmsMsgBox</value>
|
<value>cmsMsgBox</value>
|
||||||
@@ -792,7 +798,7 @@
|
|||||||
<value>264, 22</value>
|
<value>264, 22</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="menuUpdateSubscriptions.Text" xml:space="preserve">
|
<data name="menuUpdateSubscriptions.Text" xml:space="preserve">
|
||||||
<value>Update subscriptions</value>
|
<value>Update subscription without proxy</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="menuUpdateSubViaProxy.Size" type="System.Drawing.Size, System.Drawing">
|
<data name="menuUpdateSubViaProxy.Size" type="System.Drawing.Size, System.Drawing">
|
||||||
<value>264, 22</value>
|
<value>264, 22</value>
|
||||||
@@ -864,13 +870,13 @@
|
|||||||
<value>182, 22</value>
|
<value>182, 22</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="tsbSubUpdate.Text" xml:space="preserve">
|
<data name="tsbSubUpdate.Text" xml:space="preserve">
|
||||||
<value>Updates</value>
|
<value>Update subscription without proxy</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="tsbSubUpdateViaProxy.Size" type="System.Drawing.Size, System.Drawing">
|
<data name="tsbSubUpdateViaProxy.Size" type="System.Drawing.Size, System.Drawing">
|
||||||
<value>182, 22</value>
|
<value>182, 22</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="tsbSubUpdateViaProxy.Text" xml:space="preserve">
|
<data name="tsbSubUpdateViaProxy.Text" xml:space="preserve">
|
||||||
<value>Updates via proxy</value>
|
<value>Update subscription with proxy</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="tsbSub.ImageTransparentColor" type="System.Drawing.Color, System.Drawing">
|
<data name="tsbSub.ImageTransparentColor" type="System.Drawing.Color, System.Drawing">
|
||||||
<value>Magenta</value>
|
<value>Magenta</value>
|
||||||
@@ -1205,6 +1211,12 @@
|
|||||||
<data name=">>toolStripSeparator3.Type" xml:space="preserve">
|
<data name=">>toolStripSeparator3.Type" xml:space="preserve">
|
||||||
<value>System.Windows.Forms.ToolStripSeparator, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
<value>System.Windows.Forms.ToolStripSeparator, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name=">>menuMoveToGroup.Name" xml:space="preserve">
|
||||||
|
<value>menuMoveToGroup</value>
|
||||||
|
</data>
|
||||||
|
<data name=">>menuMoveToGroup.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=">>menuMoveTop.Name" xml:space="preserve">
|
<data name=">>menuMoveTop.Name" xml:space="preserve">
|
||||||
<value>menuMoveTop</value>
|
<value>menuMoveTop</value>
|
||||||
</data>
|
</data>
|
||||||
|
|||||||
@@ -421,7 +421,7 @@
|
|||||||
<value>260, 22</value>
|
<value>260, 22</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="menuUpdateSubscriptions.Text" xml:space="preserve">
|
<data name="menuUpdateSubscriptions.Text" xml:space="preserve">
|
||||||
<value>更新订阅</value>
|
<value>更新订阅(不通过代理)</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="menuUpdateSubViaProxy.Size" type="System.Drawing.Size, System.Drawing">
|
<data name="menuUpdateSubViaProxy.Size" type="System.Drawing.Size, System.Drawing">
|
||||||
<value>260, 22</value>
|
<value>260, 22</value>
|
||||||
@@ -451,7 +451,7 @@
|
|||||||
<value>180, 22</value>
|
<value>180, 22</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="tsbSubUpdate.Text" xml:space="preserve">
|
<data name="tsbSubUpdate.Text" xml:space="preserve">
|
||||||
<value>更新订阅</value>
|
<value>更新订阅(不通过代理)</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="tsbSubUpdateViaProxy.Size" type="System.Drawing.Size, System.Drawing">
|
<data name="tsbSubUpdateViaProxy.Size" type="System.Drawing.Size, System.Drawing">
|
||||||
<value>180, 22</value>
|
<value>180, 22</value>
|
||||||
@@ -573,4 +573,7 @@
|
|||||||
<data name="tsbClose.Text" xml:space="preserve">
|
<data name="tsbClose.Text" xml:space="preserve">
|
||||||
<value> 关闭窗口 </value>
|
<value> 关闭窗口 </value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="menuMoveToGroup.Text" xml:space="preserve">
|
||||||
|
<value>移至分组</value>
|
||||||
|
</data>
|
||||||
</root>
|
</root>
|
||||||
26
v2rayN/v2rayN/Forms/MsgFilterSetForm.Designer.cs
generated
26
v2rayN/v2rayN/Forms/MsgFilterSetForm.Designer.cs
generated
@@ -34,14 +34,18 @@
|
|||||||
this.panel2 = new System.Windows.Forms.Panel();
|
this.panel2 = new System.Windows.Forms.Panel();
|
||||||
this.btnClose = new System.Windows.Forms.Button();
|
this.btnClose = new System.Windows.Forms.Button();
|
||||||
this.btnOK = new System.Windows.Forms.Button();
|
this.btnOK = new System.Windows.Forms.Button();
|
||||||
|
this.btnFilterDirect = new System.Windows.Forms.Button();
|
||||||
|
this.btnFilderProxy = new System.Windows.Forms.Button();
|
||||||
this.groupBox1.SuspendLayout();
|
this.groupBox1.SuspendLayout();
|
||||||
this.panel2.SuspendLayout();
|
this.panel2.SuspendLayout();
|
||||||
this.SuspendLayout();
|
this.SuspendLayout();
|
||||||
//
|
//
|
||||||
// groupBox1
|
// groupBox1
|
||||||
//
|
//
|
||||||
resources.ApplyResources(this.groupBox1, "groupBox1");
|
this.groupBox1.Controls.Add(this.btnFilderProxy);
|
||||||
|
this.groupBox1.Controls.Add(this.btnFilterDirect);
|
||||||
this.groupBox1.Controls.Add(this.txtMsgFilter);
|
this.groupBox1.Controls.Add(this.txtMsgFilter);
|
||||||
|
resources.ApplyResources(this.groupBox1, "groupBox1");
|
||||||
this.groupBox1.Name = "groupBox1";
|
this.groupBox1.Name = "groupBox1";
|
||||||
this.groupBox1.TabStop = false;
|
this.groupBox1.TabStop = false;
|
||||||
//
|
//
|
||||||
@@ -52,15 +56,15 @@
|
|||||||
//
|
//
|
||||||
// panel2
|
// panel2
|
||||||
//
|
//
|
||||||
resources.ApplyResources(this.panel2, "panel2");
|
|
||||||
this.panel2.Controls.Add(this.btnClose);
|
this.panel2.Controls.Add(this.btnClose);
|
||||||
this.panel2.Controls.Add(this.btnOK);
|
this.panel2.Controls.Add(this.btnOK);
|
||||||
|
resources.ApplyResources(this.panel2, "panel2");
|
||||||
this.panel2.Name = "panel2";
|
this.panel2.Name = "panel2";
|
||||||
//
|
//
|
||||||
// btnClose
|
// btnClose
|
||||||
//
|
//
|
||||||
resources.ApplyResources(this.btnClose, "btnClose");
|
|
||||||
this.btnClose.DialogResult = System.Windows.Forms.DialogResult.Cancel;
|
this.btnClose.DialogResult = System.Windows.Forms.DialogResult.Cancel;
|
||||||
|
resources.ApplyResources(this.btnClose, "btnClose");
|
||||||
this.btnClose.Name = "btnClose";
|
this.btnClose.Name = "btnClose";
|
||||||
this.btnClose.UseVisualStyleBackColor = true;
|
this.btnClose.UseVisualStyleBackColor = true;
|
||||||
this.btnClose.Click += new System.EventHandler(this.btnClose_Click);
|
this.btnClose.Click += new System.EventHandler(this.btnClose_Click);
|
||||||
@@ -72,6 +76,20 @@
|
|||||||
this.btnOK.UseVisualStyleBackColor = true;
|
this.btnOK.UseVisualStyleBackColor = true;
|
||||||
this.btnOK.Click += new System.EventHandler(this.btnOK_Click);
|
this.btnOK.Click += new System.EventHandler(this.btnOK_Click);
|
||||||
//
|
//
|
||||||
|
// btnFilterDirect
|
||||||
|
//
|
||||||
|
resources.ApplyResources(this.btnFilterDirect, "btnFilterDirect");
|
||||||
|
this.btnFilterDirect.Name = "btnFilterDirect";
|
||||||
|
this.btnFilterDirect.UseVisualStyleBackColor = true;
|
||||||
|
this.btnFilterDirect.Click += new System.EventHandler(this.btnFilterDirect_Click);
|
||||||
|
//
|
||||||
|
// btnFilderProxy
|
||||||
|
//
|
||||||
|
resources.ApplyResources(this.btnFilderProxy, "btnFilderProxy");
|
||||||
|
this.btnFilderProxy.Name = "btnFilderProxy";
|
||||||
|
this.btnFilderProxy.UseVisualStyleBackColor = true;
|
||||||
|
this.btnFilderProxy.Click += new System.EventHandler(this.btnFilderProxy_Click);
|
||||||
|
//
|
||||||
// MsgFilterSetForm
|
// MsgFilterSetForm
|
||||||
//
|
//
|
||||||
resources.ApplyResources(this, "$this");
|
resources.ApplyResources(this, "$this");
|
||||||
@@ -94,5 +112,7 @@
|
|||||||
private System.Windows.Forms.Panel panel2;
|
private System.Windows.Forms.Panel panel2;
|
||||||
private System.Windows.Forms.Button btnClose;
|
private System.Windows.Forms.Button btnClose;
|
||||||
private System.Windows.Forms.Button btnOK;
|
private System.Windows.Forms.Button btnOK;
|
||||||
|
private System.Windows.Forms.Button btnFilderProxy;
|
||||||
|
private System.Windows.Forms.Button btnFilterDirect;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -34,5 +34,15 @@ namespace v2rayN.Forms
|
|||||||
{
|
{
|
||||||
this.DialogResult = DialogResult.Cancel;
|
this.DialogResult = DialogResult.Cancel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void btnFilderProxy_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
txtMsgFilter.Text = "^(?!.*proxy).*$";
|
||||||
|
}
|
||||||
|
|
||||||
|
private void btnFilterDirect_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
txtMsgFilter.Text = "^(?!.*direct).*$";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -117,151 +117,226 @@
|
|||||||
<resheader name="writer">
|
<resheader name="writer">
|
||||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
</resheader>
|
</resheader>
|
||||||
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
|
||||||
<data name="groupBox1.Dock" type="System.Windows.Forms.DockStyle, System.Windows.Forms">
|
|
||||||
<value>Fill</value>
|
|
||||||
</data>
|
|
||||||
<data name=">>txtMsgFilter.ZOrder" xml:space="preserve">
|
|
||||||
<value>0</value>
|
|
||||||
</data>
|
|
||||||
<data name=">>txtMsgFilter.Name" xml:space="preserve">
|
|
||||||
<value>txtMsgFilter</value>
|
|
||||||
</data>
|
|
||||||
<data name="btnOK.Text" xml:space="preserve">
|
|
||||||
<value>&OK</value>
|
|
||||||
</data>
|
|
||||||
<data name="btnClose.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
|
|
||||||
<value>NoControl</value>
|
|
||||||
</data>
|
|
||||||
<data name="btnClose.Text" xml:space="preserve">
|
|
||||||
<value>&Cancel</value>
|
|
||||||
</data>
|
|
||||||
<data name=">>txtMsgFilter.Parent" xml:space="preserve">
|
|
||||||
<value>groupBox1</value>
|
|
||||||
</data>
|
|
||||||
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||||
<data name="txtMsgFilter.Location" type="System.Drawing.Point, System.Drawing">
|
<data name="btnFilderProxy.Location" type="System.Drawing.Point, System.Drawing">
|
||||||
<value>41, 29</value>
|
<value>157, 47</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="panel2.Size" type="System.Drawing.Size, System.Drawing">
|
<data name="btnFilderProxy.Size" type="System.Drawing.Size, System.Drawing">
|
||||||
<value>490, 60</value>
|
<value>95, 23</value>
|
||||||
</data>
|
</data>
|
||||||
<assembly alias="mscorlib" name="mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
<assembly alias="mscorlib" name="mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||||
<data name="txtMsgFilter.TabIndex" type="System.Int32, mscorlib">
|
<data name="btnFilderProxy.TabIndex" type="System.Int32, mscorlib">
|
||||||
<value>11</value>
|
<value>13</value>
|
||||||
</data>
|
</data>
|
||||||
<data name=">>$this.Type" xml:space="preserve">
|
<data name="btnFilderProxy.Text" xml:space="preserve">
|
||||||
<value>v2rayN.Forms.BaseForm, v2rayN, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null</value>
|
<value>Filter Proxy</value>
|
||||||
</data>
|
</data>
|
||||||
<data name=">>panel2.Name" xml:space="preserve">
|
<data name=">>btnFilderProxy.Name" xml:space="preserve">
|
||||||
<value>panel2</value>
|
<value>btnFilderProxy</value>
|
||||||
</data>
|
</data>
|
||||||
<data name=">>groupBox1.Parent" xml:space="preserve">
|
<data name=">>btnFilderProxy.Type" xml:space="preserve">
|
||||||
<value>$this</value>
|
|
||||||
</data>
|
|
||||||
<data name=">>btnOK.ZOrder" xml:space="preserve">
|
|
||||||
<value>1</value>
|
|
||||||
</data>
|
|
||||||
<data name="btnClose.Location" type="System.Drawing.Point, System.Drawing">
|
|
||||||
<value>396, 17</value>
|
|
||||||
</data>
|
|
||||||
<data name=">>btnClose.ZOrder" xml:space="preserve">
|
|
||||||
<value>0</value>
|
|
||||||
</data>
|
|
||||||
<data name=">>panel2.ZOrder" xml:space="preserve">
|
|
||||||
<value>1</value>
|
|
||||||
</data>
|
|
||||||
<data name=">>groupBox1.ZOrder" xml:space="preserve">
|
|
||||||
<value>0</value>
|
|
||||||
</data>
|
|
||||||
<data name="btnOK.Size" type="System.Drawing.Size, System.Drawing">
|
|
||||||
<value>75, 23</value>
|
|
||||||
</data>
|
|
||||||
<data name="panel2.TabIndex" type="System.Int32, mscorlib">
|
|
||||||
<value>9</value>
|
|
||||||
</data>
|
|
||||||
<data name="btnOK.TabIndex" type="System.Int32, mscorlib">
|
|
||||||
<value>5</value>
|
|
||||||
</data>
|
|
||||||
<data name=">>groupBox1.Name" xml:space="preserve">
|
|
||||||
<value>groupBox1</value>
|
|
||||||
</data>
|
|
||||||
<data name="groupBox1.TabIndex" type="System.Int32, mscorlib">
|
|
||||||
<value>8</value>
|
|
||||||
</data>
|
|
||||||
<data name=">>btnOK.Type" xml:space="preserve">
|
|
||||||
<value>System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
<value>System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
</data>
|
</data>
|
||||||
<data name=">>panel2.Type" xml:space="preserve">
|
<data name=">>btnFilderProxy.Parent" xml:space="preserve">
|
||||||
<value>System.Windows.Forms.Panel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
<value>groupBox1</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="btnOK.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
|
<data name=">>btnFilderProxy.ZOrder" xml:space="preserve">
|
||||||
|
<value>0</value>
|
||||||
|
</data>
|
||||||
|
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||||
|
<data name="btnFilterDirect.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
|
||||||
<value>NoControl</value>
|
<value>NoControl</value>
|
||||||
</data>
|
</data>
|
||||||
<data name=">>btnClose.Parent" xml:space="preserve">
|
<data name="btnFilterDirect.Location" type="System.Drawing.Point, System.Drawing">
|
||||||
<value>panel2</value>
|
<value>41, 47</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="btnClose.TabIndex" type="System.Int32, mscorlib">
|
<data name="btnFilterDirect.Size" type="System.Drawing.Size, System.Drawing">
|
||||||
<value>4</value>
|
<value>95, 23</value>
|
||||||
</data>
|
</data>
|
||||||
<data name=">>$this.Name" xml:space="preserve">
|
<data name="btnFilterDirect.TabIndex" type="System.Int32, mscorlib">
|
||||||
<value>MsgFilterSetForm</value>
|
<value>12</value>
|
||||||
|
</data>
|
||||||
|
<data name="btnFilterDirect.Text" xml:space="preserve">
|
||||||
|
<value>Filter Direct</value>
|
||||||
|
</data>
|
||||||
|
<data name=">>btnFilterDirect.Name" xml:space="preserve">
|
||||||
|
<value>btnFilterDirect</value>
|
||||||
|
</data>
|
||||||
|
<data name=">>btnFilterDirect.Type" xml:space="preserve">
|
||||||
|
<value>System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</data>
|
||||||
|
<data name=">>btnFilterDirect.Parent" xml:space="preserve">
|
||||||
|
<value>groupBox1</value>
|
||||||
|
</data>
|
||||||
|
<data name=">>btnFilterDirect.ZOrder" xml:space="preserve">
|
||||||
|
<value>1</value>
|
||||||
|
</data>
|
||||||
|
<data name="txtMsgFilter.Location" type="System.Drawing.Point, System.Drawing">
|
||||||
|
<value>41, 20</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="txtMsgFilter.Size" type="System.Drawing.Size, System.Drawing">
|
<data name="txtMsgFilter.Size" type="System.Drawing.Size, System.Drawing">
|
||||||
<value>409, 21</value>
|
<value>409, 21</value>
|
||||||
</data>
|
</data>
|
||||||
<data name=">>groupBox1.Type" xml:space="preserve">
|
<data name="txtMsgFilter.TabIndex" type="System.Int32, mscorlib">
|
||||||
<value>System.Windows.Forms.GroupBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
<value>11</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="groupBox1.Location" type="System.Drawing.Point, System.Drawing">
|
<data name=">>txtMsgFilter.Name" xml:space="preserve">
|
||||||
<value>0, 0</value>
|
<value>txtMsgFilter</value>
|
||||||
</data>
|
|
||||||
<data name="panel2.Location" type="System.Drawing.Point, System.Drawing">
|
|
||||||
<value>0, 76</value>
|
|
||||||
</data>
|
</data>
|
||||||
<data name=">>txtMsgFilter.Type" xml:space="preserve">
|
<data name=">>txtMsgFilter.Type" xml:space="preserve">
|
||||||
<value>System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
<value>System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="panel2.Dock" type="System.Windows.Forms.DockStyle, System.Windows.Forms">
|
<data name=">>txtMsgFilter.Parent" xml:space="preserve">
|
||||||
<value>Bottom</value>
|
<value>groupBox1</value>
|
||||||
|
</data>
|
||||||
|
<data name=">>txtMsgFilter.ZOrder" xml:space="preserve">
|
||||||
|
<value>2</value>
|
||||||
|
</data>
|
||||||
|
<data name="groupBox1.Dock" type="System.Windows.Forms.DockStyle, System.Windows.Forms">
|
||||||
|
<value>Fill</value>
|
||||||
|
</data>
|
||||||
|
<data name="groupBox1.Location" type="System.Drawing.Point, System.Drawing">
|
||||||
|
<value>0, 0</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="groupBox1.Size" type="System.Drawing.Size, System.Drawing">
|
<data name="groupBox1.Size" type="System.Drawing.Size, System.Drawing">
|
||||||
<value>490, 76</value>
|
<value>490, 76</value>
|
||||||
</data>
|
</data>
|
||||||
<data name=">>btnClose.Type" xml:space="preserve">
|
<data name="groupBox1.TabIndex" type="System.Int32, mscorlib">
|
||||||
<value>System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
<value>8</value>
|
||||||
</data>
|
|
||||||
<data name=">>btnClose.Name" xml:space="preserve">
|
|
||||||
<value>btnClose</value>
|
|
||||||
</data>
|
|
||||||
<data name=">>btnOK.Parent" xml:space="preserve">
|
|
||||||
<value>panel2</value>
|
|
||||||
</data>
|
</data>
|
||||||
<data name="groupBox1.Text" xml:space="preserve">
|
<data name="groupBox1.Text" xml:space="preserve">
|
||||||
<value>Filter</value>
|
<value>Filter</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name=">>groupBox1.Name" xml:space="preserve">
|
||||||
|
<value>groupBox1</value>
|
||||||
|
</data>
|
||||||
|
<data name=">>groupBox1.Type" xml:space="preserve">
|
||||||
|
<value>System.Windows.Forms.GroupBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</data>
|
||||||
|
<data name=">>groupBox1.Parent" xml:space="preserve">
|
||||||
|
<value>$this</value>
|
||||||
|
</data>
|
||||||
|
<data name=">>groupBox1.ZOrder" xml:space="preserve">
|
||||||
|
<value>0</value>
|
||||||
|
</data>
|
||||||
|
<data name=">>btnClose.Name" xml:space="preserve">
|
||||||
|
<value>btnClose</value>
|
||||||
|
</data>
|
||||||
|
<data name=">>btnClose.Type" xml:space="preserve">
|
||||||
|
<value>System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</data>
|
||||||
|
<data name=">>btnClose.Parent" xml:space="preserve">
|
||||||
|
<value>panel2</value>
|
||||||
|
</data>
|
||||||
|
<data name=">>btnClose.ZOrder" xml:space="preserve">
|
||||||
|
<value>0</value>
|
||||||
|
</data>
|
||||||
<data name=">>btnOK.Name" xml:space="preserve">
|
<data name=">>btnOK.Name" xml:space="preserve">
|
||||||
<value>btnOK</value>
|
<value>btnOK</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="$this.ClientSize" type="System.Drawing.Size, System.Drawing">
|
<data name=">>btnOK.Type" xml:space="preserve">
|
||||||
<value>490, 136</value>
|
<value>System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="btnClose.Size" type="System.Drawing.Size, System.Drawing">
|
<data name=">>btnOK.Parent" xml:space="preserve">
|
||||||
<value>75, 23</value>
|
<value>panel2</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="btnOK.Location" type="System.Drawing.Point, System.Drawing">
|
<data name=">>btnOK.ZOrder" xml:space="preserve">
|
||||||
<value>303, 17</value>
|
<value>1</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="$this.AutoScaleDimensions" type="System.Drawing.SizeF, System.Drawing">
|
<data name="panel2.Dock" type="System.Windows.Forms.DockStyle, System.Windows.Forms">
|
||||||
<value>6, 12</value>
|
<value>Bottom</value>
|
||||||
|
</data>
|
||||||
|
<data name="panel2.Location" type="System.Drawing.Point, System.Drawing">
|
||||||
|
<value>0, 76</value>
|
||||||
|
</data>
|
||||||
|
<data name="panel2.Size" type="System.Drawing.Size, System.Drawing">
|
||||||
|
<value>490, 60</value>
|
||||||
|
</data>
|
||||||
|
<data name="panel2.TabIndex" type="System.Int32, mscorlib">
|
||||||
|
<value>9</value>
|
||||||
|
</data>
|
||||||
|
<data name=">>panel2.Name" xml:space="preserve">
|
||||||
|
<value>panel2</value>
|
||||||
|
</data>
|
||||||
|
<data name=">>panel2.Type" xml:space="preserve">
|
||||||
|
<value>System.Windows.Forms.Panel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
</data>
|
</data>
|
||||||
<data name=">>panel2.Parent" xml:space="preserve">
|
<data name=">>panel2.Parent" xml:space="preserve">
|
||||||
<value>$this</value>
|
<value>$this</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="$this.Text" xml:space="preserve">
|
<data name=">>panel2.ZOrder" xml:space="preserve">
|
||||||
<value>MsgFilterSetForm</value>
|
<value>1</value>
|
||||||
|
</data>
|
||||||
|
<data name="btnClose.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
|
||||||
|
<value>NoControl</value>
|
||||||
|
</data>
|
||||||
|
<data name="btnClose.Location" type="System.Drawing.Point, System.Drawing">
|
||||||
|
<value>396, 17</value>
|
||||||
|
</data>
|
||||||
|
<data name="btnClose.Size" type="System.Drawing.Size, System.Drawing">
|
||||||
|
<value>75, 23</value>
|
||||||
|
</data>
|
||||||
|
<data name="btnClose.TabIndex" type="System.Int32, mscorlib">
|
||||||
|
<value>4</value>
|
||||||
|
</data>
|
||||||
|
<data name="btnClose.Text" xml:space="preserve">
|
||||||
|
<value>&Cancel</value>
|
||||||
|
</data>
|
||||||
|
<data name=">>btnClose.Name" xml:space="preserve">
|
||||||
|
<value>btnClose</value>
|
||||||
|
</data>
|
||||||
|
<data name=">>btnClose.Type" xml:space="preserve">
|
||||||
|
<value>System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</data>
|
||||||
|
<data name=">>btnClose.Parent" xml:space="preserve">
|
||||||
|
<value>panel2</value>
|
||||||
|
</data>
|
||||||
|
<data name=">>btnClose.ZOrder" xml:space="preserve">
|
||||||
|
<value>0</value>
|
||||||
|
</data>
|
||||||
|
<data name="btnOK.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
|
||||||
|
<value>NoControl</value>
|
||||||
|
</data>
|
||||||
|
<data name="btnOK.Location" type="System.Drawing.Point, System.Drawing">
|
||||||
|
<value>303, 17</value>
|
||||||
|
</data>
|
||||||
|
<data name="btnOK.Size" type="System.Drawing.Size, System.Drawing">
|
||||||
|
<value>75, 23</value>
|
||||||
|
</data>
|
||||||
|
<data name="btnOK.TabIndex" type="System.Int32, mscorlib">
|
||||||
|
<value>5</value>
|
||||||
|
</data>
|
||||||
|
<data name="btnOK.Text" xml:space="preserve">
|
||||||
|
<value>&OK</value>
|
||||||
|
</data>
|
||||||
|
<data name=">>btnOK.Name" xml:space="preserve">
|
||||||
|
<value>btnOK</value>
|
||||||
|
</data>
|
||||||
|
<data name=">>btnOK.Type" xml:space="preserve">
|
||||||
|
<value>System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</data>
|
||||||
|
<data name=">>btnOK.Parent" xml:space="preserve">
|
||||||
|
<value>panel2</value>
|
||||||
|
</data>
|
||||||
|
<data name=">>btnOK.ZOrder" xml:space="preserve">
|
||||||
|
<value>1</value>
|
||||||
</data>
|
</data>
|
||||||
<metadata name="$this.Localizable" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
<metadata name="$this.Localizable" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||||
<value>True</value>
|
<value>True</value>
|
||||||
</metadata>
|
</metadata>
|
||||||
|
<data name="$this.AutoScaleDimensions" type="System.Drawing.SizeF, System.Drawing">
|
||||||
|
<value>6, 12</value>
|
||||||
|
</data>
|
||||||
|
<data name="$this.ClientSize" type="System.Drawing.Size, System.Drawing">
|
||||||
|
<value>490, 136</value>
|
||||||
|
</data>
|
||||||
|
<data name="$this.Text" xml:space="preserve">
|
||||||
|
<value>MsgFilterSetForm</value>
|
||||||
|
</data>
|
||||||
|
<data name=">>$this.Name" xml:space="preserve">
|
||||||
|
<value>MsgFilterSetForm</value>
|
||||||
|
</data>
|
||||||
|
<data name=">>$this.Type" xml:space="preserve">
|
||||||
|
<value>v2rayN.Forms.BaseForm, v2rayN, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null</value>
|
||||||
|
</data>
|
||||||
</root>
|
</root>
|
||||||
@@ -129,4 +129,10 @@
|
|||||||
<data name="$this.Text" xml:space="preserve">
|
<data name="$this.Text" xml:space="preserve">
|
||||||
<value>设置过滤器</value>
|
<value>设置过滤器</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="btnFilderProxy.Text" xml:space="preserve">
|
||||||
|
<value>过滤Proxy</value>
|
||||||
|
</data>
|
||||||
|
<data name="btnFilterDirect.Text" xml:space="preserve">
|
||||||
|
<value>过滤Direct</value>
|
||||||
|
</data>
|
||||||
</root>
|
</root>
|
||||||
101
v2rayN/v2rayN/Forms/OptionSettingForm.Designer.cs
generated
101
v2rayN/v2rayN/Forms/OptionSettingForm.Designer.cs
generated
@@ -33,15 +33,14 @@
|
|||||||
this.tabControl1 = new System.Windows.Forms.TabControl();
|
this.tabControl1 = new System.Windows.Forms.TabControl();
|
||||||
this.tabPage1 = new System.Windows.Forms.TabPage();
|
this.tabPage1 = new System.Windows.Forms.TabPage();
|
||||||
this.groupBox1 = new System.Windows.Forms.GroupBox();
|
this.groupBox1 = new System.Windows.Forms.GroupBox();
|
||||||
|
this.label16 = new System.Windows.Forms.Label();
|
||||||
|
this.label4 = new System.Windows.Forms.Label();
|
||||||
|
this.txtpass = new System.Windows.Forms.TextBox();
|
||||||
|
this.txtuser = new System.Windows.Forms.TextBox();
|
||||||
this.chkdefAllowInsecure = new System.Windows.Forms.CheckBox();
|
this.chkdefAllowInsecure = new System.Windows.Forms.CheckBox();
|
||||||
this.chksniffingEnabled2 = new System.Windows.Forms.CheckBox();
|
this.chkAllowLANConn = new System.Windows.Forms.CheckBox();
|
||||||
this.chksniffingEnabled = new System.Windows.Forms.CheckBox();
|
this.chksniffingEnabled = new System.Windows.Forms.CheckBox();
|
||||||
this.chkmuxEnabled = new System.Windows.Forms.CheckBox();
|
this.chkmuxEnabled = new System.Windows.Forms.CheckBox();
|
||||||
this.chkAllowIn2 = new System.Windows.Forms.CheckBox();
|
|
||||||
this.chkudpEnabled2 = new System.Windows.Forms.CheckBox();
|
|
||||||
this.cmbprotocol2 = new System.Windows.Forms.ComboBox();
|
|
||||||
this.label3 = new System.Windows.Forms.Label();
|
|
||||||
this.txtlocalPort2 = new System.Windows.Forms.TextBox();
|
|
||||||
this.cmbprotocol = new System.Windows.Forms.ComboBox();
|
this.cmbprotocol = new System.Windows.Forms.ComboBox();
|
||||||
this.label1 = new System.Windows.Forms.Label();
|
this.label1 = new System.Windows.Forms.Label();
|
||||||
this.chkudpEnabled = new System.Windows.Forms.CheckBox();
|
this.chkudpEnabled = new System.Windows.Forms.CheckBox();
|
||||||
@@ -79,7 +78,6 @@
|
|||||||
this.cbFreshrate = new System.Windows.Forms.ComboBox();
|
this.cbFreshrate = new System.Windows.Forms.ComboBox();
|
||||||
this.lbFreshrate = new System.Windows.Forms.Label();
|
this.lbFreshrate = new System.Windows.Forms.Label();
|
||||||
this.chkEnableStatistics = new System.Windows.Forms.CheckBox();
|
this.chkEnableStatistics = new System.Windows.Forms.CheckBox();
|
||||||
this.chkAllowLANConn = new System.Windows.Forms.CheckBox();
|
|
||||||
this.chkAutoRun = new System.Windows.Forms.CheckBox();
|
this.chkAutoRun = new System.Windows.Forms.CheckBox();
|
||||||
this.tabPageCoreType = new System.Windows.Forms.TabPage();
|
this.tabPageCoreType = new System.Windows.Forms.TabPage();
|
||||||
this.cmbCoreType6 = new System.Windows.Forms.ComboBox();
|
this.cmbCoreType6 = new System.Windows.Forms.ComboBox();
|
||||||
@@ -143,15 +141,14 @@
|
|||||||
//
|
//
|
||||||
// groupBox1
|
// groupBox1
|
||||||
//
|
//
|
||||||
|
this.groupBox1.Controls.Add(this.label16);
|
||||||
|
this.groupBox1.Controls.Add(this.label4);
|
||||||
|
this.groupBox1.Controls.Add(this.txtpass);
|
||||||
|
this.groupBox1.Controls.Add(this.txtuser);
|
||||||
this.groupBox1.Controls.Add(this.chkdefAllowInsecure);
|
this.groupBox1.Controls.Add(this.chkdefAllowInsecure);
|
||||||
this.groupBox1.Controls.Add(this.chksniffingEnabled2);
|
this.groupBox1.Controls.Add(this.chkAllowLANConn);
|
||||||
this.groupBox1.Controls.Add(this.chksniffingEnabled);
|
this.groupBox1.Controls.Add(this.chksniffingEnabled);
|
||||||
this.groupBox1.Controls.Add(this.chkmuxEnabled);
|
this.groupBox1.Controls.Add(this.chkmuxEnabled);
|
||||||
this.groupBox1.Controls.Add(this.chkAllowIn2);
|
|
||||||
this.groupBox1.Controls.Add(this.chkudpEnabled2);
|
|
||||||
this.groupBox1.Controls.Add(this.cmbprotocol2);
|
|
||||||
this.groupBox1.Controls.Add(this.label3);
|
|
||||||
this.groupBox1.Controls.Add(this.txtlocalPort2);
|
|
||||||
this.groupBox1.Controls.Add(this.cmbprotocol);
|
this.groupBox1.Controls.Add(this.cmbprotocol);
|
||||||
this.groupBox1.Controls.Add(this.label1);
|
this.groupBox1.Controls.Add(this.label1);
|
||||||
this.groupBox1.Controls.Add(this.chkudpEnabled);
|
this.groupBox1.Controls.Add(this.chkudpEnabled);
|
||||||
@@ -164,17 +161,37 @@
|
|||||||
this.groupBox1.Name = "groupBox1";
|
this.groupBox1.Name = "groupBox1";
|
||||||
this.groupBox1.TabStop = false;
|
this.groupBox1.TabStop = false;
|
||||||
//
|
//
|
||||||
|
// label16
|
||||||
|
//
|
||||||
|
resources.ApplyResources(this.label16, "label16");
|
||||||
|
this.label16.Name = "label16";
|
||||||
|
//
|
||||||
|
// label4
|
||||||
|
//
|
||||||
|
resources.ApplyResources(this.label4, "label4");
|
||||||
|
this.label4.Name = "label4";
|
||||||
|
//
|
||||||
|
// txtpass
|
||||||
|
//
|
||||||
|
resources.ApplyResources(this.txtpass, "txtpass");
|
||||||
|
this.txtpass.Name = "txtpass";
|
||||||
|
//
|
||||||
|
// txtuser
|
||||||
|
//
|
||||||
|
resources.ApplyResources(this.txtuser, "txtuser");
|
||||||
|
this.txtuser.Name = "txtuser";
|
||||||
|
//
|
||||||
// chkdefAllowInsecure
|
// chkdefAllowInsecure
|
||||||
//
|
//
|
||||||
resources.ApplyResources(this.chkdefAllowInsecure, "chkdefAllowInsecure");
|
resources.ApplyResources(this.chkdefAllowInsecure, "chkdefAllowInsecure");
|
||||||
this.chkdefAllowInsecure.Name = "chkdefAllowInsecure";
|
this.chkdefAllowInsecure.Name = "chkdefAllowInsecure";
|
||||||
this.chkdefAllowInsecure.UseVisualStyleBackColor = true;
|
this.chkdefAllowInsecure.UseVisualStyleBackColor = true;
|
||||||
//
|
//
|
||||||
// chksniffingEnabled2
|
// chkAllowLANConn
|
||||||
//
|
//
|
||||||
resources.ApplyResources(this.chksniffingEnabled2, "chksniffingEnabled2");
|
resources.ApplyResources(this.chkAllowLANConn, "chkAllowLANConn");
|
||||||
this.chksniffingEnabled2.Name = "chksniffingEnabled2";
|
this.chkAllowLANConn.Name = "chkAllowLANConn";
|
||||||
this.chksniffingEnabled2.UseVisualStyleBackColor = true;
|
this.chkAllowLANConn.UseVisualStyleBackColor = true;
|
||||||
//
|
//
|
||||||
// chksniffingEnabled
|
// chksniffingEnabled
|
||||||
//
|
//
|
||||||
@@ -188,39 +205,6 @@
|
|||||||
this.chkmuxEnabled.Name = "chkmuxEnabled";
|
this.chkmuxEnabled.Name = "chkmuxEnabled";
|
||||||
this.chkmuxEnabled.UseVisualStyleBackColor = true;
|
this.chkmuxEnabled.UseVisualStyleBackColor = true;
|
||||||
//
|
//
|
||||||
// chkAllowIn2
|
|
||||||
//
|
|
||||||
resources.ApplyResources(this.chkAllowIn2, "chkAllowIn2");
|
|
||||||
this.chkAllowIn2.Name = "chkAllowIn2";
|
|
||||||
this.chkAllowIn2.UseVisualStyleBackColor = true;
|
|
||||||
this.chkAllowIn2.CheckedChanged += new System.EventHandler(this.chkAllowIn2_CheckedChanged);
|
|
||||||
//
|
|
||||||
// chkudpEnabled2
|
|
||||||
//
|
|
||||||
resources.ApplyResources(this.chkudpEnabled2, "chkudpEnabled2");
|
|
||||||
this.chkudpEnabled2.Name = "chkudpEnabled2";
|
|
||||||
this.chkudpEnabled2.UseVisualStyleBackColor = true;
|
|
||||||
//
|
|
||||||
// cmbprotocol2
|
|
||||||
//
|
|
||||||
this.cmbprotocol2.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
|
||||||
this.cmbprotocol2.FormattingEnabled = true;
|
|
||||||
this.cmbprotocol2.Items.AddRange(new object[] {
|
|
||||||
resources.GetString("cmbprotocol2.Items"),
|
|
||||||
resources.GetString("cmbprotocol2.Items1")});
|
|
||||||
resources.ApplyResources(this.cmbprotocol2, "cmbprotocol2");
|
|
||||||
this.cmbprotocol2.Name = "cmbprotocol2";
|
|
||||||
//
|
|
||||||
// label3
|
|
||||||
//
|
|
||||||
resources.ApplyResources(this.label3, "label3");
|
|
||||||
this.label3.Name = "label3";
|
|
||||||
//
|
|
||||||
// txtlocalPort2
|
|
||||||
//
|
|
||||||
resources.ApplyResources(this.txtlocalPort2, "txtlocalPort2");
|
|
||||||
this.txtlocalPort2.Name = "txtlocalPort2";
|
|
||||||
//
|
|
||||||
// cmbprotocol
|
// cmbprotocol
|
||||||
//
|
//
|
||||||
this.cmbprotocol.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
this.cmbprotocol.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||||
@@ -399,7 +383,6 @@
|
|||||||
this.tabPage7.Controls.Add(this.cbFreshrate);
|
this.tabPage7.Controls.Add(this.cbFreshrate);
|
||||||
this.tabPage7.Controls.Add(this.lbFreshrate);
|
this.tabPage7.Controls.Add(this.lbFreshrate);
|
||||||
this.tabPage7.Controls.Add(this.chkEnableStatistics);
|
this.tabPage7.Controls.Add(this.chkEnableStatistics);
|
||||||
this.tabPage7.Controls.Add(this.chkAllowLANConn);
|
|
||||||
this.tabPage7.Controls.Add(this.chkAutoRun);
|
this.tabPage7.Controls.Add(this.chkAutoRun);
|
||||||
resources.ApplyResources(this.tabPage7, "tabPage7");
|
resources.ApplyResources(this.tabPage7, "tabPage7");
|
||||||
this.tabPage7.Name = "tabPage7";
|
this.tabPage7.Name = "tabPage7";
|
||||||
@@ -464,12 +447,6 @@
|
|||||||
this.chkEnableStatistics.Name = "chkEnableStatistics";
|
this.chkEnableStatistics.Name = "chkEnableStatistics";
|
||||||
this.chkEnableStatistics.UseVisualStyleBackColor = true;
|
this.chkEnableStatistics.UseVisualStyleBackColor = true;
|
||||||
//
|
//
|
||||||
// chkAllowLANConn
|
|
||||||
//
|
|
||||||
resources.ApplyResources(this.chkAllowLANConn, "chkAllowLANConn");
|
|
||||||
this.chkAllowLANConn.Name = "chkAllowLANConn";
|
|
||||||
this.chkAllowLANConn.UseVisualStyleBackColor = true;
|
|
||||||
//
|
|
||||||
// chkAutoRun
|
// chkAutoRun
|
||||||
//
|
//
|
||||||
resources.ApplyResources(this.chkAutoRun, "chkAutoRun");
|
resources.ApplyResources(this.chkAutoRun, "chkAutoRun");
|
||||||
@@ -664,11 +641,6 @@
|
|||||||
private System.Windows.Forms.Panel panel2;
|
private System.Windows.Forms.Panel panel2;
|
||||||
private System.Windows.Forms.ComboBox cmbprotocol;
|
private System.Windows.Forms.ComboBox cmbprotocol;
|
||||||
private System.Windows.Forms.Label label1;
|
private System.Windows.Forms.Label label1;
|
||||||
private System.Windows.Forms.ComboBox cmbprotocol2;
|
|
||||||
private System.Windows.Forms.Label label3;
|
|
||||||
private System.Windows.Forms.TextBox txtlocalPort2;
|
|
||||||
private System.Windows.Forms.CheckBox chkudpEnabled2;
|
|
||||||
private System.Windows.Forms.CheckBox chkAllowIn2;
|
|
||||||
private System.Windows.Forms.CheckBox chkmuxEnabled;
|
private System.Windows.Forms.CheckBox chkmuxEnabled;
|
||||||
private System.Windows.Forms.TabPage tabPage6;
|
private System.Windows.Forms.TabPage tabPage6;
|
||||||
private System.Windows.Forms.TextBox txtKcpmtu;
|
private System.Windows.Forms.TextBox txtKcpmtu;
|
||||||
@@ -688,7 +660,6 @@
|
|||||||
private System.Windows.Forms.CheckBox chkAutoRun;
|
private System.Windows.Forms.CheckBox chkAutoRun;
|
||||||
private System.Windows.Forms.CheckBox chkAllowLANConn;
|
private System.Windows.Forms.CheckBox chkAllowLANConn;
|
||||||
private System.Windows.Forms.CheckBox chksniffingEnabled;
|
private System.Windows.Forms.CheckBox chksniffingEnabled;
|
||||||
private System.Windows.Forms.CheckBox chksniffingEnabled2;
|
|
||||||
private System.Windows.Forms.CheckBox chkEnableStatistics;
|
private System.Windows.Forms.CheckBox chkEnableStatistics;
|
||||||
private System.Windows.Forms.ComboBox cbFreshrate;
|
private System.Windows.Forms.ComboBox cbFreshrate;
|
||||||
private System.Windows.Forms.Label lbFreshrate;
|
private System.Windows.Forms.Label lbFreshrate;
|
||||||
@@ -722,5 +693,9 @@
|
|||||||
private System.Windows.Forms.Label labCoreType3;
|
private System.Windows.Forms.Label labCoreType3;
|
||||||
private System.Windows.Forms.ComboBox cmbCoreType2;
|
private System.Windows.Forms.ComboBox cmbCoreType2;
|
||||||
private System.Windows.Forms.Label labCoreType2;
|
private System.Windows.Forms.Label labCoreType2;
|
||||||
|
private System.Windows.Forms.Label label16;
|
||||||
|
private System.Windows.Forms.Label label4;
|
||||||
|
private System.Windows.Forms.TextBox txtpass;
|
||||||
|
private System.Windows.Forms.TextBox txtuser;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -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
|
||||||
{
|
{
|
||||||
@@ -45,23 +46,10 @@ namespace v2rayN.Forms
|
|||||||
cmbprotocol.Text = config.inbound[0].protocol.ToString();
|
cmbprotocol.Text = config.inbound[0].protocol.ToString();
|
||||||
chkudpEnabled.Checked = config.inbound[0].udpEnabled;
|
chkudpEnabled.Checked = config.inbound[0].udpEnabled;
|
||||||
chksniffingEnabled.Checked = config.inbound[0].sniffingEnabled;
|
chksniffingEnabled.Checked = config.inbound[0].sniffingEnabled;
|
||||||
|
chkAllowLANConn.Checked = config.inbound[0].allowLANConn;
|
||||||
|
txtuser.Text = config.inbound[0].user;
|
||||||
|
txtpass.Text = config.inbound[0].pass;
|
||||||
|
|
||||||
txtlocalPort2.Text = $"{config.inbound[0].localPort + 1}";
|
|
||||||
cmbprotocol2.Text = Global.InboundHttp;
|
|
||||||
|
|
||||||
if (config.inbound.Count > 1)
|
|
||||||
{
|
|
||||||
txtlocalPort2.Text = config.inbound[1].localPort.ToString();
|
|
||||||
cmbprotocol2.Text = config.inbound[1].protocol.ToString();
|
|
||||||
chkudpEnabled2.Checked = config.inbound[1].udpEnabled;
|
|
||||||
chksniffingEnabled2.Checked = config.inbound[1].sniffingEnabled;
|
|
||||||
chkAllowIn2.Checked = true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
chkAllowIn2.Checked = false;
|
|
||||||
}
|
|
||||||
chkAllowIn2State();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//remoteDNS
|
//remoteDNS
|
||||||
@@ -95,15 +83,14 @@ namespace v2rayN.Forms
|
|||||||
//开机自动启动
|
//开机自动启动
|
||||||
chkAutoRun.Checked = Utils.IsAutoRun();
|
chkAutoRun.Checked = Utils.IsAutoRun();
|
||||||
|
|
||||||
chkAllowLANConn.Checked = config.allowLANConn;
|
|
||||||
chkEnableStatistics.Checked = config.enableStatistics;
|
chkEnableStatistics.Checked = config.enableStatistics;
|
||||||
chkKeepOlderDedupl.Checked = config.keepOlderDedupl;
|
chkKeepOlderDedupl.Checked = config.keepOlderDedupl;
|
||||||
|
|
||||||
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;
|
||||||
|
|
||||||
@@ -146,7 +133,7 @@ namespace v2rayN.Forms
|
|||||||
config.coreTypeItem.Add(new CoreTypeItem()
|
config.coreTypeItem.Add(new CoreTypeItem()
|
||||||
{
|
{
|
||||||
configType = it,
|
configType = it,
|
||||||
coreType = ECoreType.v2fly
|
coreType = ECoreType.Xray
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
for (int k = 1; k <= config.coreTypeItem.Count; k++)
|
for (int k = 1; k <= config.coreTypeItem.Count; k++)
|
||||||
@@ -187,7 +174,7 @@ namespace v2rayN.Forms
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
UI.ShowWarning(UIRes.I18N("OperationFailed"));
|
UI.ShowWarning(ResUI.OperationFailed);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -209,14 +196,15 @@ namespace v2rayN.Forms
|
|||||||
string protocol = cmbprotocol.Text.TrimEx();
|
string protocol = cmbprotocol.Text.TrimEx();
|
||||||
bool udpEnabled = chkudpEnabled.Checked;
|
bool udpEnabled = chkudpEnabled.Checked;
|
||||||
bool sniffingEnabled = chksniffingEnabled.Checked;
|
bool sniffingEnabled = chksniffingEnabled.Checked;
|
||||||
|
bool allowLANConn = chkAllowLANConn.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 +217,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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -238,41 +226,16 @@ namespace v2rayN.Forms
|
|||||||
config.inbound[0].protocol = protocol;
|
config.inbound[0].protocol = protocol;
|
||||||
config.inbound[0].udpEnabled = udpEnabled;
|
config.inbound[0].udpEnabled = udpEnabled;
|
||||||
config.inbound[0].sniffingEnabled = sniffingEnabled;
|
config.inbound[0].sniffingEnabled = sniffingEnabled;
|
||||||
|
config.inbound[0].allowLANConn = allowLANConn;
|
||||||
|
config.inbound[0].user = txtuser.Text;
|
||||||
|
config.inbound[0].pass = txtpass.Text;
|
||||||
|
|
||||||
//本地监听2
|
if (config.inbound.Count > 1)
|
||||||
string localPort2 = txtlocalPort2.Text.TrimEx();
|
|
||||||
string protocol2 = cmbprotocol2.Text.TrimEx();
|
|
||||||
bool udpEnabled2 = chkudpEnabled2.Checked;
|
|
||||||
bool sniffingEnabled2 = chksniffingEnabled2.Checked;
|
|
||||||
if (chkAllowIn2.Checked)
|
|
||||||
{
|
{
|
||||||
if (Utils.IsNullOrEmpty(localPort2) || !Utils.IsNumberic(localPort2))
|
config.inbound.RemoveAt(1);
|
||||||
{
|
|
||||||
UI.Show(UIRes.I18N("FillLocalListeningPort"));
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
if (Utils.IsNullOrEmpty(protocol2))
|
|
||||||
{
|
|
||||||
UI.Show(UIRes.I18N("PleaseSelectProtocol"));
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
if (config.inbound.Count < 2)
|
|
||||||
{
|
|
||||||
config.inbound.Add(new Mode.InItem());
|
|
||||||
}
|
|
||||||
config.inbound[1].localPort = Utils.ToInt(localPort2);
|
|
||||||
config.inbound[1].protocol = protocol2;
|
|
||||||
config.inbound[1].udpEnabled = udpEnabled2;
|
|
||||||
config.inbound[1].sniffingEnabled = sniffingEnabled2;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (config.inbound.Count > 1)
|
|
||||||
{
|
|
||||||
config.inbound.RemoveAt(1);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//日志
|
//日志
|
||||||
config.logEnabled = logEnabled;
|
config.logEnabled = logEnabled;
|
||||||
config.loglevel = loglevel;
|
config.loglevel = loglevel;
|
||||||
@@ -312,7 +275,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);
|
||||||
@@ -335,8 +298,6 @@ namespace v2rayN.Forms
|
|||||||
//开机自动启动
|
//开机自动启动
|
||||||
Utils.SetAutoRun(chkAutoRun.Checked);
|
Utils.SetAutoRun(chkAutoRun.Checked);
|
||||||
|
|
||||||
config.allowLANConn = chkAllowLANConn.Checked;
|
|
||||||
|
|
||||||
bool lastEnableStatistics = config.enableStatistics;
|
bool lastEnableStatistics = config.enableStatistics;
|
||||||
config.enableStatistics = chkEnableStatistics.Checked;
|
config.enableStatistics = chkEnableStatistics.Checked;
|
||||||
config.statisticsFreshRate = (int)cbFreshrate.SelectedValue;
|
config.statisticsFreshRate = (int)cbFreshrate.SelectedValue;
|
||||||
@@ -366,17 +327,6 @@ namespace v2rayN.Forms
|
|||||||
this.DialogResult = DialogResult.Cancel;
|
this.DialogResult = DialogResult.Cancel;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void chkAllowIn2_CheckedChanged(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
chkAllowIn2State();
|
|
||||||
}
|
|
||||||
private void chkAllowIn2State()
|
|
||||||
{
|
|
||||||
bool blAllow2 = chkAllowIn2.Checked;
|
|
||||||
txtlocalPort2.Enabled =
|
|
||||||
cmbprotocol2.Enabled =
|
|
||||||
chkudpEnabled2.Enabled = blAllow2;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void linkDnsObjectDoc_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
|
private void linkDnsObjectDoc_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
|
||||||
{
|
{
|
||||||
@@ -387,5 +337,6 @@ namespace v2rayN.Forms
|
|||||||
{
|
{
|
||||||
Process.Start(Utils.GetPath("EnableLoopback.exe"));
|
Process.Start(Utils.GetPath("EnableLoopback.exe"));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -121,48 +121,96 @@
|
|||||||
<value>取消(&C)</value>
|
<value>取消(&C)</value>
|
||||||
</data>
|
</data>
|
||||||
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||||
|
<data name="label16.Size" type="System.Drawing.Size, System.Drawing">
|
||||||
|
<value>53, 12</value>
|
||||||
|
</data>
|
||||||
|
<data name="label16.Text" xml:space="preserve">
|
||||||
|
<value>认证密码</value>
|
||||||
|
</data>
|
||||||
|
<data name="label4.Location" type="System.Drawing.Point, System.Drawing">
|
||||||
|
<value>219, 65</value>
|
||||||
|
</data>
|
||||||
|
<data name="label4.Size" type="System.Drawing.Size, System.Drawing">
|
||||||
|
<value>65, 12</value>
|
||||||
|
</data>
|
||||||
|
<data name="label4.Text" xml:space="preserve">
|
||||||
|
<value>认证用户名</value>
|
||||||
|
</data>
|
||||||
|
<data name="chkdefAllowInsecure.Location" type="System.Drawing.Point, System.Drawing">
|
||||||
|
<value>15, 208</value>
|
||||||
|
</data>
|
||||||
<data name="chkdefAllowInsecure.Size" type="System.Drawing.Size, System.Drawing">
|
<data name="chkdefAllowInsecure.Size" type="System.Drawing.Size, System.Drawing">
|
||||||
<value>324, 16</value>
|
<value>324, 16</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="chkdefAllowInsecure.Text" xml:space="preserve">
|
<data name="chkdefAllowInsecure.Text" xml:space="preserve">
|
||||||
<value>传输层安全选tls时,默认跳过证书验证(allowInsecure)</value>
|
<value>传输层安全选tls时,默认跳过证书验证(allowInsecure)</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="chksniffingEnabled2.Location" type="System.Drawing.Point, System.Drawing">
|
||||||
|
<value>468, 117</value>
|
||||||
|
</data>
|
||||||
<data name="chksniffingEnabled2.Size" type="System.Drawing.Size, System.Drawing">
|
<data name="chksniffingEnabled2.Size" type="System.Drawing.Size, System.Drawing">
|
||||||
<value>96, 16</value>
|
<value>96, 16</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="chksniffingEnabled2.Text" xml:space="preserve">
|
<data name="chksniffingEnabled2.Text" xml:space="preserve">
|
||||||
<value>开启流量探测</value>
|
<value>开启流量探测</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="chkAllowLANConn.Size" type="System.Drawing.Size, System.Drawing">
|
||||||
|
<value>144, 16</value>
|
||||||
|
</data>
|
||||||
|
<data name="chkAllowLANConn.Text" xml:space="preserve">
|
||||||
|
<value>允许来自局域网的连接</value>
|
||||||
|
</data>
|
||||||
<data name="chksniffingEnabled.Size" type="System.Drawing.Size, System.Drawing">
|
<data name="chksniffingEnabled.Size" type="System.Drawing.Size, System.Drawing">
|
||||||
<value>96, 16</value>
|
<value>96, 16</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="chksniffingEnabled.Text" xml:space="preserve">
|
<data name="chksniffingEnabled.Text" xml:space="preserve">
|
||||||
<value>开启流量探测</value>
|
<value>开启流量探测</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="chkmuxEnabled.Location" type="System.Drawing.Point, System.Drawing">
|
||||||
|
<value>15, 145</value>
|
||||||
|
</data>
|
||||||
<data name="chkmuxEnabled.Size" type="System.Drawing.Size, System.Drawing">
|
<data name="chkmuxEnabled.Size" type="System.Drawing.Size, System.Drawing">
|
||||||
<value>114, 16</value>
|
<value>114, 16</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="chkmuxEnabled.Text" xml:space="preserve">
|
<data name="chkmuxEnabled.Text" xml:space="preserve">
|
||||||
<value>开启Mux多路复用</value>
|
<value>开启Mux多路复用</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="chkAllowIn2.Location" type="System.Drawing.Point, System.Drawing">
|
||||||
|
<value>15, 120</value>
|
||||||
|
</data>
|
||||||
<data name="chkAllowIn2.Size" type="System.Drawing.Size, System.Drawing">
|
<data name="chkAllowIn2.Size" type="System.Drawing.Size, System.Drawing">
|
||||||
<value>102, 16</value>
|
<value>102, 16</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="chkAllowIn2.Text" xml:space="preserve">
|
<data name="chkAllowIn2.Text" xml:space="preserve">
|
||||||
<value>本地监听端口2</value>
|
<value>本地监听端口2</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="chkudpEnabled2.Location" type="System.Drawing.Point, System.Drawing">
|
||||||
|
<value>369, 119</value>
|
||||||
|
</data>
|
||||||
<data name="chkudpEnabled2.Size" type="System.Drawing.Size, System.Drawing">
|
<data name="chkudpEnabled2.Size" type="System.Drawing.Size, System.Drawing">
|
||||||
<value>66, 16</value>
|
<value>66, 16</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="chkudpEnabled2.Text" xml:space="preserve">
|
<data name="chkudpEnabled2.Text" xml:space="preserve">
|
||||||
<value>开启UDP</value>
|
<value>开启UDP</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="cmbprotocol2.Location" type="System.Drawing.Point, System.Drawing">
|
||||||
|
<value>257, 117</value>
|
||||||
|
</data>
|
||||||
|
<data name="label3.Location" type="System.Drawing.Point, System.Drawing">
|
||||||
|
<value>206, 121</value>
|
||||||
|
</data>
|
||||||
<data name="label3.Size" type="System.Drawing.Size, System.Drawing">
|
<data name="label3.Size" type="System.Drawing.Size, System.Drawing">
|
||||||
<value>29, 12</value>
|
<value>29, 12</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="label3.Text" xml:space="preserve">
|
<data name="label3.Text" xml:space="preserve">
|
||||||
<value>协议</value>
|
<value>协议</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="txtlocalPort2.Location" type="System.Drawing.Point, System.Drawing">
|
||||||
|
<value>124, 117</value>
|
||||||
|
</data>
|
||||||
|
<data name="label1.Location" type="System.Drawing.Point, System.Drawing">
|
||||||
|
<value>219, 29</value>
|
||||||
|
</data>
|
||||||
<data name="label1.Size" type="System.Drawing.Size, System.Drawing">
|
<data name="label1.Size" type="System.Drawing.Size, System.Drawing">
|
||||||
<value>29, 12</value>
|
<value>29, 12</value>
|
||||||
</data>
|
</data>
|
||||||
@@ -175,12 +223,21 @@
|
|||||||
<data name="chkudpEnabled.Text" xml:space="preserve">
|
<data name="chkudpEnabled.Text" xml:space="preserve">
|
||||||
<value>开启UDP</value>
|
<value>开启UDP</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="chklogEnabled.Location" type="System.Drawing.Point, System.Drawing">
|
||||||
|
<value>15, 176</value>
|
||||||
|
</data>
|
||||||
<data name="chklogEnabled.Size" type="System.Drawing.Size, System.Drawing">
|
<data name="chklogEnabled.Size" type="System.Drawing.Size, System.Drawing">
|
||||||
<value>156, 16</value>
|
<value>156, 16</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="chklogEnabled.Text" xml:space="preserve">
|
<data name="chklogEnabled.Text" xml:space="preserve">
|
||||||
<value>记录本地日志(默认关闭)</value>
|
<value>记录本地日志(默认关闭)</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="cmbloglevel.Location" type="System.Drawing.Point, System.Drawing">
|
||||||
|
<value>257, 174</value>
|
||||||
|
</data>
|
||||||
|
<data name="label5.Location" type="System.Drawing.Point, System.Drawing">
|
||||||
|
<value>193, 178</value>
|
||||||
|
</data>
|
||||||
<data name="label5.Size" type="System.Drawing.Size, System.Drawing">
|
<data name="label5.Size" type="System.Drawing.Size, System.Drawing">
|
||||||
<value>53, 12</value>
|
<value>53, 12</value>
|
||||||
</data>
|
</data>
|
||||||
@@ -253,12 +310,6 @@
|
|||||||
<data name="chkIgnoreGeoUpdateCore.Text" xml:space="preserve">
|
<data name="chkIgnoreGeoUpdateCore.Text" xml:space="preserve">
|
||||||
<value>更新Core时忽略Geo文件</value>
|
<value>更新Core时忽略Geo文件</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="label4.Size" type="System.Drawing.Size, System.Drawing">
|
|
||||||
<value>53, 12</value>
|
|
||||||
</data>
|
|
||||||
<data name="label4.Text" xml:space="preserve">
|
|
||||||
<value>Core类型</value>
|
|
||||||
</data>
|
|
||||||
<data name="chkKeepOlderDedupl.Size" type="System.Drawing.Size, System.Drawing">
|
<data name="chkKeepOlderDedupl.Size" type="System.Drawing.Size, System.Drawing">
|
||||||
<value>156, 16</value>
|
<value>156, 16</value>
|
||||||
</data>
|
</data>
|
||||||
@@ -277,12 +328,6 @@
|
|||||||
<data name="chkEnableStatistics.Text" xml:space="preserve">
|
<data name="chkEnableStatistics.Text" xml:space="preserve">
|
||||||
<value>启用统计(实时网速显示和使用流量显示,需要重启v2rayN客户端)</value>
|
<value>启用统计(实时网速显示和使用流量显示,需要重启v2rayN客户端)</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="chkAllowLANConn.Size" type="System.Drawing.Size, System.Drawing">
|
|
||||||
<value>144, 16</value>
|
|
||||||
</data>
|
|
||||||
<data name="chkAllowLANConn.Text" xml:space="preserve">
|
|
||||||
<value>允许来自局域网的连接</value>
|
|
||||||
</data>
|
|
||||||
<data name="chkAutoRun.Size" type="System.Drawing.Size, System.Drawing">
|
<data name="chkAutoRun.Size" type="System.Drawing.Size, System.Drawing">
|
||||||
<value>180, 16</value>
|
<value>180, 16</value>
|
||||||
</data>
|
</data>
|
||||||
@@ -295,6 +340,12 @@
|
|||||||
<data name="tabPage7.Text" xml:space="preserve">
|
<data name="tabPage7.Text" xml:space="preserve">
|
||||||
<value> v2rayN设置 </value>
|
<value> v2rayN设置 </value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="tabPageCoreType.Size" type="System.Drawing.Size, System.Drawing">
|
||||||
|
<value>654, 443</value>
|
||||||
|
</data>
|
||||||
|
<data name="tabPageCoreType.Text" xml:space="preserve">
|
||||||
|
<value> Core类型设置 </value>
|
||||||
|
</data>
|
||||||
<data name="label13.Size" type="System.Drawing.Size, System.Drawing">
|
<data name="label13.Size" type="System.Drawing.Size, System.Drawing">
|
||||||
<value>95, 12</value>
|
<value>95, 12</value>
|
||||||
</data>
|
</data>
|
||||||
@@ -328,13 +379,16 @@
|
|||||||
<data name="panel2.Location" type="System.Drawing.Point, System.Drawing">
|
<data name="panel2.Location" type="System.Drawing.Point, System.Drawing">
|
||||||
<value>0, 479</value>
|
<value>0, 479</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="panel2.Size" type="System.Drawing.Size, System.Drawing">
|
||||||
|
<value>662, 60</value>
|
||||||
|
</data>
|
||||||
|
<data name="panel1.Size" type="System.Drawing.Size, System.Drawing">
|
||||||
|
<value>662, 10</value>
|
||||||
|
</data>
|
||||||
<data name="$this.ClientSize" type="System.Drawing.Size, System.Drawing">
|
<data name="$this.ClientSize" type="System.Drawing.Size, System.Drawing">
|
||||||
<value>662, 539</value>
|
<value>662, 539</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="$this.Text" xml:space="preserve">
|
<data name="$this.Text" xml:space="preserve">
|
||||||
<value>参数设置</value>
|
<value>参数设置</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="tabPageCoreType.Text" xml:space="preserve">
|
|
||||||
<value> Core类型设置 </value>
|
|
||||||
</data>
|
|
||||||
</root>
|
</root>
|
||||||
@@ -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;
|
||||||
|
|||||||
@@ -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
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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)
|
||||||
|
|||||||
@@ -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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -14,6 +14,10 @@ namespace v2rayN
|
|||||||
public const string v2flyCoreUrl = "https://github.com/v2fly/v2ray-core/releases";
|
public const string v2flyCoreUrl = "https://github.com/v2fly/v2ray-core/releases";
|
||||||
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 hysteriaCoreUrl = "https://github.com/HyNetwork/hysteria/releases";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -107,6 +111,7 @@ namespace v2rayN
|
|||||||
|
|
||||||
public const string InboundSocks = "socks";
|
public const string InboundSocks = "socks";
|
||||||
public const string InboundHttp = "http";
|
public const string InboundHttp = "http";
|
||||||
|
public const string InboundHttp2 = "http2";
|
||||||
public const string Loopback = "127.0.0.1";
|
public const string Loopback = "127.0.0.1";
|
||||||
public const string InboundAPITagName = "api";
|
public const string InboundAPITagName = "api";
|
||||||
public const string InboundAPIProtocal = "dokodemo-door";
|
public const string InboundAPIProtocal = "dokodemo-door";
|
||||||
@@ -215,31 +220,6 @@ namespace v2rayN
|
|||||||
get; set;
|
get; set;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 是否开启全局代理(http)
|
|
||||||
/// </summary>
|
|
||||||
public static bool sysAgent
|
|
||||||
{
|
|
||||||
get; set;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// socks端口
|
|
||||||
/// </summary>
|
|
||||||
public static int socksPort
|
|
||||||
{
|
|
||||||
get; set;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// http端口
|
|
||||||
/// </summary>
|
|
||||||
public static int httpPort
|
|
||||||
{
|
|
||||||
get; set;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -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
|
||||||
|
|
||||||
@@ -184,6 +185,31 @@ namespace v2rayN.Handler
|
|||||||
LazyConfig.Instance.SetConfig(ref config);
|
LazyConfig.Instance.SetConfig(ref config);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 保参数
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="config"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static int SaveConfig(ref Config config, bool reload = true)
|
||||||
|
{
|
||||||
|
Global.reloadV2ray = reload;
|
||||||
|
|
||||||
|
ToJsonFile(config);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 存储文件
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="config"></param>
|
||||||
|
private static void ToJsonFile(Config config)
|
||||||
|
{
|
||||||
|
lock (objLock)
|
||||||
|
{
|
||||||
|
Utils.ToJsonFile(config, Utils.GetPath(configRes));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
@@ -235,7 +261,7 @@ namespace v2rayN.Handler
|
|||||||
var index = config.FindIndexId(item.indexId);
|
var index = config.FindIndexId(item.indexId);
|
||||||
if (index >= 0)
|
if (index >= 0)
|
||||||
{
|
{
|
||||||
config.vmess.RemoveAt(index);
|
RemoveVmessItem(config, index);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -323,29 +349,6 @@ namespace v2rayN.Handler
|
|||||||
return config.vmess[index];
|
return config.vmess[index];
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 保参数
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="config"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public static int SaveConfig(ref Config config, bool reload = true)
|
|
||||||
{
|
|
||||||
Global.reloadV2ray = reload;
|
|
||||||
|
|
||||||
ToJsonFile(config);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 存储文件
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="config"></param>
|
|
||||||
private static void ToJsonFile(Config config)
|
|
||||||
{
|
|
||||||
Utils.ToJsonFile(config, Utils.GetPath(configRes));
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 移动服务器
|
/// 移动服务器
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -354,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)
|
||||||
@@ -410,6 +413,9 @@ namespace v2rayN.Handler
|
|||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case EMove.Position:
|
||||||
|
lstVmess[index].sort = pos * 10 + 1;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
ToJsonFile(config);
|
ToJsonFile(config);
|
||||||
@@ -423,15 +429,24 @@ namespace v2rayN.Handler
|
|||||||
/// <param name="config"></param>
|
/// <param name="config"></param>
|
||||||
/// <param name="vmessItem"></param>
|
/// <param name="vmessItem"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public static int AddCustomServer(ref Config config, VmessItem vmessItem)
|
public static int AddCustomServer(ref Config config, VmessItem vmessItem, bool blDelete)
|
||||||
{
|
{
|
||||||
var fileName = vmessItem.address;
|
var fileName = vmessItem.address;
|
||||||
string newFileName = string.Format("{0}.json", Utils.GetGUID());
|
if (!File.Exists(fileName))
|
||||||
|
{
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
var ext = Path.GetExtension(fileName);
|
||||||
|
string newFileName = string.Format("{0}{1}", Utils.GetGUID(), ext);
|
||||||
//newFileName = Path.Combine(Utils.GetTempPath(), newFileName);
|
//newFileName = Path.Combine(Utils.GetTempPath(), newFileName);
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
File.Copy(fileName, Path.Combine(Utils.GetTempPath(), newFileName));
|
File.Copy(fileName, Path.Combine(Utils.GetConfigPath(), newFileName));
|
||||||
|
if (blDelete)
|
||||||
|
{
|
||||||
|
File.Delete(fileName);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
@@ -480,7 +495,7 @@ namespace v2rayN.Handler
|
|||||||
vmessItem.id = vmessItem.id.TrimEx();
|
vmessItem.id = vmessItem.id.TrimEx();
|
||||||
vmessItem.security = vmessItem.security.TrimEx();
|
vmessItem.security = vmessItem.security.TrimEx();
|
||||||
|
|
||||||
if (!config.GetShadowsocksSecuritys().Contains(vmessItem.security))
|
if (!LazyConfig.Instance.GetShadowsocksSecuritys().Contains(vmessItem.security))
|
||||||
{
|
{
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@@ -517,7 +532,6 @@ namespace v2rayN.Handler
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 添加服务器或编辑
|
/// 添加服务器或编辑
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -614,178 +628,6 @@ namespace v2rayN.Handler
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 批量添加服务器
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="config"></param>
|
|
||||||
/// <param name="clipboardData"></param>
|
|
||||||
/// <param name="subid"></param>
|
|
||||||
/// <returns>成功导入的数量</returns>
|
|
||||||
public static int AddBatchServers(ref Config config, string clipboardData, string subid, List<VmessItem> lstOriSub, string groupId)
|
|
||||||
{
|
|
||||||
if (Utils.IsNullOrEmpty(clipboardData))
|
|
||||||
{
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
//copy sub items
|
|
||||||
if (!Utils.IsNullOrEmpty(subid))
|
|
||||||
{
|
|
||||||
RemoveServerViaSubid(ref config, subid);
|
|
||||||
}
|
|
||||||
//if (clipboardData.IndexOf("vmess") >= 0 && clipboardData.IndexOf("vmess") == clipboardData.LastIndexOf("vmess"))
|
|
||||||
//{
|
|
||||||
// clipboardData = clipboardData.Replace("\r\n", "").Replace("\n", "");
|
|
||||||
//}
|
|
||||||
int countServers = 0;
|
|
||||||
|
|
||||||
//string[] arrData = clipboardData.Split(new string[] { "\r\n" }, StringSplitOptions.None);
|
|
||||||
string[] arrData = clipboardData.Split(Environment.NewLine.ToCharArray());
|
|
||||||
foreach (string str in arrData)
|
|
||||||
{
|
|
||||||
//maybe sub
|
|
||||||
if (Utils.IsNullOrEmpty(subid) && (str.StartsWith(Global.httpsProtocol) || str.StartsWith(Global.httpProtocol)))
|
|
||||||
{
|
|
||||||
if (AddSubItem(ref config, str) == 0)
|
|
||||||
{
|
|
||||||
countServers++;
|
|
||||||
}
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
VmessItem vmessItem = ShareHandler.ImportFromClipboardConfig(str, out string msg);
|
|
||||||
if (vmessItem == null)
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
//exist sub items
|
|
||||||
if (!Utils.IsNullOrEmpty(subid))
|
|
||||||
{
|
|
||||||
var existItem = lstOriSub?.FirstOrDefault(t => CompareVmessItem(t, vmessItem, true));
|
|
||||||
if (existItem != null)
|
|
||||||
{
|
|
||||||
vmessItem = existItem;
|
|
||||||
}
|
|
||||||
vmessItem.subid = subid;
|
|
||||||
}
|
|
||||||
|
|
||||||
//groupId
|
|
||||||
vmessItem.groupId = groupId;
|
|
||||||
|
|
||||||
if (vmessItem.configType == EConfigType.Vmess)
|
|
||||||
{
|
|
||||||
if (AddServer(ref config, vmessItem, false) == 0)
|
|
||||||
{
|
|
||||||
countServers++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (vmessItem.configType == EConfigType.Shadowsocks)
|
|
||||||
{
|
|
||||||
if (AddShadowsocksServer(ref config, vmessItem, false) == 0)
|
|
||||||
{
|
|
||||||
countServers++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (vmessItem.configType == EConfigType.Socks)
|
|
||||||
{
|
|
||||||
if (AddSocksServer(ref config, vmessItem, false) == 0)
|
|
||||||
{
|
|
||||||
countServers++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (vmessItem.configType == EConfigType.Trojan)
|
|
||||||
{
|
|
||||||
if (AddTrojanServer(ref config, vmessItem, false) == 0)
|
|
||||||
{
|
|
||||||
countServers++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (vmessItem.configType == EConfigType.VLESS)
|
|
||||||
{
|
|
||||||
if (AddVlessServer(ref config, vmessItem, false) == 0)
|
|
||||||
{
|
|
||||||
countServers++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ToJsonFile(config);
|
|
||||||
return countServers;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// add sub
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="config"></param>
|
|
||||||
/// <param name="url"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public static int AddSubItem(ref Config config, string url)
|
|
||||||
{
|
|
||||||
//already exists
|
|
||||||
if (config.subItem.FindIndex(e => e.url == url) >= 0)
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
SubItem subItem = new SubItem
|
|
||||||
{
|
|
||||||
id = string.Empty,
|
|
||||||
remarks = "import sub",
|
|
||||||
url = url
|
|
||||||
};
|
|
||||||
config.subItem.Add(subItem);
|
|
||||||
|
|
||||||
return SaveSubItem(ref config);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// save sub
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="config"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public static int SaveSubItem(ref Config config)
|
|
||||||
{
|
|
||||||
if (config.subItem == null)
|
|
||||||
{
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach (SubItem item in config.subItem)
|
|
||||||
{
|
|
||||||
if (Utils.IsNullOrEmpty(item.id))
|
|
||||||
{
|
|
||||||
item.id = Utils.GetGUID(false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ToJsonFile(config);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 移除服务器
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="config"></param>
|
|
||||||
/// <param name="subid"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public static int RemoveServerViaSubid(ref Config config, string subid)
|
|
||||||
{
|
|
||||||
if (Utils.IsNullOrEmpty(subid) || config.vmess.Count <= 0)
|
|
||||||
{
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
for (int k = config.vmess.Count - 1; k >= 0; k--)
|
|
||||||
{
|
|
||||||
if (config.vmess[k].subid.Equals(subid))
|
|
||||||
{
|
|
||||||
config.vmess.RemoveAt(k);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ToJsonFile(config);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static int SortServers(ref Config config, ref List<VmessItem> lstVmess, EServerColName name, bool asc)
|
public static int SortServers(ref Config config, ref List<VmessItem> lstVmess, EServerColName name, bool asc)
|
||||||
{
|
{
|
||||||
if (lstVmess.Count <= 0)
|
if (lstVmess.Count <= 0)
|
||||||
@@ -879,14 +721,14 @@ namespace v2rayN.Handler
|
|||||||
var index = config.FindIndexId(item.indexId);
|
var index = config.FindIndexId(item.indexId);
|
||||||
if (index >= 0)
|
if (index >= 0)
|
||||||
{
|
{
|
||||||
config.vmess.RemoveAt(index);
|
RemoveVmessItem(config, index);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//if (!keepOlder) list.Reverse();
|
//if (!keepOlder) list.Reverse();
|
||||||
//config.vmess = list;
|
//config.vmess = list;
|
||||||
|
|
||||||
return 0;
|
return list.Count;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int AddServerCommon(ref Config config, VmessItem vmessItem)
|
public static int AddServerCommon(ref Config config, VmessItem vmessItem)
|
||||||
@@ -905,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;
|
||||||
@@ -913,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;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -944,6 +785,300 @@ namespace v2rayN.Handler
|
|||||||
&& (remarks ? o.remarks == n.remarks : true);
|
&& (remarks ? o.remarks == n.remarks : true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static int RemoveVmessItem(Config config, int index)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (config.vmess[index].configType == EConfigType.Custom)
|
||||||
|
{
|
||||||
|
File.Delete(Utils.GetConfigPath(config.vmess[index].address));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Utils.SaveLog("RemoveVmessItem", ex);
|
||||||
|
}
|
||||||
|
config.vmess.RemoveAt(index);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Batch add servers
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 批量添加服务器
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="config"></param>
|
||||||
|
/// <param name="clipboardData"></param>
|
||||||
|
/// <param name="subid"></param>
|
||||||
|
/// <returns>成功导入的数量</returns>
|
||||||
|
private static int AddBatchServers(ref Config config, string clipboardData, string subid, List<VmessItem> lstOriSub, string groupId)
|
||||||
|
{
|
||||||
|
if (Utils.IsNullOrEmpty(clipboardData))
|
||||||
|
{
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
//copy sub items
|
||||||
|
if (!Utils.IsNullOrEmpty(subid))
|
||||||
|
{
|
||||||
|
RemoveServerViaSubid(ref config, subid);
|
||||||
|
}
|
||||||
|
//if (clipboardData.IndexOf("vmess") >= 0 && clipboardData.IndexOf("vmess") == clipboardData.LastIndexOf("vmess"))
|
||||||
|
//{
|
||||||
|
// clipboardData = clipboardData.Replace("\r\n", "").Replace("\n", "");
|
||||||
|
//}
|
||||||
|
int countServers = 0;
|
||||||
|
|
||||||
|
//string[] arrData = clipboardData.Split(new string[] { "\r\n" }, StringSplitOptions.None);
|
||||||
|
string[] arrData = clipboardData.Split(Environment.NewLine.ToCharArray());
|
||||||
|
foreach (string str in arrData)
|
||||||
|
{
|
||||||
|
//maybe sub
|
||||||
|
if (Utils.IsNullOrEmpty(subid) && (str.StartsWith(Global.httpsProtocol) || str.StartsWith(Global.httpProtocol)))
|
||||||
|
{
|
||||||
|
if (AddSubItem(ref config, str) == 0)
|
||||||
|
{
|
||||||
|
countServers++;
|
||||||
|
}
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
VmessItem vmessItem = ShareHandler.ImportFromClipboardConfig(str, out string msg);
|
||||||
|
if (vmessItem == null)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
//exist sub items
|
||||||
|
if (!Utils.IsNullOrEmpty(subid))
|
||||||
|
{
|
||||||
|
var existItem = lstOriSub?.FirstOrDefault(t => CompareVmessItem(t, vmessItem, true));
|
||||||
|
if (existItem != null)
|
||||||
|
{
|
||||||
|
vmessItem = existItem;
|
||||||
|
}
|
||||||
|
vmessItem.subid = subid;
|
||||||
|
}
|
||||||
|
|
||||||
|
//groupId
|
||||||
|
vmessItem.groupId = groupId;
|
||||||
|
|
||||||
|
if (vmessItem.configType == EConfigType.Vmess)
|
||||||
|
{
|
||||||
|
if (AddServer(ref config, vmessItem, false) == 0)
|
||||||
|
{
|
||||||
|
countServers++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (vmessItem.configType == EConfigType.Shadowsocks)
|
||||||
|
{
|
||||||
|
if (AddShadowsocksServer(ref config, vmessItem, false) == 0)
|
||||||
|
{
|
||||||
|
countServers++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (vmessItem.configType == EConfigType.Socks)
|
||||||
|
{
|
||||||
|
if (AddSocksServer(ref config, vmessItem, false) == 0)
|
||||||
|
{
|
||||||
|
countServers++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (vmessItem.configType == EConfigType.Trojan)
|
||||||
|
{
|
||||||
|
if (AddTrojanServer(ref config, vmessItem, false) == 0)
|
||||||
|
{
|
||||||
|
countServers++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (vmessItem.configType == EConfigType.VLESS)
|
||||||
|
{
|
||||||
|
if (AddVlessServer(ref config, vmessItem, false) == 0)
|
||||||
|
{
|
||||||
|
countServers++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ToJsonFile(config);
|
||||||
|
return countServers;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static int AddBatchServers4Custom(ref Config config, string clipboardData, string subid, List<VmessItem> lstOriSub, string groupId)
|
||||||
|
{
|
||||||
|
if (Utils.IsNullOrEmpty(clipboardData))
|
||||||
|
{
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
VmessItem vmessItem = new VmessItem();
|
||||||
|
//Is v2ray configuration
|
||||||
|
V2rayConfig v2rayConfig = Utils.FromJson<V2rayConfig>(clipboardData);
|
||||||
|
if (v2rayConfig != null
|
||||||
|
&& v2rayConfig.inbounds != null
|
||||||
|
&& v2rayConfig.inbounds.Count > 0
|
||||||
|
&& v2rayConfig.outbounds != null
|
||||||
|
&& v2rayConfig.outbounds.Count > 0)
|
||||||
|
{
|
||||||
|
var fileName = Utils.GetTempPath($"{Utils.GetGUID(false)}.json");
|
||||||
|
File.WriteAllText(fileName, clipboardData);
|
||||||
|
|
||||||
|
vmessItem.coreType = ECoreType.Xray;
|
||||||
|
vmessItem.address = fileName;
|
||||||
|
vmessItem.remarks = "v2ray_custom";
|
||||||
|
}
|
||||||
|
//Is Clash configuration
|
||||||
|
else if (clipboardData.IndexOf("port") >= 0
|
||||||
|
&& clipboardData.IndexOf("socks-port") >= 0
|
||||||
|
&& clipboardData.IndexOf("proxies") >= 0)
|
||||||
|
{
|
||||||
|
var fileName = Utils.GetTempPath($"{Utils.GetGUID(false)}.yaml");
|
||||||
|
File.WriteAllText(fileName, clipboardData);
|
||||||
|
|
||||||
|
vmessItem.coreType = ECoreType.clash;
|
||||||
|
vmessItem.address = fileName;
|
||||||
|
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))
|
||||||
|
{
|
||||||
|
RemoveServerViaSubid(ref config, subid);
|
||||||
|
}
|
||||||
|
if (lstOriSub != null && lstOriSub.Count == 1)
|
||||||
|
{
|
||||||
|
vmessItem.indexId = lstOriSub[0].indexId;
|
||||||
|
}
|
||||||
|
vmessItem.subid = subid;
|
||||||
|
vmessItem.groupId = groupId;
|
||||||
|
|
||||||
|
if (Utils.IsNullOrEmpty(vmessItem.address))
|
||||||
|
{
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (AddCustomServer(ref config, vmessItem, true) == 0)
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static int AddBatchServers(ref Config config, string clipboardData, string subid, string groupId)
|
||||||
|
{
|
||||||
|
List<VmessItem> lstOriSub = null;
|
||||||
|
if (!Utils.IsNullOrEmpty(subid))
|
||||||
|
{
|
||||||
|
lstOriSub = config.vmess.Where(it => it.subid == subid).ToList();
|
||||||
|
}
|
||||||
|
|
||||||
|
int counter = AddBatchServers(ref config, clipboardData, subid, lstOriSub, groupId);
|
||||||
|
if (counter < 1)
|
||||||
|
{
|
||||||
|
counter = AddBatchServers(ref config, Utils.Base64Decode(clipboardData), subid, lstOriSub, groupId);
|
||||||
|
}
|
||||||
|
|
||||||
|
//maybe other sub
|
||||||
|
if (counter < 1)
|
||||||
|
{
|
||||||
|
counter = AddBatchServers4Custom(ref config, clipboardData, subid, lstOriSub, groupId);
|
||||||
|
}
|
||||||
|
|
||||||
|
return counter;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Sub & Group
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// add sub
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="config"></param>
|
||||||
|
/// <param name="url"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static int AddSubItem(ref Config config, string url)
|
||||||
|
{
|
||||||
|
//already exists
|
||||||
|
if (config.subItem.FindIndex(e => e.url == url) >= 0)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
SubItem subItem = new SubItem
|
||||||
|
{
|
||||||
|
id = string.Empty,
|
||||||
|
remarks = "import sub",
|
||||||
|
url = url
|
||||||
|
};
|
||||||
|
config.subItem.Add(subItem);
|
||||||
|
|
||||||
|
return SaveSubItem(ref config);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// save sub
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="config"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static int SaveSubItem(ref Config config)
|
||||||
|
{
|
||||||
|
if (config.subItem == null)
|
||||||
|
{
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (SubItem item in config.subItem)
|
||||||
|
{
|
||||||
|
if (Utils.IsNullOrEmpty(item.id))
|
||||||
|
{
|
||||||
|
item.id = Utils.GetGUID(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ToJsonFile(config);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 移除服务器
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="config"></param>
|
||||||
|
/// <param name="subid"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static int RemoveServerViaSubid(ref Config config, string subid)
|
||||||
|
{
|
||||||
|
if (Utils.IsNullOrEmpty(subid) || config.vmess.Count <= 0)
|
||||||
|
{
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
for (int k = config.vmess.Count - 1; k >= 0; k--)
|
||||||
|
{
|
||||||
|
if (config.vmess[k].subid.Equals(subid))
|
||||||
|
{
|
||||||
|
RemoveVmessItem(config, k);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ToJsonFile(config);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// save Group
|
/// save Group
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -994,6 +1129,18 @@ namespace v2rayN.Handler
|
|||||||
ToJsonFile(config);
|
ToJsonFile(config);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static int MoveServerToGroup(Config config, List<VmessItem> indexs, string groupId)
|
||||||
|
{
|
||||||
|
foreach (var item in indexs)
|
||||||
|
{
|
||||||
|
item.groupId = groupId;
|
||||||
|
}
|
||||||
|
|
||||||
|
ToJsonFile(config);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region UI
|
#region UI
|
||||||
@@ -1012,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)
|
||||||
@@ -1126,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)
|
||||||
@@ -1184,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;
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
|
using System.Text;
|
||||||
using v2rayN.Base;
|
using v2rayN.Base;
|
||||||
|
using v2rayN.Resx;
|
||||||
|
|
||||||
namespace v2rayN.Handler
|
namespace v2rayN.Handler
|
||||||
{
|
{
|
||||||
@@ -38,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;
|
||||||
@@ -139,6 +141,7 @@ namespace v2rayN.Handler
|
|||||||
Utils.SetSecurityProtocol(LazyConfig.Instance.GetConfig().enableSecurityProtocolTls13);
|
Utils.SetSecurityProtocol(LazyConfig.Instance.GetConfig().enableSecurityProtocolTls13);
|
||||||
|
|
||||||
WebClientEx ws = new WebClientEx();
|
WebClientEx ws = new WebClientEx();
|
||||||
|
ws.Encoding = Encoding.UTF8;
|
||||||
if (webProxy != null)
|
if (webProxy != null)
|
||||||
{
|
{
|
||||||
ws.Proxy = webProxy;
|
ws.Proxy = webProxy;
|
||||||
@@ -197,7 +200,7 @@ namespace v2rayN.Handler
|
|||||||
Utils.SetSecurityProtocol(LazyConfig.Instance.GetConfig().enableSecurityProtocolTls13);
|
Utils.SetSecurityProtocol(LazyConfig.Instance.GetConfig().enableSecurityProtocolTls13);
|
||||||
|
|
||||||
WebClientEx ws = new WebClientEx();
|
WebClientEx ws = new WebClientEx();
|
||||||
|
ws.Encoding = Encoding.UTF8;
|
||||||
return ws.DownloadString(new Uri(url));
|
return ws.DownloadString(new Uri(url));
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
@@ -213,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;
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
using System;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using v2rayN.Mode;
|
using v2rayN.Mode;
|
||||||
|
using System.Linq;
|
||||||
|
|
||||||
namespace v2rayN.Handler
|
namespace v2rayN.Handler
|
||||||
{
|
{
|
||||||
@@ -7,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
|
||||||
{
|
{
|
||||||
@@ -20,5 +23,82 @@ namespace v2rayN.Handler
|
|||||||
{
|
{
|
||||||
return _config;
|
return _config;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<string> GetShadowsocksSecuritys()
|
||||||
|
{
|
||||||
|
if (GetCoreType(null, EConfigType.Shadowsocks) == ECoreType.v2fly)
|
||||||
|
{
|
||||||
|
return Global.ssSecuritys;
|
||||||
|
}
|
||||||
|
|
||||||
|
return Global.ssSecuritysInXray;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ECoreType GetCoreType(VmessItem vmessItem, EConfigType eConfigType)
|
||||||
|
{
|
||||||
|
if (vmessItem != null && vmessItem.coreType != null)
|
||||||
|
{
|
||||||
|
return (ECoreType)vmessItem.coreType;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_config.coreTypeItem == null)
|
||||||
|
{
|
||||||
|
return ECoreType.Xray;
|
||||||
|
}
|
||||||
|
var item = _config.coreTypeItem.FirstOrDefault(it => it.configType == eConfigType);
|
||||||
|
if (item == null)
|
||||||
|
{
|
||||||
|
return ECoreType.Xray;
|
||||||
|
}
|
||||||
|
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
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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
|
||||||
{
|
{
|
||||||
@@ -53,7 +54,7 @@ namespace v2rayN.Handler
|
|||||||
if (!Utils.IsNullOrEmpty(item.customIcon) && File.Exists(item.customIcon))
|
if (!Utils.IsNullOrEmpty(item.customIcon) && File.Exists(item.customIcon))
|
||||||
{
|
{
|
||||||
graphics.FillRectangle(drawBrush, new Rectangle(0, 0, width, height));
|
graphics.FillRectangle(drawBrush, new Rectangle(0, 0, width, height));
|
||||||
graphics.DrawImage(new Bitmap(item.customIcon), 0, 0);
|
graphics.DrawImage(new Bitmap(item.customIcon), 0, 0, width, height);
|
||||||
customIcon = true;
|
customIcon = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -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,33 +156,16 @@ namespace v2rayN.Handler
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
UI.ShowWarning(string.Format(UIRes.I18N("SaveServerConfigurationIn"), fileName));
|
UI.ShowWarning(string.Format(ResUI.SaveServerConfigurationIn, fileName));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public int AddBatchServers(Config config, string clipboardData, string subid, string groupId)
|
|
||||||
{
|
|
||||||
List<VmessItem> lstOriSub = null;
|
|
||||||
if (!Utils.IsNullOrEmpty(subid))
|
|
||||||
{
|
|
||||||
lstOriSub = config.vmess.Where(it => it.subid == subid).ToList();
|
|
||||||
}
|
|
||||||
|
|
||||||
int counter = ConfigHandler.AddBatchServers(ref config, clipboardData, subid, lstOriSub, groupId);
|
|
||||||
if (counter < 1)
|
|
||||||
{
|
|
||||||
counter = ConfigHandler.AddBatchServers(ref config, Utils.Base64Decode(clipboardData), subid, lstOriSub, groupId);
|
|
||||||
}
|
|
||||||
|
|
||||||
return counter;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void BackupGuiNConfig(Config config, bool auto = false)
|
public void BackupGuiNConfig(Config config, bool auto = false)
|
||||||
{
|
{
|
||||||
string fileName = $"guiNConfig_{DateTime.Now.ToString("yyyy_MM_dd_HH_mm_ss_fff")}.json";
|
string fileName = $"guiNConfig_{DateTime.Now.ToString("yyyy_MM_dd_HH_mm_ss_fff")}.json";
|
||||||
if (auto)
|
if (auto)
|
||||||
{
|
{
|
||||||
fileName = Utils.GetTempPath(fileName);
|
fileName = Utils.GetBackupPath(fileName);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -208,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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -285,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);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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);
|
||||||
|
|||||||
@@ -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
|
||||||
{
|
{
|
||||||
@@ -21,7 +22,7 @@ namespace v2rayN.Handler
|
|||||||
_config = config;
|
_config = config;
|
||||||
}
|
}
|
||||||
|
|
||||||
public SpeedtestHandler(ref Config config, ref V2rayHandler v2rayHandler, List<VmessItem> selecteds, string actionType, Action<string, string> update)
|
public SpeedtestHandler(ref Config config, V2rayHandler v2rayHandler, List<VmessItem> selecteds, ESpeedActionType actionType, Action<string, string> update)
|
||||||
{
|
{
|
||||||
_config = config;
|
_config = config;
|
||||||
_v2rayHandler = v2rayHandler;
|
_v2rayHandler = v2rayHandler;
|
||||||
@@ -40,19 +41,19 @@ namespace v2rayN.Handler
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (actionType == "ping")
|
if (actionType == ESpeedActionType.Ping)
|
||||||
{
|
{
|
||||||
Task.Run(() => RunPing());
|
Task.Run(() => RunPing());
|
||||||
}
|
}
|
||||||
if (actionType == "tcping")
|
else if (actionType == ESpeedActionType.Tcping)
|
||||||
{
|
{
|
||||||
Task.Run(() => RunTcping());
|
Task.Run(() => RunTcping());
|
||||||
}
|
}
|
||||||
else if (actionType == "realping")
|
else if (actionType == ESpeedActionType.Realping)
|
||||||
{
|
{
|
||||||
Task.Run(() => RunRealPing());
|
Task.Run(() => RunRealPing());
|
||||||
}
|
}
|
||||||
else if (actionType == "speedtest")
|
else if (actionType == ESpeedActionType.Speedtest)
|
||||||
{
|
{
|
||||||
Task.Run(() => RunSpeedTest());
|
Task.Run(() => RunSpeedTest());
|
||||||
}
|
}
|
||||||
@@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -168,7 +169,7 @@ namespace v2rayN.Handler
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
int httpPort = _config.GetLocalPort(Global.InboundHttp);
|
int httpPort = _config.GetLocalPort(Global.InboundHttp2);
|
||||||
|
|
||||||
Task<int> t = Task.Run(() =>
|
Task<int> t = Task.Run(() =>
|
||||||
{
|
{
|
||||||
@@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -59,8 +59,7 @@ namespace v2rayN.Handler
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Global.httpPort = config.GetLocalPort(Global.InboundHttp);
|
int port = config.GetLocalPort(Global.InboundHttp2);
|
||||||
int port = Global.httpPort;
|
|
||||||
if (port <= 0)
|
if (port <= 0)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -182,14 +183,14 @@ namespace v2rayN.Handler
|
|||||||
string url = config.subItem[k - 1].url.TrimEx();
|
string url = config.subItem[k - 1].url.TrimEx();
|
||||||
string userAgent = config.subItem[k - 1].userAgent.TrimEx();
|
string userAgent = config.subItem[k - 1].userAgent.TrimEx();
|
||||||
string groupId = config.subItem[k - 1].groupId.TrimEx();
|
string groupId = config.subItem[k - 1].groupId.TrimEx();
|
||||||
string hashCode = $"{k}->";
|
string hashCode = $"{k}){config.subItem[k - 1].remarks}->";
|
||||||
if (config.subItem[k - 1].enabled == false)
|
if (config.subItem[k - 1].enabled == false)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
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,28 +199,28 @@ 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 = MainFormHandler.Instance.AddBatchServers(config, result, id, groupId);
|
int ret = ConfigHandler.AddBatchServers(ref config, result, id, groupId);
|
||||||
if (ret > 0)
|
if (ret > 0)
|
||||||
{
|
{
|
||||||
// RefreshServers();
|
// RefreshServers();
|
||||||
}
|
}
|
||||||
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
|
||||||
{
|
{
|
||||||
@@ -231,10 +232,10 @@ namespace v2rayN.Handler
|
|||||||
_updateFunc(false, args.GetException().Message);
|
_updateFunc(false, args.GetException().Message);
|
||||||
};
|
};
|
||||||
|
|
||||||
WebProxy webProxy = blProxy ? new WebProxy(Global.Loopback, _config.GetLocalPort(Global.InboundHttp)) : null;
|
WebProxy webProxy = blProxy ? new WebProxy(Global.Loopback, _config.GetLocalPort(Global.InboundHttp2)) : 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
|
||||||
{
|
{
|
||||||
@@ -303,22 +304,22 @@ namespace v2rayN.Handler
|
|||||||
};
|
};
|
||||||
if (httpProxyTest() > 0)
|
if (httpProxyTest() > 0)
|
||||||
{
|
{
|
||||||
int httpPort = _config.GetLocalPort(Global.InboundHttp);
|
int httpPort = _config.GetLocalPort(Global.InboundHttp2);
|
||||||
WebProxy webProxy = new WebProxy(Global.Loopback, httpPort);
|
WebProxy webProxy = new WebProxy(Global.Loopback, httpPort);
|
||||||
webRequestHandler.Proxy = webProxy;
|
webRequestHandler.Proxy = webProxy;
|
||||||
}
|
}
|
||||||
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;
|
||||||
}
|
}
|
||||||
@@ -459,7 +460,7 @@ namespace v2rayN.Handler
|
|||||||
{
|
{
|
||||||
if (httpProxyTest() > 0)
|
if (httpProxyTest() > 0)
|
||||||
{
|
{
|
||||||
int httpPort = _config.GetLocalPort(Global.InboundHttp);
|
int httpPort = _config.GetLocalPort(Global.InboundHttp2);
|
||||||
WebProxy webProxy = new WebProxy(Global.Loopback, httpPort);
|
WebProxy webProxy = new WebProxy(Global.Loopback, httpPort);
|
||||||
downloadHandle.DownloadFileAsync(url, webProxy, 600);
|
downloadHandle.DownloadFileAsync(url, webProxy, 600);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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;
|
||||||
@@ -149,7 +150,7 @@ namespace v2rayN.Handler
|
|||||||
inbound.tag = Global.InboundSocks;
|
inbound.tag = Global.InboundSocks;
|
||||||
inbound.port = config.inbound[0].localPort;
|
inbound.port = config.inbound[0].localPort;
|
||||||
inbound.protocol = config.inbound[0].protocol;
|
inbound.protocol = config.inbound[0].protocol;
|
||||||
if (config.allowLANConn)
|
if (config.inbound[0].allowLANConn)
|
||||||
{
|
{
|
||||||
inbound.listen = "0.0.0.0";
|
inbound.listen = "0.0.0.0";
|
||||||
}
|
}
|
||||||
@@ -168,6 +169,25 @@ 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;
|
||||||
|
|
||||||
|
//auth
|
||||||
|
if (!Utils.IsNullOrEmpty(config.inbound[0].user) && !Utils.IsNullOrEmpty(config.inbound[0].pass))
|
||||||
|
{
|
||||||
|
inbound.settings.auth = "password";
|
||||||
|
inbound.settings.accounts = new List<AccountsItem> { new AccountsItem() { user = config.inbound[0].user, pass = config.inbound[0].pass } };
|
||||||
|
inbound2.settings.auth = "password";
|
||||||
|
inbound2.settings.accounts = new List<AccountsItem> { new AccountsItem() { user = config.inbound[0].user, pass = config.inbound[0].pass } };
|
||||||
|
}
|
||||||
|
|
||||||
|
//http Loopback
|
||||||
|
Inbounds inbound3 = v2rayConfig.inbounds[2];
|
||||||
|
inbound3.tag = Global.InboundHttp2;
|
||||||
|
inbound3.port = config.GetLocalPort(Global.InboundHttp2);
|
||||||
|
inbound3.protocol = Global.InboundHttp;
|
||||||
|
inbound3.listen = Global.Loopback;
|
||||||
|
inbound3.settings.allowTransparent = false;
|
||||||
|
inbound3.sniffing.enabled = inbound.sniffing.enabled;
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
@@ -400,7 +420,7 @@ namespace v2rayN.Handler
|
|||||||
serversItem.address = node.address;
|
serversItem.address = node.address;
|
||||||
serversItem.port = node.port;
|
serversItem.port = node.port;
|
||||||
serversItem.password = node.id;
|
serversItem.password = node.id;
|
||||||
if (config.GetShadowsocksSecuritys().Contains(node.security))
|
if (LazyConfig.Instance.GetShadowsocksSecuritys().Contains(node.security))
|
||||||
{
|
{
|
||||||
serversItem.method = node.security;
|
serversItem.method = node.security;
|
||||||
}
|
}
|
||||||
@@ -900,7 +920,7 @@ namespace v2rayN.Handler
|
|||||||
//检查GUI设置
|
//检查GUI设置
|
||||||
if (node == null)
|
if (node == null)
|
||||||
{
|
{
|
||||||
msg = UIRes.I18N("CheckServerSettings");
|
msg = ResUI.CheckServerSettings;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -912,20 +932,43 @@ namespace v2rayN.Handler
|
|||||||
string addressFileName = node.address;
|
string addressFileName = node.address;
|
||||||
if (!File.Exists(addressFileName))
|
if (!File.Exists(addressFileName))
|
||||||
{
|
{
|
||||||
addressFileName = Path.Combine(Utils.GetTempPath(), addressFileName);
|
addressFileName = Path.Combine(Utils.GetConfigPath(), addressFileName);
|
||||||
}
|
}
|
||||||
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);
|
||||||
|
|
||||||
msg = string.Format(UIRes.I18N("SuccessfulConfiguration"), $"[{LazyConfig.Instance.GetConfig().GetGroupRemarks(node.groupId)}] {node.GetSummary()}");
|
//check again
|
||||||
|
if (!File.Exists(fileName))
|
||||||
|
{
|
||||||
|
msg = ResUI.FailedGenDefaultConfiguration;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
//overwrite port
|
||||||
|
var fileContent = File.ReadAllLines(fileName).ToList();
|
||||||
|
var coreType = LazyConfig.Instance.GetCoreType(node, node.configType);
|
||||||
|
switch (coreType)
|
||||||
|
{
|
||||||
|
case ECoreType.v2fly:
|
||||||
|
case ECoreType.Xray:
|
||||||
|
break;
|
||||||
|
case ECoreType.clash:
|
||||||
|
fileContent.Add($"port: {LazyConfig.Instance.GetConfig().GetLocalPort(Global.InboundHttp)}");
|
||||||
|
fileContent.Add($"socks-port: {LazyConfig.Instance.GetConfig().GetLocalPort(Global.InboundSocks)}");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
File.WriteAllLines(fileName, fileContent);
|
||||||
|
|
||||||
|
msg = string.Format(ResUI.SuccessfulConfiguration, $"[{LazyConfig.Instance.GetConfig().GetGroupRemarks(node.groupId)}] {node.GetSummary()}");
|
||||||
}
|
}
|
||||||
catch
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
msg = UIRes.I18N("FailedGenDefaultConfiguration");
|
Utils.SaveLog("GenerateClientCustomConfig", ex);
|
||||||
|
msg = ResUI.FailedGenDefaultConfiguration;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@@ -949,17 +992,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;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -967,7 +1010,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;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -984,11 +1027,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;
|
||||||
@@ -1086,7 +1129,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;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1094,14 +1137,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;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1115,7 +1158,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;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1208,7 +1251,7 @@ namespace v2rayN.Handler
|
|||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
msg = UIRes.I18N("IncorrectClientConfiguration");
|
msg = ResUI.IncorrectClientConfiguration;
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1232,7 +1275,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;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1240,14 +1283,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;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1259,7 +1302,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;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1353,7 +1396,7 @@ namespace v2rayN.Handler
|
|||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
msg = UIRes.I18N("IncorrectClientConfiguration");
|
msg = ResUI.IncorrectClientConfiguration;
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return vmessItem;
|
return vmessItem;
|
||||||
@@ -1394,25 +1437,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;
|
||||||
@@ -1493,12 +1536,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 "";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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,8 +22,7 @@ namespace v2rayN.Handler
|
|||||||
class V2rayHandler
|
class V2rayHandler
|
||||||
{
|
{
|
||||||
private static string v2rayConfigRes = Global.v2rayConfigFileName;
|
private static string v2rayConfigRes = Global.v2rayConfigFileName;
|
||||||
private List<string> lstV2ray;
|
private CoreInfo coreInfo;
|
||||||
private string coreUrl;
|
|
||||||
public event ProcessDelegate ProcessEvent;
|
public event ProcessDelegate ProcessEvent;
|
||||||
//private int processId = 0;
|
//private int processId = 0;
|
||||||
private Process _process;
|
private Process _process;
|
||||||
@@ -39,7 +39,17 @@ namespace v2rayN.Handler
|
|||||||
if (Global.reloadV2ray)
|
if (Global.reloadV2ray)
|
||||||
{
|
{
|
||||||
var item = ConfigHandler.GetDefaultServer(ref config);
|
var item = ConfigHandler.GetDefaultServer(ref config);
|
||||||
SetCore(config, item);
|
if (item == null)
|
||||||
|
{
|
||||||
|
ShowMsg(false, ResUI.CheckServerSettings);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
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)
|
||||||
{
|
{
|
||||||
@@ -99,7 +109,7 @@ namespace v2rayN.Handler
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
foreach (string vName in lstV2ray)
|
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)
|
||||||
@@ -156,12 +166,10 @@ namespace v2rayN.Handler
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private string V2rayFindexe()
|
private string V2rayFindexe(List<string> lstCoreTemp)
|
||||||
{
|
{
|
||||||
//查找v2ray文件是否存在
|
|
||||||
string fileName = string.Empty;
|
string fileName = string.Empty;
|
||||||
//lstV2ray.Reverse();
|
foreach (string name in lstCoreTemp)
|
||||||
foreach (string name in lstV2ray)
|
|
||||||
{
|
{
|
||||||
string vName = string.Format("{0}.exe", name);
|
string vName = string.Format("{0}.exe", name);
|
||||||
vName = Utils.GetPath(vName);
|
vName = Utils.GetPath(vName);
|
||||||
@@ -173,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;
|
||||||
@@ -184,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();
|
string fileName = V2rayFindexe(coreInfo.coreExes);
|
||||||
if (fileName == "") return;
|
if (fileName == "") return;
|
||||||
|
|
||||||
Process p = new Process
|
Process p = new Process
|
||||||
@@ -196,6 +204,7 @@ namespace v2rayN.Handler
|
|||||||
StartInfo = new ProcessStartInfo
|
StartInfo = new ProcessStartInfo
|
||||||
{
|
{
|
||||||
FileName = fileName,
|
FileName = fileName,
|
||||||
|
Arguments = coreInfo.arguments,
|
||||||
WorkingDirectory = Utils.StartupPath(),
|
WorkingDirectory = Utils.StartupPath(),
|
||||||
UseShellExecute = false,
|
UseShellExecute = false,
|
||||||
RedirectStandardOutput = true,
|
RedirectStandardOutput = true,
|
||||||
@@ -237,11 +246,11 @@ 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
|
||||||
{
|
{
|
||||||
string fileName = V2rayFindexe();
|
string fileName = V2rayFindexe(new List<string> { "xray" });
|
||||||
if (fileName == "") return -1;
|
if (fileName == "") return -1;
|
||||||
|
|
||||||
Process p = new Process
|
Process p = new Process
|
||||||
@@ -318,31 +327,21 @@ namespace v2rayN.Handler
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SetCore(Config config, VmessItem item)
|
private int SetCore(Config config, VmessItem item)
|
||||||
{
|
{
|
||||||
var coreType = config.GetCoreType(item.configType);
|
if (item == null)
|
||||||
if (item.coreType != null)
|
|
||||||
{
|
{
|
||||||
coreType = (ECoreType)item.coreType;
|
return -1;
|
||||||
}
|
}
|
||||||
|
var coreType = LazyConfig.Instance.GetCoreType(item, item.configType);
|
||||||
|
|
||||||
if (coreType == ECoreType.v2fly)
|
coreInfo = LazyConfig.Instance.GetCoreInfo(coreType);
|
||||||
|
|
||||||
|
if (coreInfo == null)
|
||||||
{
|
{
|
||||||
lstV2ray = new List<string>
|
return -1;
|
||||||
{
|
|
||||||
"wv2ray",
|
|
||||||
"v2ray"
|
|
||||||
};
|
|
||||||
coreUrl = Global.v2flyCoreUrl;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
lstV2ray = new List<string>
|
|
||||||
{
|
|
||||||
"xray"
|
|
||||||
};
|
|
||||||
coreUrl = Global.xrayCoreUrl;
|
|
||||||
}
|
}
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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
|
||||||
{
|
{
|
||||||
@@ -52,14 +52,6 @@ namespace v2rayN.Mode
|
|||||||
get; set;
|
get; set;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 允许来自局域网的连接
|
|
||||||
/// </summary>
|
|
||||||
public bool allowLANConn
|
|
||||||
{
|
|
||||||
get; set;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 启用实时网速和流量统计
|
/// 启用实时网速和流量统计
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -220,7 +212,10 @@ namespace v2rayN.Mode
|
|||||||
{
|
{
|
||||||
return GetLocalPort(Global.InboundSocks) + 1;
|
return GetLocalPort(Global.InboundSocks) + 1;
|
||||||
}
|
}
|
||||||
|
else if (protocol == Global.InboundHttp2)
|
||||||
|
{
|
||||||
|
return GetLocalPort(Global.InboundSocks) + 2;
|
||||||
|
}
|
||||||
else if (protocol == "speedtest")
|
else if (protocol == "speedtest")
|
||||||
{
|
{
|
||||||
return GetLocalPort(Global.InboundSocks) + 103;
|
return GetLocalPort(Global.InboundSocks) + 103;
|
||||||
@@ -256,16 +251,6 @@ namespace v2rayN.Mode
|
|||||||
return vmess.FirstOrDefault(it => it.indexId == id);
|
return vmess.FirstOrDefault(it => it.indexId == id);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<string> GetShadowsocksSecuritys()
|
|
||||||
{
|
|
||||||
if (GetCoreType(EConfigType.Shadowsocks) == ECoreType.v2fly)
|
|
||||||
{
|
|
||||||
return Global.ssSecuritys;
|
|
||||||
}
|
|
||||||
|
|
||||||
return Global.ssSecuritysInXray;
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool IsActiveNode(VmessItem item)
|
public bool IsActiveNode(VmessItem item)
|
||||||
{
|
{
|
||||||
if (!Utils.IsNullOrEmpty(item.indexId) && item.indexId == indexId)
|
if (!Utils.IsNullOrEmpty(item.indexId) && item.indexId == indexId)
|
||||||
@@ -285,19 +270,6 @@ namespace v2rayN.Mode
|
|||||||
return groupItem.Where(it => it.id == groupId).FirstOrDefault()?.remarks;
|
return groupItem.Where(it => it.id == groupId).FirstOrDefault()?.remarks;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ECoreType GetCoreType(EConfigType eConfigType)
|
|
||||||
{
|
|
||||||
if (coreTypeItem == null)
|
|
||||||
{
|
|
||||||
return ECoreType.v2fly;
|
|
||||||
}
|
|
||||||
var item = coreTypeItem.FirstOrDefault(it => it.configType == eConfigType);
|
|
||||||
if (item == null)
|
|
||||||
{
|
|
||||||
return ECoreType.v2fly;
|
|
||||||
}
|
|
||||||
return item.coreType;
|
|
||||||
}
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -358,7 +330,7 @@ namespace v2rayN.Mode
|
|||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
summary += string.Format("{0}", remarks);
|
summary += string.Format("{0}", remarks);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return summary;
|
return summary;
|
||||||
}
|
}
|
||||||
@@ -604,6 +576,13 @@ namespace v2rayN.Mode
|
|||||||
/// 开启流量探测
|
/// 开启流量探测
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool sniffingEnabled { get; set; } = true;
|
public bool sniffingEnabled { get; set; } = true;
|
||||||
|
|
||||||
|
public bool allowLANConn { get; set; }
|
||||||
|
|
||||||
|
public string user { get; set; }
|
||||||
|
|
||||||
|
public string pass { get; set; }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[Serializable]
|
[Serializable]
|
||||||
@@ -715,7 +694,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;
|
||||||
}
|
}
|
||||||
|
|||||||
17
v2rayN/v2rayN/Mode/CoreInfo.cs
Normal file
17
v2rayN/v2rayN/Mode/CoreInfo.cs
Normal 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; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -4,6 +4,9 @@ namespace v2rayN.Mode
|
|||||||
public enum ECoreType
|
public enum ECoreType
|
||||||
{
|
{
|
||||||
v2fly = 1,
|
v2fly = 1,
|
||||||
Xray = 2
|
Xray = 2,
|
||||||
|
clash = 11,
|
||||||
|
hysteria = 21,
|
||||||
|
v2rayN = 99
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
11
v2rayN/v2rayN/Mode/ESpeedActionType.cs
Normal file
11
v2rayN/v2rayN/Mode/ESpeedActionType.cs
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
|
||||||
|
namespace v2rayN.Mode
|
||||||
|
{
|
||||||
|
public enum ESpeedActionType
|
||||||
|
{
|
||||||
|
Ping,
|
||||||
|
Tcping,
|
||||||
|
Realping,
|
||||||
|
Speedtest
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -141,6 +141,7 @@ namespace v2rayN.Mode
|
|||||||
|
|
||||||
public bool allowTransparent { get; set; }
|
public bool allowTransparent { get; set; }
|
||||||
|
|
||||||
|
public List<AccountsItem> accounts { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class UsersItem
|
public class UsersItem
|
||||||
@@ -540,4 +541,15 @@ namespace v2rayN.Mode
|
|||||||
public bool multiMode { get; set; }
|
public bool multiMode { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class AccountsItem
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public string user { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public string pass { get; set; }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ namespace v2rayN
|
|||||||
{
|
{
|
||||||
Logging.Setup();
|
Logging.Setup();
|
||||||
Utils.SaveLog($"v2rayN start up | {Utils.GetVersion()} | {Utils.GetExePath()}");
|
Utils.SaveLog($"v2rayN start up | {Utils.GetVersion()} | {Utils.GetExePath()}");
|
||||||
|
Logging.ClearLogs();
|
||||||
|
|
||||||
//设置语言环境
|
//设置语言环境
|
||||||
string lang = Utils.RegReadValue(Global.MyRegPath, Global.MyRegKeyLanguage, "zh-Hans");
|
string lang = Utils.RegReadValue(Global.MyRegPath, Global.MyRegKeyLanguage, "zh-Hans");
|
||||||
@@ -42,7 +43,7 @@ namespace v2rayN
|
|||||||
|
|
||||||
Application.EnableVisualStyles();
|
Application.EnableVisualStyles();
|
||||||
Application.SetCompatibleTextRenderingDefault(false);
|
Application.SetCompatibleTextRenderingDefault(false);
|
||||||
Application.Run(new MainForm());
|
Application.Run(new MainForm());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ using System.Runtime.InteropServices;
|
|||||||
[assembly: AssemblyConfiguration("")]
|
[assembly: AssemblyConfiguration("")]
|
||||||
[assembly: AssemblyCompany("")]
|
[assembly: AssemblyCompany("")]
|
||||||
[assembly: AssemblyProduct("v2rayN")]
|
[assembly: AssemblyProduct("v2rayN")]
|
||||||
[assembly: AssemblyCopyright("Copyright © 2019-2020 (GPLv3)")]
|
[assembly: AssemblyCopyright("Copyright © 2019-2022 (GPLv3)")]
|
||||||
[assembly: AssemblyTrademark("")]
|
[assembly: AssemblyTrademark("")]
|
||||||
[assembly: AssemblyCulture("")]
|
[assembly: AssemblyCulture("")]
|
||||||
|
|
||||||
@@ -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.3")]
|
[assembly: AssemblyFileVersion("5.11")]
|
||||||
|
|||||||
11
v2rayN/v2rayN/Resx/ResUI.Designer.cs
generated
11
v2rayN/v2rayN/Resx/ResUI.Designer.cs
generated
@@ -115,7 +115,7 @@ namespace v2rayN.Resx {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 查找类似 Note that custom configuration relies entirely on your own configuration and does not work with all settings. The system agent is available when the socks port is equal to the port in the settings in the custom configuration inbound. 的本地化字符串。
|
/// 查找类似 Note that custom configuration relies entirely on your own configuration and does not work with all settings. If you want to use the system proxy, please modify the listening port manually. 的本地化字符串。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
internal static string CustomServerTips {
|
internal static string CustomServerTips {
|
||||||
get {
|
get {
|
||||||
@@ -934,6 +934,15 @@ namespace v2rayN.Resx {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 查找类似 System proxy 的本地化字符串。
|
||||||
|
/// </summary>
|
||||||
|
internal static string SystemProxy {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("SystemProxy", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 查找类似 The ping of current service: {0} 的本地化字符串。
|
/// 查找类似 The ping of current service: {0} 的本地化字符串。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -130,7 +130,7 @@
|
|||||||
<value> configuration format is incorrect</value>
|
<value> configuration format is incorrect</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="CustomServerTips" xml:space="preserve">
|
<data name="CustomServerTips" xml:space="preserve">
|
||||||
<value>Note that custom configuration relies entirely on your own configuration and does not work with all settings. The system agent is available when the socks port is equal to the port in the settings in the custom configuration inbound.</value>
|
<value>Note that custom configuration relies entirely on your own configuration and does not work with all settings. If you want to use the system proxy, please modify the listening port manually.</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="Downloading" xml:space="preserve">
|
<data name="Downloading" xml:space="preserve">
|
||||||
<value>Downloading...</value>
|
<value>Downloading...</value>
|
||||||
@@ -454,4 +454,7 @@
|
|||||||
<data name="FillServerAddressCustom" xml:space="preserve">
|
<data name="FillServerAddressCustom" xml:space="preserve">
|
||||||
<value>Please browse to import server configuration</value>
|
<value>Please browse to import server configuration</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="SystemProxy" xml:space="preserve">
|
||||||
|
<value>System proxy</value>
|
||||||
|
</data>
|
||||||
</root>
|
</root>
|
||||||
@@ -130,7 +130,7 @@
|
|||||||
<value>配置格式不正确</value>
|
<value>配置格式不正确</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="CustomServerTips" xml:space="preserve">
|
<data name="CustomServerTips" xml:space="preserve">
|
||||||
<value>注意,自定义配置完全依赖您自己的配置,不能使用所有设置功能。在自定义配置inbound中有socks port等于设置中的port时,系统代理才可用</value>
|
<value>注意,自定义配置完全依赖您自己的配置,不能使用所有设置功能。如需使用系统代理请手工修改监听端口。</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="Downloading" xml:space="preserve">
|
<data name="Downloading" xml:space="preserve">
|
||||||
<value>下载开始...</value>
|
<value>下载开始...</value>
|
||||||
@@ -454,4 +454,7 @@
|
|||||||
<data name="FillServerAddressCustom" xml:space="preserve">
|
<data name="FillServerAddressCustom" xml:space="preserve">
|
||||||
<value>请浏览导入服务器配置</value>
|
<value>请浏览导入服务器配置</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="SystemProxy" xml:space="preserve">
|
||||||
|
<value>系统代理</value>
|
||||||
|
</data>
|
||||||
</root>
|
</root>
|
||||||
@@ -24,7 +24,23 @@
|
|||||||
{
|
{
|
||||||
"tag": "tag2",
|
"tag": "tag2",
|
||||||
"port": 10809,
|
"port": 10809,
|
||||||
"protocol": "socks",
|
"protocol": "http",
|
||||||
|
"listen": "127.0.0.1",
|
||||||
|
"settings": {
|
||||||
|
"allowTransparent": false
|
||||||
|
},
|
||||||
|
"sniffing": {
|
||||||
|
"enabled": true,
|
||||||
|
"destOverride": [
|
||||||
|
"http",
|
||||||
|
"tls"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tag": "tag3",
|
||||||
|
"port": 10809,
|
||||||
|
"protocol": "http",
|
||||||
"listen": "127.0.0.1",
|
"listen": "127.0.0.1",
|
||||||
"settings": {
|
"settings": {
|
||||||
"allowTransparent": false
|
"allowTransparent": false
|
||||||
|
|||||||
@@ -3,6 +3,9 @@ using log4net.Appender;
|
|||||||
using log4net.Core;
|
using log4net.Core;
|
||||||
using log4net.Layout;
|
using log4net.Layout;
|
||||||
using log4net.Repository.Hierarchy;
|
using log4net.Repository.Hierarchy;
|
||||||
|
using System;
|
||||||
|
using System.IO;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace v2rayN.Tool
|
namespace v2rayN.Tool
|
||||||
{
|
{
|
||||||
@@ -15,7 +18,7 @@ namespace v2rayN.Tool
|
|||||||
PatternLayout patternLayout = new PatternLayout();
|
PatternLayout patternLayout = new PatternLayout();
|
||||||
patternLayout.ConversionPattern = "%date [%thread] %-5level %logger - %message%newline";
|
patternLayout.ConversionPattern = "%date [%thread] %-5level %logger - %message%newline";
|
||||||
patternLayout.ActivateOptions();
|
patternLayout.ActivateOptions();
|
||||||
|
|
||||||
RollingFileAppender roller = new RollingFileAppender();
|
RollingFileAppender roller = new RollingFileAppender();
|
||||||
roller.AppendToFile = true;
|
roller.AppendToFile = true;
|
||||||
roller.RollingStyle = RollingFileAppender.RollingMode.Date;
|
roller.RollingStyle = RollingFileAppender.RollingMode.Date;
|
||||||
@@ -33,5 +36,31 @@ namespace v2rayN.Tool
|
|||||||
hierarchy.Root.Level = Level.Info;
|
hierarchy.Root.Level = Level.Info;
|
||||||
hierarchy.Configured = true;
|
hierarchy.Configured = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void ClearLogs()
|
||||||
|
{
|
||||||
|
Task.Run(() =>
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var now = DateTime.Now.AddMonths(-1);
|
||||||
|
var dir = Utils.GetPath(@"guiLogs\");
|
||||||
|
var files = Directory.GetFiles(dir, "*.txt");
|
||||||
|
foreach (var filePath in files)
|
||||||
|
{
|
||||||
|
var file = new FileInfo(filePath);
|
||||||
|
if (file.CreationTime < now)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
file.Delete();
|
||||||
|
}
|
||||||
|
catch { }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch { }
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -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)
|
||||||
{
|
{
|
||||||
@@ -943,19 +964,21 @@ namespace v2rayN
|
|||||||
#region TempPath
|
#region TempPath
|
||||||
|
|
||||||
// return path to store temporary files
|
// return path to store temporary files
|
||||||
public static string GetTempPath()
|
public static string GetTempPath(string filename = "")
|
||||||
{
|
{
|
||||||
string _tempPath = Path.Combine(StartupPath(), "v2ray_win_temp");
|
string _tempPath = Path.Combine(StartupPath(), "v2ray_win_temp");
|
||||||
if (!Directory.Exists(_tempPath))
|
if (!Directory.Exists(_tempPath))
|
||||||
{
|
{
|
||||||
Directory.CreateDirectory(_tempPath);
|
Directory.CreateDirectory(_tempPath);
|
||||||
}
|
}
|
||||||
return _tempPath;
|
if (string.IsNullOrEmpty(filename))
|
||||||
}
|
{
|
||||||
|
return _tempPath;
|
||||||
public static string GetTempPath(string filename)
|
}
|
||||||
{
|
else
|
||||||
return Path.Combine(GetTempPath(), filename);
|
{
|
||||||
|
return Path.Combine(_tempPath, filename);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static string UnGzip(byte[] buf)
|
public static string UnGzip(byte[] buf)
|
||||||
@@ -970,6 +993,32 @@ namespace v2rayN
|
|||||||
return Encoding.UTF8.GetString(sb.ToArray());
|
return Encoding.UTF8.GetString(sb.ToArray());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static string GetBackupPath(string filename)
|
||||||
|
{
|
||||||
|
string _tempPath = Path.Combine(StartupPath(), "guiBackups");
|
||||||
|
if (!Directory.Exists(_tempPath))
|
||||||
|
{
|
||||||
|
Directory.CreateDirectory(_tempPath);
|
||||||
|
}
|
||||||
|
return Path.Combine(_tempPath, filename);
|
||||||
|
}
|
||||||
|
public static string GetConfigPath(string filename = "")
|
||||||
|
{
|
||||||
|
string _tempPath = Path.Combine(StartupPath(), "guiConfigs");
|
||||||
|
if (!Directory.Exists(_tempPath))
|
||||||
|
{
|
||||||
|
Directory.CreateDirectory(_tempPath);
|
||||||
|
}
|
||||||
|
if (string.IsNullOrEmpty(filename))
|
||||||
|
{
|
||||||
|
return _tempPath;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return Path.Combine(_tempPath, filename);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Log
|
#region Log
|
||||||
|
|||||||
@@ -199,6 +199,7 @@
|
|||||||
<SubType>Component</SubType>
|
<SubType>Component</SubType>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="Handler\SysProxyHandle.cs" />
|
<Compile Include="Handler\SysProxyHandle.cs" />
|
||||||
|
<Compile Include="Mode\ESpeedActionType.cs" />
|
||||||
<Compile Include="Mode\EGlobalHotkey.cs" />
|
<Compile Include="Mode\EGlobalHotkey.cs" />
|
||||||
<Compile Include="Mode\ECoreType.cs" />
|
<Compile Include="Mode\ECoreType.cs" />
|
||||||
<Compile Include="Mode\ESysProxyType.cs" />
|
<Compile Include="Mode\ESysProxyType.cs" />
|
||||||
@@ -207,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" />
|
||||||
@@ -260,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" />
|
||||||
|
|||||||
Reference in New Issue
Block a user