Compare commits

...

19 Commits
5.24 ... 5.27

Author SHA1 Message Date
2dust
e4fa729071 Update AssemblyInfo.cs 2022-06-26 09:09:38 +08:00
2dust
b3e7eac895 Parse ss plugin obfs-host 2022-06-24 14:25:09 +08:00
2dust
c43675d987 Sort by test result 2022-06-24 13:56:01 +08:00
2dust
cdaff66126 add rule object doc 2022-06-24 09:54:52 +08:00
2dust
cf45e89b16 Support update clash core 2022-06-24 09:32:55 +08:00
2dust
aec8459761 Revert "Delete v2rayN.csproj"
This reverts commit 25c2871888.
2022-06-23 15:23:41 +08:00
2dust
de746375a9 Merge pull request #2417 from EdiWang/en-translation
Fix English translations
2022-06-23 15:21:07 +08:00
2dust
25c2871888 Delete v2rayN.csproj 2022-06-23 15:20:49 +08:00
2dust
28b2e1a405 Merge pull request #2415 from EdiWang/master
C# language usage improvements
2022-06-23 15:20:18 +08:00
Edi Wang
2603132dae fix English translations 2022-06-22 10:25:19 +08:00
Edi Wang
6f08cb0e88 C sharp language usage improvements 2022-06-22 09:48:00 +08:00
2dust
dd65c3fcaa ss supports transport settings 2022-06-19 20:43:33 +08:00
2dust
fec8641efe Update AssemblyInfo.cs 2022-06-12 19:36:36 +08:00
2dust
d5eaa56b60 refactor update core url 2022-06-06 17:28:38 +08:00
2dust
db7e8dd6dc Update MainFormHandler.cs 2022-06-06 15:10:09 +08:00
2dust
9415055e6f Timeout to 30s 2022-06-05 20:24:08 +08:00
2dust
f597f09914 Support 2022-blake3 share 2022-05-31 14:53:39 +08:00
2dust
7903228c13 Update AssemblyInfo.cs 2022-05-29 18:29:03 +08:00
2dust
4c2388749d add Shadowsocks-2022 for xray-core 2022-05-29 18:28:44 +08:00
42 changed files with 858 additions and 664 deletions

View File

@@ -16,37 +16,37 @@ namespace v2rayN.Base
UpdateStyles();
}
public void RegisterDragEvent(Action<int, int> _update)
public void RegisterDragEvent(Action<int, int> update)
{
_updateFunc = _update;
this.AllowDrop = true;
_updateFunc = update;
AllowDrop = true;
this.ItemDrag += new ItemDragEventHandler(this.lv_ItemDrag);
this.DragDrop += new DragEventHandler(this.lv_DragDrop);
this.DragEnter += new DragEventHandler(this.lv_DragEnter);
this.DragOver += new DragEventHandler(this.lv_DragOver);
this.DragLeave += new EventHandler(this.lv_DragLeave);
ItemDrag += lv_ItemDrag;
DragDrop += lv_DragDrop;
DragEnter += lv_DragEnter;
DragOver += lv_DragOver;
DragLeave += lv_DragLeave;
}
private void lv_DragDrop(object sender, DragEventArgs e)
{
int targetIndex = this.InsertionMark.Index;
int targetIndex = InsertionMark.Index;
if (targetIndex == -1)
{
return;
}
if (this.InsertionMark.AppearsAfterItem)
if (InsertionMark.AppearsAfterItem)
{
targetIndex++;
}
if (this.SelectedIndices.Count <= 0)
if (SelectedIndices.Count <= 0)
{
return;
}
_updateFunc(this.SelectedIndices[0], targetIndex);
_updateFunc(SelectedIndices[0], targetIndex);
//ListViewItem draggedItem = (ListViewItem)e.Data.GetData(typeof(ListViewItem));
//this.BeginUpdate();
@@ -63,35 +63,35 @@ namespace v2rayN.Base
private void lv_DragLeave(object sender, EventArgs e)
{
this.InsertionMark.Index = -1;
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);
Point targetPoint = PointToClient(new Point(e.X, e.Y));
int targetIndex = InsertionMark.NearestIndex(targetPoint);
if (targetIndex > -1)
{
Rectangle itemBounds = this.GetItemRect(targetIndex);
this.EnsureVisible(targetIndex);
Rectangle itemBounds = GetItemRect(targetIndex);
EnsureVisible(targetIndex);
if (targetPoint.Y > itemBounds.Top + (itemBounds.Height / 2))
{
this.InsertionMark.AppearsAfterItem = true;
InsertionMark.AppearsAfterItem = true;
}
else
{
this.InsertionMark.AppearsAfterItem = false;
InsertionMark.AppearsAfterItem = false;
}
}
this.InsertionMark.Index = targetIndex;
InsertionMark.Index = targetIndex;
}
private void lv_ItemDrag(object sender, ItemDragEventArgs e)
{
this.DoDragDrop(e.Item, DragDropEffects.Move);
this.InsertionMark.Index = -1;
DoDragDrop(e.Item, DragDropEffects.Move);
InsertionMark.Index = -1;
}
}
}

View File

@@ -32,8 +32,10 @@ namespace v2rayN.Forms
}
else
{
vmessItem = new VmessItem();
vmessItem.groupId = groupId;
vmessItem = new VmessItem
{
groupId = groupId
};
ClearServer();
}
}
@@ -46,14 +48,7 @@ namespace v2rayN.Forms
txtRemarks.Text = vmessItem.remarks;
txtAddress.Text = vmessItem.address;
if (vmessItem.coreType == null)
{
cmbCoreType.Text = string.Empty;
}
else
{
cmbCoreType.Text = vmessItem.coreType.ToString();
}
cmbCoreType.Text = vmessItem.coreType == null ? string.Empty : vmessItem.coreType.ToString();
}
@@ -90,7 +85,7 @@ namespace v2rayN.Forms
if (ConfigHandler.EditCustomServer(ref config, vmessItem) == 0)
{
this.DialogResult = DialogResult.OK;
DialogResult = DialogResult.OK;
}
else
{
@@ -100,14 +95,7 @@ namespace v2rayN.Forms
private void btnClose_Click(object sender, EventArgs e)
{
if (Utils.IsNullOrEmpty(vmessItem.indexId))
{
this.DialogResult = DialogResult.Cancel;
}
else
{
this.DialogResult = DialogResult.OK;
}
DialogResult = Utils.IsNullOrEmpty(vmessItem.indexId) ? DialogResult.Cancel : DialogResult.OK;
}
private void btnBrowse_Click(object sender, EventArgs e)

View File

@@ -16,7 +16,7 @@ namespace v2rayN.Forms
private void AddServerForm_Load(object sender, EventArgs e)
{
this.Text = (eConfigType).ToString();
Text = (eConfigType).ToString();
cmbCoreType.Items.AddRange(Global.coreTypes.ToArray());
cmbCoreType.Items.Add(string.Empty);
@@ -32,8 +32,8 @@ namespace v2rayN.Forms
case EConfigType.Shadowsocks:
panSs.Dock = DockStyle.Fill;
panSs.Visible = true;
panTran.Visible = false;
this.Height = this.Height - panTran.Height;
//panTran.Visible = false;
//this.Height = this.Height - panTran.Height;
cmbSecurity3.Items.AddRange(LazyConfig.Instance.GetShadowsocksSecuritys().ToArray());
break;
@@ -41,7 +41,7 @@ namespace v2rayN.Forms
panSocks.Dock = DockStyle.Fill;
panSocks.Visible = true;
panTran.Visible = false;
this.Height = this.Height - panTran.Height;
Height = Height - panTran.Height;
break;
case EConfigType.VLESS:
panVless.Dock = DockStyle.Fill;
@@ -65,8 +65,10 @@ namespace v2rayN.Forms
}
else
{
vmessItem = new VmessItem();
vmessItem.groupId = groupId;
vmessItem = new VmessItem
{
groupId = groupId
};
ClearServer();
}
}
@@ -106,14 +108,7 @@ namespace v2rayN.Forms
break;
}
if (vmessItem.coreType == null)
{
cmbCoreType.Text = string.Empty;
}
else
{
cmbCoreType.Text = vmessItem.coreType.ToString();
}
cmbCoreType.Text = vmessItem.coreType == null ? string.Empty : vmessItem.coreType.ToString();
transportControl.BindingServer(vmessItem);
}
@@ -267,7 +262,7 @@ namespace v2rayN.Forms
if (ret == 0)
{
this.DialogResult = DialogResult.OK;
DialogResult = DialogResult.OK;
}
else
{
@@ -284,7 +279,7 @@ namespace v2rayN.Forms
private void btnClose_Click(object sender, EventArgs e)
{
this.DialogResult = DialogResult.Cancel;
DialogResult = DialogResult.Cancel;
}
}
}

View File

@@ -21,11 +21,11 @@ namespace v2rayN.Forms
string file = Utils.GetPath(Global.CustomIconName);
if (System.IO.File.Exists(file))
{
this.Icon = new System.Drawing.Icon(file);
Icon = new System.Drawing.Icon(file);
return;
}
this.Icon = Properties.Resources.NotifyIcon1;
Icon = Properties.Resources.NotifyIcon1;
}
catch (Exception e)
{

View File

@@ -101,7 +101,7 @@ namespace v2rayN.Forms
if (ConfigHandler.SaveConfig(ref config, false) == 0)
{
this.DialogResult = DialogResult.OK;
DialogResult = DialogResult.OK;
}
else
{
@@ -111,7 +111,7 @@ namespace v2rayN.Forms
private void btnClose_Click(object sender, EventArgs e)
{
this.DialogResult = DialogResult.Cancel;
DialogResult = DialogResult.Cancel;
}
private void btnReset_Click(object sender, EventArgs e)

View File

@@ -23,7 +23,7 @@ namespace v2rayN.Forms
private void GroupSettingControl_Load(object sender, EventArgs e)
{
this.Height = grbMain.Height;
Height = grbMain.Height;
BindingSub();
}

View File

@@ -70,7 +70,7 @@ namespace v2rayN.Forms
{
if (ConfigHandler.SaveGroupItem(ref config) == 0)
{
this.DialogResult = DialogResult.OK;
DialogResult = DialogResult.OK;
}
else
{
@@ -80,7 +80,7 @@ namespace v2rayN.Forms
private void btnClose_Click(object sender, EventArgs e)
{
this.DialogResult = DialogResult.Cancel;
DialogResult = DialogResult.Cancel;
}
private void btnAdd_Click(object sender, EventArgs e)

View File

@@ -60,6 +60,7 @@
this.menuTcpingServer = new System.Windows.Forms.ToolStripMenuItem();
this.menuRealPingServer = new System.Windows.Forms.ToolStripMenuItem();
this.menuSpeedServer = new System.Windows.Forms.ToolStripMenuItem();
this.menuSortServerResult = new System.Windows.Forms.ToolStripMenuItem();
this.tsbTestMe = new System.Windows.Forms.ToolStripMenuItem();
this.menuClearServerStatistics = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator6 = new System.Windows.Forms.ToolStripSeparator();
@@ -67,9 +68,9 @@
this.menuExport2ServerConfig = new System.Windows.Forms.ToolStripMenuItem();
this.menuExport2ShareUrl = 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.qrCodeControl = new v2rayN.Forms.QRCodeControl();
this.tsbServer = new System.Windows.Forms.ToolStripDropDownButton();
this.scBig = new System.Windows.Forms.SplitContainer();
this.gbServers = new System.Windows.Forms.GroupBox();
this.mainMsgControl = new v2rayN.Forms.MainMsgControl();
@@ -111,6 +112,9 @@
this.tsbCheckUpdateN = new System.Windows.Forms.ToolStripMenuItem();
this.tsbCheckUpdateCore = new System.Windows.Forms.ToolStripMenuItem();
this.tsbCheckUpdateXrayCore = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator16 = new System.Windows.Forms.ToolStripSeparator();
this.tsbCheckUpdateClashCore = new System.Windows.Forms.ToolStripMenuItem();
this.tsbCheckUpdateClashMetaCore = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator15 = new System.Windows.Forms.ToolStripSeparator();
this.tsbCheckUpdateGeo = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator10 = new System.Windows.Forms.ToolStripSeparator();
@@ -200,6 +204,7 @@
this.menuTcpingServer,
this.menuRealPingServer,
this.menuSpeedServer,
this.menuSortServerResult,
this.tsbTestMe,
this.menuClearServerStatistics,
this.toolStripSeparator6,
@@ -208,6 +213,7 @@
this.menuExport2ShareUrl,
this.menuExport2SubContent});
this.cmsLv.Name = "cmsLv";
this.cmsLv.OwnerItem = this.tsbServer;
resources.ApplyResources(this.cmsLv, "cmsLv");
//
// menuAddVmessServer
@@ -373,6 +379,12 @@
resources.ApplyResources(this.menuSpeedServer, "menuSpeedServer");
this.menuSpeedServer.Click += new System.EventHandler(this.menuSpeedServer_Click);
//
// menuSortServerResult
//
this.menuSortServerResult.Name = "menuSortServerResult";
resources.ApplyResources(this.menuSortServerResult, "menuSortServerResult");
this.menuSortServerResult.Click += new System.EventHandler(this.menuSortServerResult_Click);
//
// tsbTestMe
//
this.tsbTestMe.Name = "tsbTestMe";
@@ -414,6 +426,13 @@
resources.ApplyResources(this.menuExport2SubContent, "menuExport2SubContent");
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
//
resources.ApplyResources(this.tabGroup, "tabGroup");
@@ -426,13 +445,6 @@
resources.ApplyResources(this.qrCodeControl, "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";
//
// scBig
//
resources.ApplyResources(this.scBig, "scBig");
@@ -707,6 +719,9 @@
this.tsbCheckUpdateN,
this.tsbCheckUpdateCore,
this.tsbCheckUpdateXrayCore,
this.toolStripSeparator16,
this.tsbCheckUpdateClashCore,
this.tsbCheckUpdateClashMetaCore,
this.toolStripSeparator15,
this.tsbCheckUpdateGeo});
this.tsbCheckUpdate.Image = global::v2rayN.Properties.Resources.checkupdate;
@@ -731,6 +746,23 @@
resources.ApplyResources(this.tsbCheckUpdateXrayCore, "tsbCheckUpdateXrayCore");
this.tsbCheckUpdateXrayCore.Click += new System.EventHandler(this.tsbCheckUpdateXrayCore_Click);
//
// toolStripSeparator16
//
this.toolStripSeparator16.Name = "toolStripSeparator16";
resources.ApplyResources(this.toolStripSeparator16, "toolStripSeparator16");
//
// tsbCheckUpdateClashCore
//
this.tsbCheckUpdateClashCore.Name = "tsbCheckUpdateClashCore";
resources.ApplyResources(this.tsbCheckUpdateClashCore, "tsbCheckUpdateClashCore");
this.tsbCheckUpdateClashCore.Click += new System.EventHandler(this.tsbCheckUpdateClashCore_Click);
//
// tsbCheckUpdateClashMetaCore
//
this.tsbCheckUpdateClashMetaCore.Name = "tsbCheckUpdateClashMetaCore";
resources.ApplyResources(this.tsbCheckUpdateClashMetaCore, "tsbCheckUpdateClashMetaCore");
this.tsbCheckUpdateClashMetaCore.Click += new System.EventHandler(this.tsbCheckUpdateClashMetaCore_Click);
//
// toolStripSeparator15
//
this.toolStripSeparator15.Name = "toolStripSeparator15";
@@ -936,6 +968,10 @@
private System.Windows.Forms.ToolStripMenuItem menuMoveDown;
private System.Windows.Forms.ToolStripMenuItem menuMoveBottom;
private System.Windows.Forms.ToolStripMenuItem menuServerFilter;
private System.Windows.Forms.ToolStripMenuItem tsbCheckUpdateClashCore;
private System.Windows.Forms.ToolStripMenuItem tsbCheckUpdateClashMetaCore;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator16;
private System.Windows.Forms.ToolStripMenuItem menuSortServerResult;
}
}

View File

@@ -18,8 +18,8 @@ namespace v2rayN.Forms
{
private V2rayHandler v2rayHandler;
private List<VmessItem> lstSelecteds = new List<VmessItem>();
private StatisticsHandler statistics = null;
private List<VmessItem> lstVmess = null;
private StatisticsHandler statistics;
private List<VmessItem> lstVmess;
private string groupId = string.Empty;
private string serverFilter = string.Empty;
@@ -28,10 +28,10 @@ namespace v2rayN.Forms
public MainForm()
{
InitializeComponent();
this.ShowInTaskbar = false;
this.WindowState = FormWindowState.Minimized;
ShowInTaskbar = false;
WindowState = FormWindowState.Minimized;
HideForm();
this.Text = Utils.GetVersion();
Text = Utils.GetVersion();
Global.processJob = new Job();
Application.ApplicationExit += (sender, args) =>
@@ -154,12 +154,12 @@ namespace v2rayN.Forms
if (!config.uiItem.mainLocation.IsEmpty)
{
this.Location = config.uiItem.mainLocation;
Location = config.uiItem.mainLocation;
}
if (!config.uiItem.mainSize.IsEmpty)
{
this.Width = config.uiItem.mainSize.Width;
this.Height = config.uiItem.mainSize.Height;
Width = config.uiItem.mainSize.Width;
Height = config.uiItem.mainSize.Height;
}
@@ -172,9 +172,9 @@ namespace v2rayN.Forms
private void StorageUI()
{
config.uiItem.mainLocation = this.Location;
config.uiItem.mainLocation = Location;
config.uiItem.mainSize = new Size(this.Width, this.Height);
config.uiItem.mainSize = new Size(Width, Height);
for (int k = 0; k < lvServers.Columns.Count; k++)
{
@@ -187,7 +187,7 @@ namespace v2rayN.Forms
switch (Utils.ToInt(e.Name))
{
case (int)EGlobalHotkey.ShowForm:
if (this.ShowInTaskbar) HideForm(); else ShowForm();
if (ShowInTaskbar) HideForm(); else ShowForm();
break;
case (int)EGlobalHotkey.SystemProxyClear:
SetListenerType(ESysProxyType.ForcedClear);
@@ -212,8 +212,8 @@ namespace v2rayN.Forms
private void RefreshServers()
{
lstVmess = config.vmess
.Where(it => Utils.IsNullOrEmpty(groupId) ? true : it.groupId == groupId)
.Where(it => Utils.IsNullOrEmpty(serverFilter) ? true : it.remarks.Contains(serverFilter))
.Where(it => Utils.IsNullOrEmpty(groupId) || it.groupId == groupId)
.Where(it => Utils.IsNullOrEmpty(serverFilter) || it.remarks.Contains(serverFilter))
.OrderBy(it => it.sort)
.ToList();
@@ -371,7 +371,7 @@ namespace v2rayN.Forms
{
ts.Checked = true;
}
ts.Click += new EventHandler(ts_Click);
ts.Click += ts_Click;
lst.Add(ts);
}
menuServers.DropDownItems.AddRange(lst.ToArray());
@@ -415,7 +415,7 @@ namespace v2rayN.Forms
}
var tag = lvServers.Columns[e.Column].Tag?.ToString();
bool asc = Utils.IsNullOrEmpty(tag) ? true : !Convert.ToBoolean(tag);
bool asc = Utils.IsNullOrEmpty(tag) || !Convert.ToBoolean(tag);
if (ConfigHandler.SortServers(ref config, ref lstVmess, (EServerColName)e.Column, asc) != 0)
{
return;
@@ -465,7 +465,7 @@ namespace v2rayN.Forms
{
Tag = item.id,
};
ts.Click += new EventHandler(ts_Group_Click);
ts.Click += ts_Group_Click;
lst.Add(ts);
}
menuMoveToGroup.DropDownItems.AddRange(lst.ToArray());
@@ -516,7 +516,7 @@ namespace v2rayN.Forms
/// </summary>
async Task LoadV2ray()
{
this.BeginInvoke(new Action(() =>
BeginInvoke(new Action(() =>
{
tsbReload.Enabled = false;
}));
@@ -536,7 +536,7 @@ namespace v2rayN.Forms
ChangePACButtonStatus(config.sysProxyType);
this.BeginInvoke(new Action(() =>
BeginInvoke(new Action(() =>
{
tsbReload.Enabled = true;
}));
@@ -633,6 +633,9 @@ namespace v2rayN.Forms
case Keys.F:
menuServerFilter_Click(null, null);
break;
case Keys.E:
menuSortServerResult_Click(null, null);
break;
}
}
else
@@ -774,6 +777,10 @@ namespace v2rayN.Forms
ClearTestResult();
SpeedtestHandler statistics = new SpeedtestHandler(config, v2rayHandler, lstSelecteds, actionType, UpdateSpeedtestHandler);
}
private void menuSortServerResult_Click(object sender, EventArgs e)
{
lvServers_ColumnClick(null, new ColumnClickEventArgs((int)EServerColName.testResult));
}
private void tsbTestMe_Click(object sender, EventArgs e)
{
@@ -1085,8 +1092,8 @@ namespace v2rayN.Forms
private void menuExit_Click(object sender, EventArgs e)
{
this.Visible = false;
this.Close();
Visible = false;
Close();
Application.Exit();
}
@@ -1094,13 +1101,13 @@ namespace v2rayN.Forms
private void ShowForm()
{
this.Show();
if (this.WindowState == FormWindowState.Minimized)
Show();
if (WindowState == FormWindowState.Minimized)
{
this.WindowState = FormWindowState.Normal;
WindowState = FormWindowState.Normal;
}
this.Activate();
this.ShowInTaskbar = true;
Activate();
ShowInTaskbar = true;
//this.notifyIcon1.Visible = false;
mainMsgControl.ScrollToCaret();
@@ -1117,10 +1124,10 @@ namespace v2rayN.Forms
private void HideForm()
{
//this.WindowState = FormWindowState.Minimized;
this.Hide();
Hide();
//this.notifyMain.Icon = this.Icon;
this.notifyMain.Visible = true;
this.ShowInTaskbar = false;
notifyMain.Visible = true;
ShowInTaskbar = false;
SetVisibleCore(false);
}
@@ -1293,9 +1300,9 @@ namespace v2rayN.Forms
mainMsgControl.DisplayToolStatus(config);
this.BeginInvoke(new Action(() =>
BeginInvoke(new Action(() =>
{
notifyMain.Icon = this.Icon = MainFormHandler.Instance.GetNotifyIcon(config, this.Icon);
notifyMain.Icon = Icon = MainFormHandler.Instance.GetNotifyIcon(config, Icon);
}));
}
@@ -1314,10 +1321,7 @@ namespace v2rayN.Forms
menuExit_Click(null, null);
}
};
Task.Run(() =>
{
(new UpdateHandle()).CheckUpdateGuiN(config, _updateUI);
});
(new UpdateHandle()).CheckUpdateGuiN(config, _updateUI);
}
private void tsbCheckUpdateCore_Click(object sender, EventArgs e)
@@ -1330,6 +1334,16 @@ namespace v2rayN.Forms
CheckUpdateCore(ECoreType.Xray);
}
private void tsbCheckUpdateClashCore_Click(object sender, EventArgs e)
{
CheckUpdateCore(ECoreType.clash);
}
private void tsbCheckUpdateClashMetaCore_Click(object sender, EventArgs e)
{
CheckUpdateCore(ECoreType.clash_meta);
}
private void CheckUpdateCore(ECoreType type)
{
void _updateUI(bool success, string msg)
@@ -1350,10 +1364,7 @@ namespace v2rayN.Forms
AppendText(false, ResUI.MsgUpdateV2rayCoreSuccessfully);
}
};
Task.Run(() =>
{
(new UpdateHandle()).CheckUpdateCore(type, config, _updateUI);
});
(new UpdateHandle()).CheckUpdateCore(type, config, _updateUI);
}
private void tsbCheckUpdateGeo_Click(object sender, EventArgs e)
@@ -1493,7 +1504,7 @@ namespace v2rayN.Forms
ts.Checked = true;
mainMsgControl.SetToolSslInfo("routing", item.remarks);
}
ts.Click += new EventHandler(ts_Routing_Click);
ts.Click += ts_Routing_Click;
lst.Add(ts);
}
menuRoutings.DropDownItems.AddRange(lst.ToArray());

View File

@@ -281,6 +281,12 @@
<data name="menuSpeedServer.Text" xml:space="preserve">
<value>Test servers download speed (Ctrl+T)</value>
</data>
<data name="menuSortServerResult.Size" type="System.Drawing.Size, System.Drawing">
<value>355, 22</value>
</data>
<data name="menuSortServerResult.Text" xml:space="preserve">
<value>Sort by test result (Ctrl+E)</value>
</data>
<data name="tsbTestMe.Size" type="System.Drawing.Size, System.Drawing">
<value>355, 22</value>
</data>
@@ -320,8 +326,20 @@
<data name="menuExport2SubContent.Text" xml:space="preserve">
<value>Export subscription (base64) share to clipboard</value>
</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">
<value>356, 622</value>
<value>356, 644</value>
</data>
<data name="&gt;&gt;cmsLv.Name" xml:space="preserve">
<value>cmsLv</value>
@@ -470,18 +488,6 @@
<data name="&gt;&gt;scServers.ZOrder" xml:space="preserve">
<value>0</value>
</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="scBig.Dock" type="System.Windows.Forms.DockStyle, System.Windows.Forms">
<value>Fill</value>
</data>
@@ -825,28 +831,43 @@
<value>6, 56</value>
</data>
<data name="tsbCheckUpdateN.Size" type="System.Drawing.Size, System.Drawing">
<value>203, 22</value>
<value>219, 22</value>
</data>
<data name="tsbCheckUpdateN.Text" xml:space="preserve">
<value>v2rayN (this software)</value>
</data>
<data name="tsbCheckUpdateCore.Size" type="System.Drawing.Size, System.Drawing">
<value>203, 22</value>
<value>219, 22</value>
</data>
<data name="tsbCheckUpdateCore.Text" xml:space="preserve">
<value>Update v2flyCore</value>
<value>Update v2fly Core</value>
</data>
<data name="tsbCheckUpdateXrayCore.Size" type="System.Drawing.Size, System.Drawing">
<value>203, 22</value>
<value>219, 22</value>
</data>
<data name="tsbCheckUpdateXrayCore.Text" xml:space="preserve">
<value>Update XrayCore</value>
<value>Update Xray Core</value>
</data>
<data name="toolStripSeparator16.Size" type="System.Drawing.Size, System.Drawing">
<value>216, 6</value>
</data>
<data name="tsbCheckUpdateClashCore.Size" type="System.Drawing.Size, System.Drawing">
<value>219, 22</value>
</data>
<data name="tsbCheckUpdateClashCore.Text" xml:space="preserve">
<value>Update clash Core</value>
</data>
<data name="tsbCheckUpdateClashMetaCore.Size" type="System.Drawing.Size, System.Drawing">
<value>219, 22</value>
</data>
<data name="tsbCheckUpdateClashMetaCore.Text" xml:space="preserve">
<value>Update Clash.Meta Core</value>
</data>
<data name="toolStripSeparator15.Size" type="System.Drawing.Size, System.Drawing">
<value>200, 6</value>
<value>216, 6</value>
</data>
<data name="tsbCheckUpdateGeo.Size" type="System.Drawing.Size, System.Drawing">
<value>203, 22</value>
<value>219, 22</value>
</data>
<data name="tsbCheckUpdateGeo.Text" xml:space="preserve">
<value>Update Geo files</value>
@@ -1133,6 +1154,12 @@
<data name="&gt;&gt;menuSpeedServer.Type" xml:space="preserve">
<value>System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;menuSortServerResult.Name" xml:space="preserve">
<value>menuSortServerResult</value>
</data>
<data name="&gt;&gt;menuSortServerResult.Type" xml:space="preserve">
<value>System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;tsbTestMe.Name" xml:space="preserve">
<value>tsbTestMe</value>
</data>
@@ -1391,6 +1418,24 @@
<data name="&gt;&gt;tsbCheckUpdateXrayCore.Type" xml:space="preserve">
<value>System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;toolStripSeparator16.Name" xml:space="preserve">
<value>toolStripSeparator16</value>
</data>
<data name="&gt;&gt;toolStripSeparator16.Type" xml:space="preserve">
<value>System.Windows.Forms.ToolStripSeparator, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;tsbCheckUpdateClashCore.Name" xml:space="preserve">
<value>tsbCheckUpdateClashCore</value>
</data>
<data name="&gt;&gt;tsbCheckUpdateClashCore.Type" xml:space="preserve">
<value>System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;tsbCheckUpdateClashMetaCore.Name" xml:space="preserve">
<value>tsbCheckUpdateClashMetaCore</value>
</data>
<data name="&gt;&gt;tsbCheckUpdateClashMetaCore.Type" xml:space="preserve">
<value>System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;toolStripSeparator15.Name" xml:space="preserve">
<value>toolStripSeparator15</value>
</data>

View File

@@ -561,4 +561,13 @@
<data name="menuServerFilter.Text" xml:space="preserve">
<value>设置服务器过滤器 (Ctrl+F)</value>
</data>
<data name="tsbCheckUpdateClashCore.Text" xml:space="preserve">
<value>Update clash Core</value>
</data>
<data name="tsbCheckUpdateClashMetaCore.Text" xml:space="preserve">
<value>Update Clash.Meta Core</value>
</data>
<data name="menuSortServerResult.Text" xml:space="preserve">
<value>按测试结果排序 (Ctrl+E)</value>
</data>
</root>

View File

@@ -16,7 +16,7 @@ namespace v2rayN.Forms
{
public partial class MainMsgControl : UserControl
{
private string MsgFilter = string.Empty;
private string _msgFilter = string.Empty;
delegate void AppendTextDelegate(string text);
public MainMsgControl()
@@ -33,15 +33,15 @@ namespace v2rayN.Forms
public void AppendText(string text)
{
if (this.txtMsgBox.InvokeRequired)
if (txtMsgBox.InvokeRequired)
{
Invoke(new AppendTextDelegate(AppendText), new object[] { text });
Invoke(new AppendTextDelegate(AppendText), text);
}
else
{
if (!Utils.IsNullOrEmpty(MsgFilter))
if (!Utils.IsNullOrEmpty(_msgFilter))
{
if (!Regex.IsMatch(text, MsgFilter))
if (!Regex.IsMatch(text, _msgFilter))
{
return;
}
@@ -61,10 +61,10 @@ namespace v2rayN.Forms
{
ClearMsg();
}
this.txtMsgBox.AppendText(msg);
txtMsgBox.AppendText(msg);
if (!msg.EndsWith(Environment.NewLine))
{
this.txtMsgBox.AppendText(Environment.NewLine);
txtMsgBox.AppendText(Environment.NewLine);
}
}
@@ -124,7 +124,7 @@ namespace v2rayN.Forms
public void ScrollToCaret()
{
this.txtMsgBox.ScrollToCaret();
txtMsgBox.ScrollToCaret();
}
#endregion
@@ -132,24 +132,24 @@ namespace v2rayN.Forms
#region MsgBoxMenu
private void menuMsgBoxSelectAll_Click(object sender, EventArgs e)
{
this.txtMsgBox.Focus();
this.txtMsgBox.SelectAll();
txtMsgBox.Focus();
txtMsgBox.SelectAll();
}
private void menuMsgBoxCopy_Click(object sender, EventArgs e)
{
var data = this.txtMsgBox.SelectedText.TrimEx();
var data = txtMsgBox.SelectedText.TrimEx();
Utils.SetClipboardData(data);
}
private void menuMsgBoxCopyAll_Click(object sender, EventArgs e)
{
var data = this.txtMsgBox.Text;
var data = txtMsgBox.Text;
Utils.SetClipboardData(data);
}
private void menuMsgBoxClear_Click(object sender, EventArgs e)
{
this.txtMsgBox.Clear();
txtMsgBox.Clear();
}
private void menuMsgBoxAddRoutingRule_Click(object sender, EventArgs e)
{
@@ -182,12 +182,12 @@ namespace v2rayN.Forms
private void menuMsgBoxFilter_Click(object sender, EventArgs e)
{
var fm = new MsgFilterSetForm();
fm.MsgFilter = MsgFilter;
fm.MsgFilter = _msgFilter;
fm.ShowDefFilter = true;
if (fm.ShowDialog() == DialogResult.OK)
{
MsgFilter = fm.MsgFilter;
gbMsgTitle.Text = string.Format(ResUI.MsgInformationTitle, MsgFilter);
_msgFilter = fm.MsgFilter;
gbMsgTitle.Text = string.Format(ResUI.MsgInformationTitle, _msgFilter);
}
}

View File

@@ -30,12 +30,12 @@ namespace v2rayN.Forms
private void btnOK_Click(object sender, EventArgs e)
{
MsgFilter = txtMsgFilter.Text;
this.DialogResult = DialogResult.OK;
DialogResult = DialogResult.OK;
}
private void btnClose_Click(object sender, EventArgs e)
{
this.DialogResult = DialogResult.Cancel;
DialogResult = DialogResult.Cancel;
}
private void btnFilderProxy_Click(object sender, EventArgs e)
@@ -51,7 +51,7 @@ namespace v2rayN.Forms
private void btnClear_Click(object sender, EventArgs e)
{
MsgFilter = string.Empty;
this.DialogResult = DialogResult.OK;
DialogResult = DialogResult.OK;
}
}
}

View File

@@ -177,7 +177,7 @@ namespace v2rayN.Forms
if (ConfigHandler.SaveConfig(ref config) == 0)
{
this.DialogResult = DialogResult.OK;
DialogResult = DialogResult.OK;
}
else
{
@@ -335,7 +335,7 @@ namespace v2rayN.Forms
private void btnClose_Click(object sender, EventArgs e)
{
this.DialogResult = DialogResult.Cancel;
DialogResult = DialogResult.Cancel;
}

View File

@@ -50,6 +50,7 @@
this.txtIP = new System.Windows.Forms.TextBox();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.txtDomain = new System.Windows.Forms.TextBox();
this.linkRuleobjectDoc = new System.Windows.Forms.LinkLabel();
this.panel3.SuspendLayout();
this.panel4.SuspendLayout();
this.panel2.SuspendLayout();
@@ -64,6 +65,7 @@
//
// panel3
//
this.panel3.Controls.Add(this.linkRuleobjectDoc);
this.panel3.Controls.Add(this.chkEnabled);
this.panel3.Controls.Add(this.clbInboundTag);
this.panel3.Controls.Add(this.label2);
@@ -90,7 +92,9 @@
this.clbInboundTag.FormattingEnabled = true;
this.clbInboundTag.Items.AddRange(new object[] {
resources.GetString("clbInboundTag.Items"),
resources.GetString("clbInboundTag.Items1")});
resources.GetString("clbInboundTag.Items1"),
resources.GetString("clbInboundTag.Items2"),
resources.GetString("clbInboundTag.Items3")});
this.clbInboundTag.MultiColumn = true;
this.clbInboundTag.Name = "clbInboundTag";
//
@@ -208,6 +212,13 @@
resources.ApplyResources(this.txtDomain, "txtDomain");
this.txtDomain.Name = "txtDomain";
//
// linkRuleobjectDoc
//
resources.ApplyResources(this.linkRuleobjectDoc, "linkRuleobjectDoc");
this.linkRuleobjectDoc.Name = "linkRuleobjectDoc";
this.linkRuleobjectDoc.TabStop = true;
this.linkRuleobjectDoc.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.linkRuleobjectDoc_LinkClicked);
//
// RoutingRuleSettingDetailsForm
//
resources.ApplyResources(this, "$this");
@@ -255,5 +266,6 @@
private System.Windows.Forms.Label label2;
private System.Windows.Forms.CheckBox chkEnabled;
private System.Windows.Forms.CheckBox chkAutoSort;
private System.Windows.Forms.LinkLabel linkRuleobjectDoc;
}
}

View File

@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Windows.Forms;
using v2rayN.Base;
using v2rayN.Handler;
@@ -115,34 +116,33 @@ namespace v2rayN.Forms
private void btnOK_Click(object sender, EventArgs e)
{
EndBindingData();
var hasRule = false;
if (rulesItem.domain != null && rulesItem.domain.Count > 0)
{
hasRule = true;
}
if (rulesItem.ip != null && rulesItem.ip.Count > 0)
{
hasRule = true;
}
if (rulesItem.protocol != null && rulesItem.protocol.Count > 0)
{
hasRule = true;
}
if (!Utils.IsNullOrEmpty(rulesItem.port))
{
hasRule = true;
}
bool hasRule =
rulesItem.domain != null
&& rulesItem.domain.Count > 0
|| rulesItem.ip != null
&& rulesItem.ip.Count > 0
|| rulesItem.protocol != null
&& rulesItem.protocol.Count > 0
|| !Utils.IsNullOrEmpty(rulesItem.port);
if (!hasRule)
{
UI.ShowWarning(string.Format(ResUI.RoutingRuleDetailRequiredTips, "Port/Protocol/Domain/IP"));
return;
}
this.DialogResult = DialogResult.OK;
DialogResult = DialogResult.OK;
}
private void btnClose_Click(object sender, EventArgs e)
{
this.DialogResult = DialogResult.Cancel;
DialogResult = DialogResult.Cancel;
}
private void linkRuleobjectDoc_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{
Process.Start("https://www.v2fly.org/config/routing.html#ruleobject");
}
}
}

View File

@@ -144,6 +144,39 @@
<data name="&gt;&gt;panel1.ZOrder" xml:space="preserve">
<value>3</value>
</data>
<data name="linkRuleobjectDoc.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="linkRuleobjectDoc.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
<value>NoControl</value>
</data>
<data name="linkRuleobjectDoc.Location" type="System.Drawing.Point, System.Drawing">
<value>19, 86</value>
</data>
<data name="linkRuleobjectDoc.Margin" type="System.Windows.Forms.Padding, System.Windows.Forms">
<value>0, 0, 0, 0</value>
</data>
<data name="linkRuleobjectDoc.Size" type="System.Drawing.Size, System.Drawing">
<value>89, 12</value>
</data>
<data name="linkRuleobjectDoc.TabIndex" type="System.Int32, mscorlib">
<value>43</value>
</data>
<data name="linkRuleobjectDoc.Text" xml:space="preserve">
<value>Ruleobject Doc</value>
</data>
<data name="&gt;&gt;linkRuleobjectDoc.Name" xml:space="preserve">
<value>linkRuleobjectDoc</value>
</data>
<data name="&gt;&gt;linkRuleobjectDoc.Type" xml:space="preserve">
<value>System.Windows.Forms.LinkLabel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;linkRuleobjectDoc.Parent" xml:space="preserve">
<value>panel3</value>
</data>
<data name="&gt;&gt;linkRuleobjectDoc.ZOrder" xml:space="preserve">
<value>0</value>
</data>
<data name="chkEnabled.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
@@ -151,7 +184,7 @@
<value>NoControl</value>
</data>
<data name="chkEnabled.Location" type="System.Drawing.Point, System.Drawing">
<value>617, 19</value>
<value>632, 45</value>
</data>
<data name="chkEnabled.Size" type="System.Drawing.Size, System.Drawing">
<value>60, 16</value>
@@ -172,7 +205,7 @@
<value>panel3</value>
</data>
<data name="&gt;&gt;chkEnabled.ZOrder" xml:space="preserve">
<value>0</value>
<value>1</value>
</data>
<data name="clbInboundTag.ColumnWidth" type="System.Int32, mscorlib">
<value>80</value>
@@ -183,11 +216,17 @@
<data name="clbInboundTag.Items1" xml:space="preserve">
<value>http</value>
</data>
<data name="clbInboundTag.Items2" xml:space="preserve">
<value>socks2</value>
</data>
<data name="clbInboundTag.Items3" xml:space="preserve">
<value>http2</value>
</data>
<data name="clbInboundTag.Location" type="System.Drawing.Point, System.Drawing">
<value>347, 16</value>
</data>
<data name="clbInboundTag.Size" type="System.Drawing.Size, System.Drawing">
<value>245, 20</value>
<value>345, 20</value>
</data>
<data name="clbInboundTag.TabIndex" type="System.Int32, mscorlib">
<value>41</value>
@@ -202,7 +241,7 @@
<value>panel3</value>
</data>
<data name="&gt;&gt;clbInboundTag.ZOrder" xml:space="preserve">
<value>1</value>
<value>2</value>
</data>
<data name="label2.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
@@ -232,7 +271,7 @@
<value>panel3</value>
</data>
<data name="&gt;&gt;label2.ZOrder" xml:space="preserve">
<value>2</value>
<value>3</value>
</data>
<data name="clbProtocol.ColumnWidth" type="System.Int32, mscorlib">
<value>80</value>
@@ -265,7 +304,7 @@
<value>panel3</value>
</data>
<data name="&gt;&gt;clbProtocol.ZOrder" xml:space="preserve">
<value>3</value>
<value>4</value>
</data>
<data name="label3.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
@@ -295,7 +334,7 @@
<value>panel3</value>
</data>
<data name="&gt;&gt;label3.ZOrder" xml:space="preserve">
<value>4</value>
<value>5</value>
</data>
<data name="txtPort.Location" type="System.Drawing.Point, System.Drawing">
<value>107, 43</value>
@@ -316,7 +355,7 @@
<value>panel3</value>
</data>
<data name="&gt;&gt;txtPort.ZOrder" xml:space="preserve">
<value>5</value>
<value>6</value>
</data>
<data name="label1.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
@@ -346,16 +385,16 @@
<value>panel3</value>
</data>
<data name="&gt;&gt;label1.ZOrder" xml:space="preserve">
<value>6</value>
<value>7</value>
</data>
<data name="labRoutingTips.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
<value>NoControl</value>
</data>
<data name="labRoutingTips.Location" type="System.Drawing.Point, System.Drawing">
<value>19, 82</value>
<value>144, 86</value>
</data>
<data name="labRoutingTips.Size" type="System.Drawing.Size, System.Drawing">
<value>598, 16</value>
<value>575, 16</value>
</data>
<data name="labRoutingTips.TabIndex" type="System.Int32, mscorlib">
<value>33</value>
@@ -373,7 +412,7 @@
<value>panel3</value>
</data>
<data name="&gt;&gt;labRoutingTips.ZOrder" xml:space="preserve">
<value>7</value>
<value>8</value>
</data>
<data name="label4.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
@@ -403,7 +442,7 @@
<value>panel3</value>
</data>
<data name="&gt;&gt;label4.ZOrder" xml:space="preserve">
<value>8</value>
<value>9</value>
</data>
<data name="cmbOutboundTag.Items" xml:space="preserve">
<value>proxy</value>
@@ -433,7 +472,7 @@
<value>panel3</value>
</data>
<data name="&gt;&gt;cmbOutboundTag.ZOrder" xml:space="preserve">
<value>9</value>
<value>10</value>
</data>
<data name="panel3.Dock" type="System.Windows.Forms.DockStyle, System.Windows.Forms">
<value>Top</value>
@@ -459,6 +498,66 @@
<data name="&gt;&gt;panel3.ZOrder" xml:space="preserve">
<value>2</value>
</data>
<data name="&gt;&gt;chkAutoSort.Name" xml:space="preserve">
<value>chkAutoSort</value>
</data>
<data name="&gt;&gt;chkAutoSort.Type" xml:space="preserve">
<value>System.Windows.Forms.CheckBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;chkAutoSort.Parent" xml:space="preserve">
<value>panel4</value>
</data>
<data name="&gt;&gt;chkAutoSort.ZOrder" xml:space="preserve">
<value>0</value>
</data>
<data name="&gt;&gt;btnClose.Name" xml:space="preserve">
<value>btnClose</value>
</data>
<data name="&gt;&gt;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="&gt;&gt;btnClose.Parent" xml:space="preserve">
<value>panel4</value>
</data>
<data name="&gt;&gt;btnClose.ZOrder" xml:space="preserve">
<value>1</value>
</data>
<data name="&gt;&gt;btnOK.Name" xml:space="preserve">
<value>btnOK</value>
</data>
<data name="&gt;&gt;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="&gt;&gt;btnOK.Parent" xml:space="preserve">
<value>panel4</value>
</data>
<data name="&gt;&gt;btnOK.ZOrder" xml:space="preserve">
<value>2</value>
</data>
<data name="panel4.Dock" type="System.Windows.Forms.DockStyle, System.Windows.Forms">
<value>Bottom</value>
</data>
<data name="panel4.Location" type="System.Drawing.Point, System.Drawing">
<value>0, 516</value>
</data>
<data name="panel4.Size" type="System.Drawing.Size, System.Drawing">
<value>742, 60</value>
</data>
<data name="panel4.TabIndex" type="System.Int32, mscorlib">
<value>10</value>
</data>
<data name="&gt;&gt;panel4.Name" xml:space="preserve">
<value>panel4</value>
</data>
<data name="&gt;&gt;panel4.Type" xml:space="preserve">
<value>System.Windows.Forms.Panel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;panel4.Parent" xml:space="preserve">
<value>$this</value>
</data>
<data name="&gt;&gt;panel4.ZOrder" xml:space="preserve">
<value>1</value>
</data>
<data name="chkAutoSort.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
@@ -543,44 +642,53 @@
<data name="&gt;&gt;btnOK.ZOrder" xml:space="preserve">
<value>2</value>
</data>
<data name="panel4.Dock" type="System.Windows.Forms.DockStyle, System.Windows.Forms">
<value>Bottom</value>
<data name="&gt;&gt;groupBox2.Name" xml:space="preserve">
<value>groupBox2</value>
</data>
<data name="panel4.Location" type="System.Drawing.Point, System.Drawing">
<value>0, 516</value>
<data name="&gt;&gt;groupBox2.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="panel4.Size" type="System.Drawing.Size, System.Drawing">
<value>742, 60</value>
<data name="&gt;&gt;groupBox2.Parent" xml:space="preserve">
<value>panel2</value>
</data>
<data name="panel4.TabIndex" type="System.Int32, mscorlib">
<value>10</value>
<data name="&gt;&gt;groupBox2.ZOrder" xml:space="preserve">
<value>0</value>
</data>
<data name="&gt;&gt;panel4.Name" xml:space="preserve">
<value>panel4</value>
<data name="&gt;&gt;groupBox1.Name" xml:space="preserve">
<value>groupBox1</value>
</data>
<data name="&gt;&gt;panel4.Type" xml:space="preserve">
<value>System.Windows.Forms.Panel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
<data name="&gt;&gt;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="&gt;&gt;panel4.Parent" xml:space="preserve">
<value>$this</value>
<data name="&gt;&gt;groupBox1.Parent" xml:space="preserve">
<value>panel2</value>
</data>
<data name="&gt;&gt;panel4.ZOrder" xml:space="preserve">
<data name="&gt;&gt;groupBox1.ZOrder" xml:space="preserve">
<value>1</value>
</data>
<data name="txtIP.Dock" type="System.Windows.Forms.DockStyle, System.Windows.Forms">
<data name="panel2.Dock" type="System.Windows.Forms.DockStyle, System.Windows.Forms">
<value>Fill</value>
</data>
<data name="txtIP.Location" type="System.Drawing.Point, System.Drawing">
<value>3, 17</value>
<data name="panel2.Location" type="System.Drawing.Point, System.Drawing">
<value>0, 121</value>
</data>
<data name="txtIP.Multiline" type="System.Boolean, mscorlib">
<value>True</value>
<data name="panel2.Size" type="System.Drawing.Size, System.Drawing">
<value>742, 395</value>
</data>
<data name="txtIP.Size" type="System.Drawing.Size, System.Drawing">
<value>344, 375</value>
<data name="panel2.TabIndex" type="System.Int32, mscorlib">
<value>11</value>
</data>
<data name="txtIP.TabIndex" type="System.Int32, mscorlib">
<value>25</value>
<data name="&gt;&gt;panel2.Name" xml:space="preserve">
<value>panel2</value>
</data>
<data name="&gt;&gt;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 name="&gt;&gt;panel2.Parent" xml:space="preserve">
<value>$this</value>
</data>
<data name="&gt;&gt;panel2.ZOrder" xml:space="preserve">
<value>0</value>
</data>
<data name="&gt;&gt;txtIP.Name" xml:space="preserve">
<value>txtIP</value>
@@ -621,20 +729,32 @@
<data name="&gt;&gt;groupBox2.ZOrder" xml:space="preserve">
<value>0</value>
</data>
<data name="txtDomain.Dock" type="System.Windows.Forms.DockStyle, System.Windows.Forms">
<data name="txtIP.Dock" type="System.Windows.Forms.DockStyle, System.Windows.Forms">
<value>Fill</value>
</data>
<data name="txtDomain.Location" type="System.Drawing.Point, System.Drawing">
<data name="txtIP.Location" type="System.Drawing.Point, System.Drawing">
<value>3, 17</value>
</data>
<data name="txtDomain.Multiline" type="System.Boolean, mscorlib">
<data name="txtIP.Multiline" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="txtDomain.Size" type="System.Drawing.Size, System.Drawing">
<value>386, 375</value>
<data name="txtIP.Size" type="System.Drawing.Size, System.Drawing">
<value>344, 375</value>
</data>
<data name="txtDomain.TabIndex" type="System.Int32, mscorlib">
<value>24</value>
<data name="txtIP.TabIndex" type="System.Int32, mscorlib">
<value>25</value>
</data>
<data name="&gt;&gt;txtIP.Name" xml:space="preserve">
<value>txtIP</value>
</data>
<data name="&gt;&gt;txtIP.Type" xml:space="preserve">
<value>System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;txtIP.Parent" xml:space="preserve">
<value>groupBox2</value>
</data>
<data name="&gt;&gt;txtIP.ZOrder" xml:space="preserve">
<value>0</value>
</data>
<data name="&gt;&gt;txtDomain.Name" xml:space="preserve">
<value>txtDomain</value>
@@ -675,28 +795,31 @@
<data name="&gt;&gt;groupBox1.ZOrder" xml:space="preserve">
<value>1</value>
</data>
<data name="panel2.Dock" type="System.Windows.Forms.DockStyle, System.Windows.Forms">
<data name="txtDomain.Dock" type="System.Windows.Forms.DockStyle, System.Windows.Forms">
<value>Fill</value>
</data>
<data name="panel2.Location" type="System.Drawing.Point, System.Drawing">
<value>0, 121</value>
<data name="txtDomain.Location" type="System.Drawing.Point, System.Drawing">
<value>3, 17</value>
</data>
<data name="panel2.Size" type="System.Drawing.Size, System.Drawing">
<value>742, 395</value>
<data name="txtDomain.Multiline" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="panel2.TabIndex" type="System.Int32, mscorlib">
<value>11</value>
<data name="txtDomain.Size" type="System.Drawing.Size, System.Drawing">
<value>386, 375</value>
</data>
<data name="&gt;&gt;panel2.Name" xml:space="preserve">
<value>panel2</value>
<data name="txtDomain.TabIndex" type="System.Int32, mscorlib">
<value>24</value>
</data>
<data name="&gt;&gt;panel2.Type" xml:space="preserve">
<value>System.Windows.Forms.Panel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
<data name="&gt;&gt;txtDomain.Name" xml:space="preserve">
<value>txtDomain</value>
</data>
<data name="&gt;&gt;panel2.Parent" xml:space="preserve">
<value>$this</value>
<data name="&gt;&gt;txtDomain.Type" xml:space="preserve">
<value>System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;panel2.ZOrder" xml:space="preserve">
<data name="&gt;&gt;txtDomain.Parent" xml:space="preserve">
<value>groupBox1</value>
</data>
<data name="&gt;&gt;txtDomain.ZOrder" xml:space="preserve">
<value>0</value>
</data>
<metadata name="$this.Localizable" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">

View File

@@ -173,4 +173,7 @@
<data name="chkAutoSort.Text" xml:space="preserve">
<value>保存时Domain和IP自动排序</value>
</data>
<data name="linkRuleobjectDoc.Text" xml:space="preserve">
<value>规则详细说明文档</value>
</data>
</root>

View File

@@ -15,9 +15,9 @@ namespace v2rayN.Forms
{
get; set;
}
protected RoutingItem routingItem = null;
protected RoutingItem routingItem;
private List<int> lvSelecteds = new List<int>();
private readonly List<int> lvSelecteds = new List<int>();
public RoutingRuleSettingForm()
{
InitializeComponent();
@@ -25,14 +25,7 @@ namespace v2rayN.Forms
private void RoutingRuleSettingForm_Load(object sender, EventArgs e)
{
if (EditIndex >= 0)
{
routingItem = config.routings[EditIndex];
}
else
{
routingItem = new RoutingItem();
}
routingItem = EditIndex >= 0 ? config.routings[EditIndex] : new RoutingItem();
if (routingItem.rules == null)
{
routingItem.rules = new List<RulesItem>();
@@ -86,10 +79,8 @@ namespace v2rayN.Forms
lvRoutings.BeginUpdate();
lvRoutings.Items.Clear();
for (int k = 0; k < routingItem.rules.Count; k++)
foreach (var item in routingItem.rules)
{
var item = routingItem.rules[k];
ListViewItem lvItem = new ListViewItem("");
Utils.AddSubItem(lvItem, "outboundTag", item.outboundTag);
Utils.AddSubItem(lvItem, "port", item.port);
@@ -112,7 +103,7 @@ namespace v2rayN.Forms
if (ConfigHandler.AddRoutingItem(ref config, routingItem, EditIndex) == 0)
{
this.DialogResult = DialogResult.OK;
DialogResult = DialogResult.OK;
}
else
{
@@ -122,7 +113,7 @@ namespace v2rayN.Forms
private void btnClose_Click(object sender, EventArgs e)
{
this.DialogResult = DialogResult.Cancel;
DialogResult = DialogResult.Cancel;
}
private void btnBrowse_Click(object sender, EventArgs e)
{

View File

@@ -10,8 +10,8 @@ namespace v2rayN.Forms
{
public partial class RoutingSettingForm : BaseForm
{
private List<int> lvSelecteds = new List<int>();
private RoutingItem lockedItem;
private readonly List<int> _lvSelecteds = new List<int>();
private RoutingItem _lockedItem;
public RoutingSettingForm()
{
InitializeComponent();
@@ -58,7 +58,7 @@ namespace v2rayN.Forms
if (ConfigHandler.SaveRouting(ref config) == 0)
{
this.DialogResult = DialogResult.OK;
DialogResult = DialogResult.OK;
}
else
{
@@ -68,7 +68,7 @@ namespace v2rayN.Forms
private void btnClose_Click(object sender, EventArgs e)
{
this.DialogResult = DialogResult.Cancel;
DialogResult = DialogResult.Cancel;
}
private void chkenableRoutingAdvanced_CheckedChanged_1(object sender, EventArgs e)
{
@@ -78,20 +78,20 @@ namespace v2rayN.Forms
{
if (chkenableRoutingAdvanced.Checked)
{
this.tabPageProxy.Parent = null;
this.tabPageDirect.Parent = null;
this.tabPageBlock.Parent = null;
this.tabPageRuleList.Parent = tabNormal;
tabPageProxy.Parent = null;
tabPageDirect.Parent = null;
tabPageBlock.Parent = null;
tabPageRuleList.Parent = tabNormal;
MenuItemBasic.Enabled = false;
MenuItemAdvanced.Enabled = true;
}
else
{
this.tabPageProxy.Parent = tabNormal;
this.tabPageDirect.Parent = tabNormal;
this.tabPageBlock.Parent = tabNormal;
this.tabPageRuleList.Parent = null;
tabPageProxy.Parent = tabNormal;
tabPageDirect.Parent = tabNormal;
tabPageBlock.Parent = tabNormal;
tabPageRuleList.Parent = null;
MenuItemBasic.Enabled = true;
MenuItemAdvanced.Enabled = false;
}
@@ -102,31 +102,31 @@ namespace v2rayN.Forms
#region locked
private void BindingLockedData()
{
lockedItem = ConfigHandler.GetLockedRoutingItem(ref config);
if (lockedItem != null)
_lockedItem = ConfigHandler.GetLockedRoutingItem(ref config);
if (_lockedItem != null)
{
txtProxyDomain.Text = Utils.List2String(lockedItem.rules[0].domain, true);
txtProxyIp.Text = Utils.List2String(lockedItem.rules[0].ip, true);
txtProxyDomain.Text = Utils.List2String(_lockedItem.rules[0].domain, true);
txtProxyIp.Text = Utils.List2String(_lockedItem.rules[0].ip, true);
txtDirectDomain.Text = Utils.List2String(lockedItem.rules[1].domain, true);
txtDirectIp.Text = Utils.List2String(lockedItem.rules[1].ip, true);
txtDirectDomain.Text = Utils.List2String(_lockedItem.rules[1].domain, true);
txtDirectIp.Text = Utils.List2String(_lockedItem.rules[1].ip, true);
txtBlockDomain.Text = Utils.List2String(lockedItem.rules[2].domain, true);
txtBlockIp.Text = Utils.List2String(lockedItem.rules[2].ip, true);
txtBlockDomain.Text = Utils.List2String(_lockedItem.rules[2].domain, true);
txtBlockIp.Text = Utils.List2String(_lockedItem.rules[2].ip, true);
}
}
private void EndBindingLockedData()
{
if (lockedItem != null)
if (_lockedItem != null)
{
lockedItem.rules[0].domain = Utils.String2List(txtProxyDomain.Text.TrimEx());
lockedItem.rules[0].ip = Utils.String2List(txtProxyIp.Text.TrimEx());
_lockedItem.rules[0].domain = Utils.String2List(txtProxyDomain.Text.TrimEx());
_lockedItem.rules[0].ip = Utils.String2List(txtProxyIp.Text.TrimEx());
lockedItem.rules[1].domain = Utils.String2List(txtDirectDomain.Text.TrimEx());
lockedItem.rules[1].ip = Utils.String2List(txtDirectIp.Text.TrimEx());
_lockedItem.rules[1].domain = Utils.String2List(txtDirectDomain.Text.TrimEx());
_lockedItem.rules[1].ip = Utils.String2List(txtDirectIp.Text.TrimEx());
lockedItem.rules[2].domain = Utils.String2List(txtBlockDomain.Text.TrimEx());
lockedItem.rules[2].ip = Utils.String2List(txtBlockIp.Text.TrimEx());
_lockedItem.rules[2].domain = Utils.String2List(txtBlockDomain.Text.TrimEx());
_lockedItem.rules[2].ip = Utils.String2List(txtBlockIp.Text.TrimEx());
}
}
@@ -207,7 +207,7 @@ namespace v2rayN.Forms
private int GetLvSelectedIndex()
{
int index = -1;
lvSelecteds.Clear();
_lvSelecteds.Clear();
try
{
if (lvRoutings.SelectedIndices.Count <= 0)
@@ -219,7 +219,7 @@ namespace v2rayN.Forms
index = lvRoutings.SelectedIndices[0];
foreach (int i in lvRoutings.SelectedIndices)
{
lvSelecteds.Add(i);
_lvSelecteds.Add(i);
}
return index;
}
@@ -264,7 +264,7 @@ namespace v2rayN.Forms
{
return;
}
for (int k = lvSelecteds.Count - 1; k >= 0; k--)
for (int k = _lvSelecteds.Count - 1; k >= 0; k--)
{
config.routings.RemoveAt(index);
}

View File

@@ -9,7 +9,7 @@ namespace v2rayN.Forms
public partial class ServerTransportControl : UserControl
{
public bool AllowXtls { get; set; }
private VmessItem vmessItem = null;
private VmessItem vmessItem;
public ServerTransportControl()
{

View File

@@ -26,7 +26,7 @@ namespace v2rayN.Forms
private void SubSettingControl_Load(object sender, EventArgs e)
{
this.Height = grbMain.Height;
Height = grbMain.Height;
groupItem = LazyConfig.Instance.GetConfig().groupItem;
@@ -90,7 +90,7 @@ namespace v2rayN.Forms
private void btnShare_Click(object sender, EventArgs e)
{
if (this.Height <= grbMain.Height)
if (Height <= grbMain.Height)
{
if (Utils.IsNullOrEmpty(subItem.url))
{
@@ -98,11 +98,11 @@ namespace v2rayN.Forms
return;
}
picQRCode.Image = QRCodeHelper.GetQRCode(subItem.url);
this.Height = grbMain.Height + 200;
Height = grbMain.Height + 200;
}
else
{
this.Height = grbMain.Height;
Height = grbMain.Height;
}
}
}

View File

@@ -71,7 +71,7 @@ namespace v2rayN.Forms
{
if (ConfigHandler.SaveSubItem(ref config) == 0)
{
this.DialogResult = DialogResult.OK;
DialogResult = DialogResult.OK;
}
else
{
@@ -81,7 +81,7 @@ namespace v2rayN.Forms
private void btnClose_Click(object sender, EventArgs e)
{
this.DialogResult = DialogResult.Cancel;
DialogResult = DialogResult.Cancel;
}
private void btnAdd_Click(object sender, EventArgs e)

View File

@@ -18,6 +18,7 @@ namespace v2rayN
public const string clashMetaCoreUrl = "https://github.com/MetaCubeX/Clash.Meta/releases";
public const string hysteriaCoreUrl = "https://github.com/HyNetwork/hysteria/releases";
public const string naiveproxyCoreUrl = "https://github.com/klzgrad/naiveproxy/releases";
public const string geoUrl = "https://github.com/Loyalsoldier/v2ray-rules-dat/releases/latest/download/{0}.dat";
@@ -211,7 +212,7 @@ namespace v2rayN
public static readonly List<string> vmessSecuritys = new List<string> { "aes-128-gcm", "chacha20-poly1305", "auto", "none", "zero" };
public static readonly List<string> ssSecuritys = new List<string> { "aes-256-gcm", "aes-128-gcm", "chacha20-poly1305", "chacha20-ietf-poly1305", "none", "plain" };
public static readonly List<string> ssSecuritysInXray = new List<string> { "aes-256-gcm", "aes-128-gcm", "chacha20-poly1305", "chacha20-ietf-poly1305", "xchacha20-poly1305", "xchacha20-ietf-poly1305", "none", "plain" };
public static readonly List<string> ssSecuritysInXray = new List<string> { "aes-256-gcm", "aes-128-gcm", "chacha20-poly1305", "chacha20-ietf-poly1305", "xchacha20-poly1305", "xchacha20-ietf-poly1305", "none", "plain", "2022-blake3-aes-128-gcm", "2022-blake3-aes-256-gcm", "2022-blake3-chacha20-poly1305" };
public static readonly List<string> xtlsFlows = new List<string> { "", "xtls-rprx-origin", "xtls-rprx-origin-udp443", "xtls-rprx-direct", "xtls-rprx-direct-udp443" };
public static readonly List<string> networks = new List<string> { "tcp", "kcp", "ws", "h2", "quic", "grpc" };
public static readonly List<string> kcpHeaderTypes = new List<string> { "srtp", "utp", "wechat-video", "dtls", "wireguard" };

View File

@@ -304,7 +304,7 @@ namespace v2rayN.Handler
{
VmessItem vmessItem = Utils.DeepCopy(item);
vmessItem.indexId = string.Empty;
vmessItem.remarks = string.Format("{0}-clone", item.remarks);
vmessItem.remarks = $"{item.remarks}-clone";
if (vmessItem.configType == EConfigType.Custom)
{
@@ -469,7 +469,7 @@ namespace v2rayN.Handler
return -1;
}
var ext = Path.GetExtension(fileName);
string newFileName = string.Format("{0}{1}", Utils.GetGUID(), ext);
string newFileName = $"{Utils.GetGUID()}{ext}";
//newFileName = Path.Combine(Utils.GetTempPath(), newFileName);
try
@@ -489,7 +489,7 @@ namespace v2rayN.Handler
vmessItem.configType = EConfigType.Custom;
if (Utils.IsNullOrEmpty(vmessItem.remarks))
{
vmessItem.remarks = string.Format("import custom@{0}", DateTime.Now.ToShortDateString());
vmessItem.remarks = $"import custom@{DateTime.Now.ToShortDateString()}";
}
@@ -814,7 +814,7 @@ namespace v2rayN.Handler
&& o.path == n.path
&& o.streamSecurity == n.streamSecurity
&& o.flow == n.flow
&& (remarks ? o.remarks == n.remarks : true);
&& (!remarks || o.remarks == n.remarks);
}
private static int RemoveVmessItem(Config config, int index)
@@ -1051,7 +1051,7 @@ namespace v2rayN.Handler
if (lstSsServer == null || lstSsServer.Count <= 0)
{
var ssSIP008 = Utils.FromJson<SsSIP008>(clipboardData);
if (ssSIP008 != null && ssSIP008.servers != null && ssSIP008.servers.Count > 0)
if (ssSIP008?.servers != null && ssSIP008.servers.Count > 0)
{
lstSsServer = ssSIP008.servers;
}
@@ -1154,12 +1154,9 @@ namespace v2rayN.Handler
return -1;
}
foreach (SubItem item in config.subItem)
foreach (var item in config.subItem.Where(item => Utils.IsNullOrEmpty(item.id)))
{
if (Utils.IsNullOrEmpty(item.id))
{
item.id = Utils.GetGUID(false);
}
item.id = Utils.GetGUID(false);
}
ToJsonFile(config);
@@ -1203,12 +1200,9 @@ namespace v2rayN.Handler
return -1;
}
foreach (GroupItem item in config.groupItem)
foreach (var item in config.groupItem.Where(item => Utils.IsNullOrEmpty(item.id)))
{
if (Utils.IsNullOrEmpty(item.id))
{
item.id = Utils.GetGUID(false);
}
item.id = Utils.GetGUID(false);
}
ToJsonFile(config);

View File

@@ -29,8 +29,8 @@ namespace v2rayN.Handler
public ResultEventArgs(bool success, string msg)
{
this.Success = success;
this.Msg = msg;
Success = success;
Msg = msg;
}
}
@@ -51,7 +51,7 @@ namespace v2rayN.Handler
{
if (UpdateCompleted != null)
{
string msg = string.Format("{0} M/s", value).PadLeft(9, ' ');
string msg = $"{value} M/s".PadLeft(9, ' ');
UpdateCompleted(this, new ResultEventArgs(false, msg));
}
};
@@ -88,7 +88,7 @@ namespace v2rayN.Handler
{
if (UpdateCompleted != null)
{
string msg = string.Format("...{0}%", value);
string msg = $"...{value}%";
UpdateCompleted(this, new ResultEventArgs(value > 100 ? true : false, msg));
}
};
@@ -206,7 +206,7 @@ namespace v2rayN.Handler
try
{
HttpWebRequest myHttpWebRequest = (HttpWebRequest)WebRequest.Create(url);
myHttpWebRequest.Timeout = 5000;
myHttpWebRequest.Timeout = 30 * 1000;
myHttpWebRequest.Proxy = webProxy;
Stopwatch timer = new Stopwatch();

View File

@@ -11,10 +11,8 @@ namespace v2rayN.Handler
private Config _config;
private List<CoreInfo> coreInfos;
public static LazyConfig Instance
{
get { return _instance.Value; }
}
public static LazyConfig Instance => _instance.Value;
public void SetConfig(ref Config config)
{
_config = config;
@@ -66,12 +64,24 @@ namespace v2rayN.Handler
{
coreInfos = new List<CoreInfo>();
coreInfos.Add(new CoreInfo
{
coreType = ECoreType.v2rayN,
coreUrl = Global.NUrl,
coreLatestUrl = Global.NUrl + "/latest",
coreDownloadUrl32 = Global.NUrl + "/download/{0}/v2rayN.zip",
coreDownloadUrl64 = Global.NUrl + "/download/{0}/v2rayN.zip",
});
coreInfos.Add(new CoreInfo
{
coreType = ECoreType.v2fly,
coreExes = new List<string> { "wv2ray", "v2ray" },
arguments = "",
coreUrl = Global.v2flyCoreUrl,
coreLatestUrl = Global.v2flyCoreUrl + "/latest",
coreDownloadUrl32 = Global.v2flyCoreUrl + "/download/{0}/v2ray-windows-{1}.zip",
coreDownloadUrl64 = Global.v2flyCoreUrl + "/download/{0}/v2ray-windows-{1}.zip",
match = "V2Ray"
});
@@ -81,6 +91,9 @@ namespace v2rayN.Handler
coreExes = new List<string> { "xray" },
arguments = "",
coreUrl = Global.xrayCoreUrl,
coreLatestUrl = Global.xrayCoreUrl + "/latest",
coreDownloadUrl32 = Global.xrayCoreUrl + "/download/{0}/Xray-windows-{1}.zip",
coreDownloadUrl64 = Global.xrayCoreUrl + "/download/{0}/Xray-windows-{1}.zip",
match = "Xray"
});
@@ -89,7 +102,11 @@ namespace v2rayN.Handler
coreType = ECoreType.clash,
coreExes = new List<string> { "clash-windows-amd64-v3", "clash-windows-amd64", "clash-windows-386", "clash" },
arguments = "-f config.json",
coreUrl = Global.clashCoreUrl
coreUrl = Global.clashCoreUrl,
coreLatestUrl = Global.clashCoreUrl + "/latest",
coreDownloadUrl32 = Global.clashCoreUrl + "/download/{0}/clash-windows-386-{0}.zip",
coreDownloadUrl64 = Global.clashCoreUrl + "/download/{0}/clash-windows-amd64-{0}.zip",
match = "v"
});
coreInfos.Add(new CoreInfo
@@ -97,7 +114,10 @@ namespace v2rayN.Handler
coreType = ECoreType.clash_meta,
coreExes = new List<string> { "Clash.Meta-windows-amd64v1", "Clash.Meta-windows-amd64", "Clash.Meta-windows-386", "Clash.Meta", "clash" },
arguments = "-f config.json",
coreUrl = Global.clashMetaCoreUrl
coreUrl = Global.clashMetaCoreUrl,
coreLatestUrl = Global.clashMetaCoreUrl + "/latest",
coreDownloadUrl32 = Global.clashMetaCoreUrl + "/download/{0}/Clash.Meta-windows-386-{0}.zip",
coreDownloadUrl64 = Global.clashMetaCoreUrl + "/download/{0}/Clash.Meta-windows-amd64-compatible-{0}.zip",
});
coreInfos.Add(new CoreInfo
@@ -105,7 +125,10 @@ namespace v2rayN.Handler
coreType = ECoreType.hysteria,
coreExes = new List<string> { "hysteria-tun-windows-6.0-amd64", "hysteria-tun-windows-6.0-386", "hysteria" },
arguments = "",
coreUrl = Global.hysteriaCoreUrl
coreUrl = Global.hysteriaCoreUrl,
coreLatestUrl = Global.hysteriaCoreUrl + "/latest",
coreDownloadUrl32 = Global.hysteriaCoreUrl + "/download/{0}/hysteria-tun-windows-6.0-386.exe",
coreDownloadUrl64 = Global.hysteriaCoreUrl + "/download/{0}/hysteria-tun-windows-6.0-amd64.exe",
});
coreInfos.Add(new CoreInfo

View File

@@ -24,10 +24,8 @@ namespace v2rayN.Handler
//private List<int> _selecteds;
//private Thread _workThread;
//Action<int, string> _updateFunc;
public static MainFormHandler Instance
{
get { return instance.Value; }
}
public static MainFormHandler Instance => instance.Value;
public Icon GetNotifyIcon(Config config, Icon def)
{
try
@@ -84,7 +82,7 @@ namespace v2rayN.Handler
int index = (int)config.sysProxyType;
if (index > 0)
{
color = (new Color[] { Color.Red, Color.Purple, Color.DarkGreen, Color.Orange, Color.DarkSlateBlue, Color.RoyalBlue })[index - 1];
color = (new[] { Color.Red, Color.Purple, Color.DarkGreen, Color.Orange, Color.DarkSlateBlue, Color.RoyalBlue })[index - 1];
}
int width = 128;
@@ -94,8 +92,11 @@ namespace v2rayN.Handler
Graphics graphics = Graphics.FromImage(bitmap);
SolidBrush drawBrush = new SolidBrush(color);
graphics.FillRectangle(drawBrush, new Rectangle(0, 0, width, height));
graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
//graphics.FillRectangle(drawBrush, new Rectangle(0, 0, width, height));
graphics.DrawImage(new Bitmap(item.customIcon), 0, 0, width, height);
graphics.FillEllipse(drawBrush, width/2, width/2, width/2, width/2);
Icon createdIcon = Icon.FromHandle(bitmap.GetHicon());
drawBrush.Dispose();

View File

@@ -81,7 +81,7 @@ namespace v2rayN.Handler
url = Utils.ToJson(vmessQRCode);
url = Utils.Base64Encode(url);
url = string.Format("{0}{1}", Global.vmessProtocol, url);
url = $"{Global.vmessProtocol}{url}";
return url;
}
@@ -104,7 +104,7 @@ namespace v2rayN.Handler
//new Sip002
var pw = Utils.Base64Encode($"{item.security}:{item.id}");
url = $"{pw}@{GetIpv6(item.address)}:{ item.port}";
url = string.Format("{0}{1}{2}", Global.ssProtocol, url, remark);
url = $"{Global.ssProtocol}{url}{remark}";
return url;
}
@@ -125,7 +125,7 @@ namespace v2rayN.Handler
//new
var pw = Utils.Base64Encode($"{item.security}:{item.id}");
url = $"{pw}@{GetIpv6(item.address)}:{ item.port}";
url = string.Format("{0}{1}{2}", Global.socksProtocol, url, remark);
url = $"{Global.socksProtocol}{url}{remark}";
return url;
}
@@ -145,7 +145,7 @@ namespace v2rayN.Handler
item.id,
GetIpv6(item.address),
item.port);
url = string.Format("{0}{1}{2}{3}", Global.trojanProtocol, url, query, remark);
url = $"{Global.trojanProtocol}{url}{query}{remark}";
return url;
}
@@ -173,7 +173,7 @@ namespace v2rayN.Handler
item.id,
GetIpv6(item.address),
item.port);
url = string.Format("{0}{1}{2}{3}", Global.vlessProtocol, url, query, remark);
url = $"{Global.vlessProtocol}{url}{query}{remark}";
return url;
}
private static string GetIpv6(string address)
@@ -207,40 +207,20 @@ namespace v2rayN.Handler
{
dicQuery.Add("alpn", Utils.UrlEncode(Utils.List2String(item.alpn)));
}
if (!Utils.IsNullOrEmpty(item.network))
{
dicQuery.Add("type", item.network);
}
else
{
dicQuery.Add("type", "tcp");
}
dicQuery.Add("type", !Utils.IsNullOrEmpty(item.network) ? item.network : "tcp");
switch (item.network)
{
case "tcp":
if (!Utils.IsNullOrEmpty(item.headerType))
{
dicQuery.Add("headerType", item.headerType);
}
else
{
dicQuery.Add("headerType", "none");
}
dicQuery.Add("headerType", !Utils.IsNullOrEmpty(item.headerType) ? item.headerType : "none");
if (!Utils.IsNullOrEmpty(item.requestHost))
{
dicQuery.Add("host", Utils.UrlEncode(item.requestHost));
}
break;
case "kcp":
if (!Utils.IsNullOrEmpty(item.headerType))
{
dicQuery.Add("headerType", item.headerType);
}
else
{
dicQuery.Add("headerType", "none");
}
dicQuery.Add("headerType", !Utils.IsNullOrEmpty(item.headerType) ? item.headerType : "none");
if (!Utils.IsNullOrEmpty(item.path))
{
dicQuery.Add("seed", Utils.UrlEncode(item.path));
@@ -272,14 +252,7 @@ namespace v2rayN.Handler
break;
case "quic":
if (!Utils.IsNullOrEmpty(item.headerType))
{
dicQuery.Add("headerType", item.headerType);
}
else
{
dicQuery.Add("headerType", "none");
}
dicQuery.Add("headerType", !Utils.IsNullOrEmpty(item.headerType) ? item.headerType : "none");
dicQuery.Add("quicSecurity", Utils.UrlEncode(item.requestHost));
dicQuery.Add("key", Utils.UrlEncode(item.path));
break;
@@ -341,11 +314,7 @@ namespace v2rayN.Handler
{
msg = ResUI.ConfigurationFormatIncorrect;
vmessItem = ResolveSSLegacy(result);
if (vmessItem == null)
{
vmessItem = ResolveSip002(result);
}
vmessItem = ResolveSSLegacy(result) ?? ResolveSip002(result);
if (vmessItem == null)
{
return null;
@@ -361,11 +330,7 @@ namespace v2rayN.Handler
{
msg = ResUI.ConfigurationFormatIncorrect;
vmessItem = ResolveSocksNew(result);
if (vmessItem == null)
{
vmessItem = ResolveSocks(result);
}
vmessItem = ResolveSocksNew(result) ?? ResolveSocks(result);
if (vmessItem == null)
{
return null;
@@ -407,9 +372,11 @@ namespace v2rayN.Handler
private static VmessItem ResolveVmess(string result, out string msg)
{
msg = string.Empty;
VmessItem vmessItem = new VmessItem();
var vmessItem = new VmessItem
{
configType = EConfigType.Vmess
};
vmessItem.configType = EConfigType.Vmess;
result = result.Substring(Global.vmessProtocol.Length);
result = Utils.Base64Decode(result);
@@ -432,14 +399,7 @@ namespace v2rayN.Handler
vmessItem.alterId = Utils.ToInt(vmessQRCode.aid);
vmessItem.security = Utils.ToString(vmessQRCode.scy);
if (!Utils.IsNullOrEmpty(vmessQRCode.scy))
{
vmessItem.security = vmessQRCode.scy;
}
else
{
vmessItem.security = Global.DefaultSecurity;
}
vmessItem.security = !Utils.IsNullOrEmpty(vmessQRCode.scy) ? vmessQRCode.scy : Global.DefaultSecurity;
if (!Utils.IsNullOrEmpty(vmessQRCode.net))
{
vmessItem.network = vmessQRCode.net;
@@ -594,22 +554,47 @@ namespace v2rayN.Handler
address = parsedUrl.IdnHost,
port = parsedUrl.Port,
};
// parse base64 UserInfo
string rawUserInfo = parsedUrl.GetComponents(UriComponents.UserInfo, UriFormat.UriEscaped);
string userInfo = Utils.Base64Decode(rawUserInfo);
string[] userInfoParts = userInfo.Split(new char[] { ':' }, 2);
if (userInfoParts.Length != 2)
//2022-blake3
if (rawUserInfo.Contains(":"))
{
return null;
string[] userInfoParts = rawUserInfo.Split(new[] { ':' }, 2);
if (userInfoParts.Length != 2)
{
return null;
}
server.security = userInfoParts[0];
server.id = Utils.UrlDecode(userInfoParts[1]);
}
else
{
// parse base64 UserInfo
string userInfo = Utils.Base64Decode(rawUserInfo);
string[] userInfoParts = userInfo.Split(new[] { ':' }, 2);
if (userInfoParts.Length != 2)
{
return null;
}
server.security = userInfoParts[0];
server.id = userInfoParts[1];
}
server.security = userInfoParts[0];
server.id = userInfoParts[1];
NameValueCollection queryParameters = HttpUtility.ParseQueryString(parsedUrl.Query);
if (queryParameters["plugin"] != null)
{
return null;
//obfs-host exists
var obfsHost = queryParameters["plugin"].Split(';').FirstOrDefault(t => t.Contains("obfs-host"));
if (queryParameters["plugin"].Contains("obfs=http") && !Utils.IsNullOrEmpty(obfsHost))
{
obfsHost = obfsHost.Replace("obfs-host=", "");
server.network = Global.DefaultNetwork;
server.headerType = Global.TcpHeaderHttp;
server.requestHost = obfsHost;
}
else
{
return null;
}
}
return server;
@@ -655,8 +640,10 @@ namespace v2rayN.Handler
private static VmessItem ResolveSocks(string result)
{
VmessItem vmessItem = new VmessItem();
vmessItem.configType = EConfigType.Socks;
VmessItem vmessItem = new VmessItem
{
configType = EConfigType.Socks
};
result = result.Substring(Global.socksProtocol.Length);
//remark
int indexRemark = result.IndexOf("#");
@@ -720,7 +707,7 @@ namespace v2rayN.Handler
// parse base64 UserInfo
string rawUserInfo = parsedUrl.GetComponents(UriComponents.UserInfo, UriFormat.Unescaped);
string userInfo = Utils.Base64Decode(rawUserInfo);
string[] userInfoParts = userInfo.Split(new char[] { ':' }, 2);
string[] userInfoParts = userInfo.Split(new[] { ':' }, 2);
if (userInfoParts.Length == 2)
{
server.security = userInfoParts[0];

View File

@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Net;
using System.Net.Sockets;
using System.Threading;
@@ -43,19 +44,19 @@ namespace v2rayN.Handler
if (actionType == ESpeedActionType.Ping)
{
Task.Run(() => RunPing());
Task.Run(RunPing);
}
else if (actionType == ESpeedActionType.Tcping)
{
Task.Run(() => RunTcping());
Task.Run(RunTcping);
}
else if (actionType == ESpeedActionType.Realping)
{
Task.Run(() => RunRealPing());
Task.Run(RunRealPing);
}
else if (actionType == ESpeedActionType.Speedtest)
{
Task.Run(() => RunSpeedTestAsync());
Task.Run(RunSpeedTestAsync);
}
}
@@ -63,12 +64,8 @@ namespace v2rayN.Handler
{
try
{
foreach (var it in _selecteds)
foreach (var it in _selecteds.Where(it => it.configType != EConfigType.Custom))
{
if (it.configType == EConfigType.Custom)
{
continue;
}
try
{
Task.Run(() => updateFun(it));
@@ -252,7 +249,7 @@ namespace v2rayN.Handler
{
return "Timeout";
}
return string.Format("{0}{1}", time, unit).PadLeft(8, ' ');
return $"{time}{unit}".PadLeft(8, ' ');
}
}
}

View File

@@ -31,13 +31,7 @@ namespace v2rayN.Handler
}
public List<ServerStatItem> Statistic
{
get
{
return serverStatistics_.server;
}
}
public List<ServerStatItem> Statistic => serverStatistics_.server;
public StatisticsHandler(Mode.Config config, Action<ulong, ulong, List<ServerStatItem>> update)
{
@@ -68,7 +62,7 @@ namespace v2rayN.Handler
GrpcInit();
Task.Run(() => Run());
Task.Run(Run);
}
private void GrpcInit()

View File

@@ -26,19 +26,11 @@ namespace v2rayN.Handler
public ResultEventArgs(bool success, string msg)
{
this.Success = success;
this.Msg = msg;
Success = success;
Msg = msg;
}
}
private readonly string nLatestUrl = Global.NUrl + "/latest";
private const string nUrl = Global.NUrl + "/download/{0}/v2rayN.zip";
private readonly string v2flyCoreLatestUrl = Global.v2flyCoreUrl + "/latest";
private const string v2flyCoreUrl = Global.v2flyCoreUrl + "/download/{0}/v2ray-windows-{1}.zip";
private readonly string xrayCoreLatestUrl = Global.xrayCoreUrl + "/latest";
private const string xrayCoreUrl = Global.xrayCoreUrl + "/download/{0}/Xray-windows-{1}.zip";
private const string geoUrl = "https://github.com/Loyalsoldier/v2ray-rules-dat/releases/latest/download/{0}.dat";
public void CheckUpdateGuiN(Config config, Action<bool, string> update)
{
_config = config;
@@ -217,16 +209,12 @@ namespace v2rayN.Handler
else
{
int ret = ConfigHandler.AddBatchServers(ref config, result, id, groupId);
if (ret > 0)
{
_updateFunc(false, $"{hashCode}{ResUI.MsgUpdateSubscriptionEnd}");
}
else
{
_updateFunc(false, $"{hashCode}{ResUI.MsgFailedImportSubscription}");
}
_updateFunc(false,
ret > 0
? $"{hashCode}{ResUI.MsgUpdateSubscriptionEnd}"
: $"{hashCode}{ResUI.MsgFailedImportSubscription}");
}
_updateFunc(false, $"-------------------------------------------------------");
_updateFunc(false, "-------------------------------------------------------");
}
//restore system proxy
if (bSysProxyType)
@@ -244,7 +232,7 @@ namespace v2rayN.Handler
{
_config = config;
_updateFunc = update;
var url = string.Format(geoUrl, geoName);
var url = string.Format(Global.geoUrl, geoName);
DownloadHandle downloadHandle = null;
if (downloadHandle == null)
@@ -306,23 +294,8 @@ namespace v2rayN.Handler
{
try
{
string url;
if (type == ECoreType.v2fly)
{
url = v2flyCoreLatestUrl;
}
else if (type == ECoreType.Xray)
{
url = xrayCoreLatestUrl;
}
else if (type == ECoreType.v2rayN)
{
url = nLatestUrl;
}
else
{
throw new ArgumentException("Type");
}
var coreInfo = LazyConfig.Instance.GetCoreInfo(type);
string url = coreInfo.coreLatestUrl;
var result = await (new DownloadHandle()).UrlRedirectAsync(url, true);
if (!Utils.IsNullOrEmpty(result))
@@ -354,7 +327,7 @@ namespace v2rayN.Handler
string filePath = string.Empty;
foreach (string name in coreInfo.coreExes)
{
string vName = string.Format("{0}.exe", name);
string vName = $"{name}.exe";
vName = Utils.GetPath(vName);
if (File.Exists(vName))
{
@@ -396,33 +369,46 @@ namespace v2rayN.Handler
try
{
string version = redirectUrl.Substring(redirectUrl.LastIndexOf("/", StringComparison.Ordinal) + 1);
var coreInfo = LazyConfig.Instance.GetCoreInfo(type);
string curVersion;
string message;
string url;
if (type == ECoreType.v2fly)
switch (type)
{
curVersion = "v" + getCoreVersion(type);
message = string.Format(ResUI.IsLatestCore, curVersion);
string osBit = Environment.Is64BitProcess ? "64" : "32";
url = string.Format(v2flyCoreUrl, version, osBit);
}
else if (type == ECoreType.Xray)
{
curVersion = "v" + getCoreVersion(type);
message = string.Format(ResUI.IsLatestCore, curVersion);
string osBit = Environment.Is64BitProcess ? "64" : "32";
url = string.Format(xrayCoreUrl, version, osBit);
}
else if (type == ECoreType.v2rayN)
{
curVersion = FileVersionInfo.GetVersionInfo(Utils.GetExePath()).FileVersion.ToString();
message = string.Format(ResUI.IsLatestN, curVersion);
url = string.Format(nUrl, version);
}
else
{
throw new ArgumentException("Type");
case ECoreType.v2fly:
case ECoreType.Xray:
{
curVersion = "v" + getCoreVersion(type);
message = string.Format(ResUI.IsLatestCore, curVersion);
string osBit = Environment.Is64BitProcess ? "64" : "32";
url = string.Format(coreInfo.coreDownloadUrl64, version, osBit);
break;
}
case ECoreType.clash:
case ECoreType.clash_meta:
{
curVersion = "";//getCoreVersion(type);
message = string.Format(ResUI.IsLatestCore, curVersion);
if (Environment.Is64BitProcess)
{
url = string.Format(coreInfo.coreDownloadUrl64, version);
}
else
{
url = string.Format(coreInfo.coreDownloadUrl32, version);
}
break;
}
case ECoreType.v2rayN:
{
curVersion = FileVersionInfo.GetVersionInfo(Utils.GetExePath()).FileVersion.ToString();
message = string.Format(ResUI.IsLatestN, curVersion);
url = string.Format(coreInfo.coreDownloadUrl64, version);
break;
}
default:
throw new ArgumentException("Type");
}
if (curVersion == version)

View File

@@ -406,9 +406,7 @@ namespace v2rayN.Handler
outbound.mux.enabled = config.muxEnabled;
outbound.mux.concurrency = config.muxEnabled ? 8 : -1;
//远程服务器底层传输配置
StreamSettings streamSettings = outbound.streamSettings;
boundStreamSettings(node, "out", ref streamSettings);
boundStreamSettings(node, "out", outbound.streamSettings);
outbound.protocol = Global.vmessProtocolLite;
outbound.settings.servers = null;
@@ -429,14 +427,7 @@ namespace v2rayN.Handler
serversItem.address = node.address;
serversItem.port = node.port;
serversItem.password = node.id;
if (LazyConfig.Instance.GetShadowsocksSecuritys().Contains(node.security))
{
serversItem.method = node.security;
}
else
{
serversItem.method = "none";
}
serversItem.method = LazyConfig.Instance.GetShadowsocksSecuritys().Contains(node.security) ? node.security : "none";
serversItem.ota = false;
@@ -445,6 +436,7 @@ namespace v2rayN.Handler
outbound.mux.enabled = false;
outbound.mux.concurrency = -1;
boundStreamSettings(node, "out", outbound.streamSettings);
outbound.protocol = Global.ssProtocolLite;
outbound.settings.vnext = null;
@@ -522,9 +514,7 @@ namespace v2rayN.Handler
outbound.mux.enabled = config.muxEnabled;
outbound.mux.concurrency = config.muxEnabled ? 8 : -1;
//远程服务器底层传输配置
StreamSettings streamSettings = outbound.streamSettings;
boundStreamSettings(node, "out", ref streamSettings);
boundStreamSettings(node, "out", outbound.streamSettings);
//if xtls
if (node.streamSecurity == Global.StreamSecurityX)
@@ -585,10 +575,7 @@ namespace v2rayN.Handler
outbound.mux.enabled = false;
outbound.mux.concurrency = -1;
//远程服务器底层传输配置
StreamSettings streamSettings = outbound.streamSettings;
boundStreamSettings(node, "out", ref streamSettings);
boundStreamSettings(node, "out", outbound.streamSettings);
outbound.protocol = Global.trojanProtocolLite;
outbound.settings.vnext = null;
@@ -601,18 +588,18 @@ namespace v2rayN.Handler
}
/// <summary>
/// vmess协议远程服务器底层传输配置
/// 底层传输配置
/// </summary>
/// <param name="node"></param>
/// <param name="iobound"></param>
/// <param name="streamSettings"></param>
/// <returns></returns>
private static int boundStreamSettings(VmessItem node, string iobound, ref StreamSettings streamSettings)
private static int boundStreamSettings(VmessItem node, string iobound, StreamSettings streamSettings)
{
try
{
var config = LazyConfig.Instance.GetConfig();
//远程服务器底层传输配置
streamSettings.network = node.GetNetwork();
string host = node.requestHost.TrimEx();
string sni = node.sni;
@@ -767,10 +754,12 @@ namespace v2rayN.Handler
}
break;
case "grpc":
var grpcSettings = new GrpcSettings();
var grpcSettings = new GrpcSettings
{
serviceName = node.path,
multiMode = (node.headerType == Global.GrpcmultiMode)
};
grpcSettings.serviceName = node.path;
grpcSettings.multiMode = (node.headerType == Global.GrpcmultiMode ? true : false);
streamSettings.grpcSettings = grpcSettings;
break;
default:
@@ -791,7 +780,7 @@ namespace v2rayN.Handler
string request = Utils.GetEmbedText(Global.v2raySampleHttprequestFileName);
string[] arrHost = host.Split(',');
string host2 = string.Join("\",\"", arrHost);
request = request.Replace("$requestHost$", string.Format("\"{0}\"", host2));
request = request.Replace("$requestHost$", $"\"{host2}\"");
//request = request.Replace("$requestHost$", string.Format("\"{0}\"", config.requestHost()));
//填入自定义Path
@@ -801,7 +790,7 @@ namespace v2rayN.Handler
string[] arrPath = node.path.Split(',');
pathHttp = string.Join("\",\"", arrPath);
}
request = request.Replace("$requestPath$", string.Format("\"{0}\"", pathHttp));
request = request.Replace("$requestPath$", $"\"{pathHttp}\"");
tcpSettings.header.request = Utils.FromJson<object>(request);
}
else if (iobound.Equals("in"))
@@ -888,7 +877,7 @@ namespace v2rayN.Handler
policyObj.system = policySystemSetting;
v2rayConfig.policy = policyObj;
if (!v2rayConfig.inbounds.Exists(item => { return item.tag == tag; }))
if (!v2rayConfig.inbounds.Exists(item => item.tag == tag))
{
Inbounds apiInbound = new Inbounds();
Inboundsettings apiInboundSettings = new Inboundsettings();
@@ -901,7 +890,7 @@ namespace v2rayN.Handler
v2rayConfig.inbounds.Add(apiInbound);
}
if (!v2rayConfig.routing.rules.Exists(item => { return item.outboundTag == tag; }))
if (!v2rayConfig.routing.rules.Exists(item => item.outboundTag == tag))
{
RulesItem apiRoutingRule = new RulesItem
{
@@ -1088,9 +1077,7 @@ namespace v2rayN.Handler
inbound.settings.decryption = node.security;
}
//远程服务器底层传输配置
StreamSettings streamSettings = inbound.streamSettings;
boundStreamSettings(node, "in", ref streamSettings);
boundStreamSettings(node, "in", inbound.streamSettings);
}
catch
{
@@ -1179,7 +1166,7 @@ namespace v2rayN.Handler
vmessItem.port = outbound.settings.vnext[0].port;
vmessItem.id = outbound.settings.vnext[0].users[0].id;
vmessItem.alterId = outbound.settings.vnext[0].users[0].alterId;
vmessItem.remarks = string.Format("import@{0}", DateTime.Now.ToShortDateString());
vmessItem.remarks = $"import@{DateTime.Now.ToShortDateString()}";
//tcp or kcp
if (outbound.streamSettings != null
@@ -1324,7 +1311,7 @@ namespace v2rayN.Handler
vmessItem.id = inbound.settings.clients[0].id;
vmessItem.alterId = inbound.settings.clients[0].alterId;
vmessItem.remarks = string.Format("import@{0}", DateTime.Now.ToShortDateString());
vmessItem.remarks = $"import@{DateTime.Now.ToShortDateString()}";
//tcp or kcp
if (inbound.streamSettings != null

View File

@@ -175,7 +175,7 @@ namespace v2rayN.Handler
string fileName = string.Empty;
foreach (string name in lstCoreTemp)
{
string vName = string.Format("{0}.exe", name);
string vName = $"{name}.exe";
vName = Utils.GetPath(vName);
if (File.Exists(vName))
{
@@ -217,14 +217,14 @@ namespace v2rayN.Handler
StandardOutputEncoding = Encoding.UTF8
}
};
p.OutputDataReceived += new DataReceivedEventHandler((sender, e) =>
p.OutputDataReceived += (sender, e) =>
{
if (!String.IsNullOrEmpty(e.Data))
{
string msg = e.Data + Environment.NewLine;
ShowMsg(false, msg);
}
});
};
p.Start();
p.PriorityClass = ProcessPriorityClass.High;
p.BeginOutputReadLine();
@@ -272,14 +272,14 @@ namespace v2rayN.Handler
StandardOutputEncoding = Encoding.UTF8
}
};
p.OutputDataReceived += new DataReceivedEventHandler((sender, e) =>
p.OutputDataReceived += (sender, e) =>
{
if (!String.IsNullOrEmpty(e.Data))
{
string msg = e.Data + Environment.NewLine;
ShowMsg(false, msg);
}
});
};
p.Start();
p.BeginOutputReadLine();

View File

@@ -14,6 +14,12 @@ namespace v2rayN.Mode
public string coreUrl { get; set; }
public string coreLatestUrl { get; set; }
public string coreDownloadUrl32 { get; set; }
public string coreDownloadUrl64 { get; set; }
public string match { get; set; }
}
}

View File

@@ -25,8 +25,8 @@ namespace v2rayN
}
Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException);
Application.ThreadException += new ThreadExceptionEventHandler(Application_ThreadException);
AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
Application.ThreadException += Application_ThreadException;
AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
//AppDomain.CurrentDomain.AssemblyResolve += CurrentDomain_AssemblyResolve;

View File

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

View File

@@ -1,10 +1,10 @@
//------------------------------------------------------------------------------
// <auto-generated>
// 此代码由工具生成。
// 运行时版本:4.0.30319.42000
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// 对此文件的更改可能会导致不正确的行为,并且如果
// 重新生成代码,这些更改将会丢失。
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
@@ -13,13 +13,13 @@ namespace v2rayN.Resx {
/// <summary>
/// 一个强类型的资源类,用于查找本地化的字符串等。
/// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary>
// 此类是由 StronglyTypedResourceBuilder
// 类通过类似于 ResGen Visual Studio 的工具自动生成的。
// 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen
// (以 /str 作为命令选项),或重新生成 VS 项目。
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")]
// This class was auto-generated by the StronglyTypedResourceBuilder
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class ResUI {
@@ -33,7 +33,7 @@ namespace v2rayN.Resx {
}
/// <summary>
/// 返回此类使用的缓存的 ResourceManager 实例。
/// Returns the cached ResourceManager instance used by this class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager {
@@ -47,8 +47,8 @@ namespace v2rayN.Resx {
}
/// <summary>
/// 重写当前线程的 CurrentUICulture 属性,对
/// 使用此强类型资源类的所有资源查找执行重写。
/// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture {
@@ -61,7 +61,7 @@ namespace v2rayN.Resx {
}
/// <summary>
/// 查找类似 Do you want to append rules? Choose yes to append, choose otherwise to replace 的本地化字符串。
/// Looks up a localized string similar to Do you want to append rules? Choose yes to append, choose otherwise to replace.
/// </summary>
internal static string AddBatchRoutingRulesYesNo {
get {
@@ -70,7 +70,7 @@ namespace v2rayN.Resx {
}
/// <summary>
/// 查找类似 All servers 的本地化字符串。
/// Looks up a localized string similar to All servers.
/// </summary>
internal static string AllGroupServers {
get {
@@ -79,7 +79,7 @@ namespace v2rayN.Resx {
}
/// <summary>
/// 查找类似 Batch export subscription to clipboard successfully 的本地化字符串。
/// Looks up a localized string similar to Batch export subscription to clipboard successfully.
/// </summary>
internal static string BatchExportSubscriptionSuccessfully {
get {
@@ -88,7 +88,7 @@ namespace v2rayN.Resx {
}
/// <summary>
/// 查找类似 Batch export share URL to clipboard successfully 的本地化字符串。
/// Looks up a localized string similar to Batch export share URL to clipboard successfully.
/// </summary>
internal static string BatchExportURLSuccessfully {
get {
@@ -97,7 +97,7 @@ namespace v2rayN.Resx {
}
/// <summary>
/// 查找类似 Please check the server settings first 的本地化字符串。
/// Looks up a localized string similar to Please check the server settings first.
/// </summary>
internal static string CheckServerSettings {
get {
@@ -106,7 +106,7 @@ namespace v2rayN.Resx {
}
/// <summary>
/// 查找类似 configuration format is incorrect 的本地化字符串。
/// Looks up a localized string similar to Invalid configuration format.
/// </summary>
internal static string ConfigurationFormatIncorrect {
get {
@@ -115,7 +115,7 @@ namespace v2rayN.Resx {
}
/// <summary>
/// 查找类似 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. 的本地化字符串。
/// Looks up a localized string similar to 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>
internal static string CustomServerTips {
get {
@@ -124,7 +124,7 @@ namespace v2rayN.Resx {
}
/// <summary>
/// 查找类似 Downloading... 的本地化字符串。
/// Looks up a localized string similar to Downloading....
/// </summary>
internal static string Downloading {
get {
@@ -133,7 +133,7 @@ namespace v2rayN.Resx {
}
/// <summary>
/// 查找类似 DOWN 的本地化字符串。
/// Looks up a localized string similar to Download.
/// </summary>
internal static string downloadSpeed {
get {
@@ -142,7 +142,7 @@ namespace v2rayN.Resx {
}
/// <summary>
/// 查找类似 Whether to download? {0} 的本地化字符串。
/// Looks up a localized string similar to Whether to download? {0}.
/// </summary>
internal static string DownloadYesNo {
get {
@@ -151,7 +151,7 @@ namespace v2rayN.Resx {
}
/// <summary>
/// 查找类似 Failed to convert configuration file 的本地化字符串。
/// Looks up a localized string similar to Failed to convert configuration file.
/// </summary>
internal static string FailedConversionConfiguration {
get {
@@ -160,7 +160,7 @@ namespace v2rayN.Resx {
}
/// <summary>
/// 查找类似 Failed to generate default configuration file 的本地化字符串。
/// Looks up a localized string similar to Failed to generate default configuration file.
/// </summary>
internal static string FailedGenDefaultConfiguration {
get {
@@ -169,7 +169,7 @@ namespace v2rayN.Resx {
}
/// <summary>
/// 查找类似 Failed to get the default configuration 的本地化字符串。
/// Looks up a localized string similar to Failed to get the default configuration.
/// </summary>
internal static string FailedGetDefaultConfiguration {
get {
@@ -178,7 +178,7 @@ namespace v2rayN.Resx {
}
/// <summary>
/// 查找类似 Failed to import custom configuration server 的本地化字符串。
/// Looks up a localized string similar to Failed to import custom configuration server.
/// </summary>
internal static string FailedImportedCustomServer {
get {
@@ -187,7 +187,7 @@ namespace v2rayN.Resx {
}
/// <summary>
/// 查找类似 Failed to read configuration file 的本地化字符串。
/// Looks up a localized string similar to Failed to read configuration file.
/// </summary>
internal static string FailedReadConfiguration {
get {
@@ -196,7 +196,7 @@ namespace v2rayN.Resx {
}
/// <summary>
/// 查找类似 Please fill in the correct custom DNS 的本地化字符串。
/// Looks up a localized string similar to Please fill in the correct custom DNS.
/// </summary>
internal static string FillCorrectDNSText {
get {
@@ -205,7 +205,7 @@ namespace v2rayN.Resx {
}
/// <summary>
/// 查找类似 Please fill in the correct format server port 的本地化字符串。
/// Looks up a localized string similar to Please fill in the correct format server port.
/// </summary>
internal static string FillCorrectServerPort {
get {
@@ -214,7 +214,7 @@ namespace v2rayN.Resx {
}
/// <summary>
/// 查找类似 Please fill in the KCP parameters correctly 的本地化字符串。
/// Looks up a localized string similar to Please fill in the KCP parameters correctly.
/// </summary>
internal static string FillKcpParameters {
get {
@@ -223,7 +223,7 @@ namespace v2rayN.Resx {
}
/// <summary>
/// 查找类似 Please fill in the local listening port 的本地化字符串。
/// Looks up a localized string similar to Please fill in the local listening port.
/// </summary>
internal static string FillLocalListeningPort {
get {
@@ -232,7 +232,7 @@ namespace v2rayN.Resx {
}
/// <summary>
/// 查找类似 Please fill in the password 的本地化字符串。
/// Looks up a localized string similar to Please fill in the password.
/// </summary>
internal static string FillPassword {
get {
@@ -241,7 +241,7 @@ namespace v2rayN.Resx {
}
/// <summary>
/// 查找类似 Please fill in the server address 的本地化字符串。
/// Looks up a localized string similar to Please fill in the server address.
/// </summary>
internal static string FillServerAddress {
get {
@@ -250,7 +250,7 @@ namespace v2rayN.Resx {
}
/// <summary>
/// 查找类似 Please browse to import server configuration 的本地化字符串。
/// Looks up a localized string similar to Please browse to import server configuration.
/// </summary>
internal static string FillServerAddressCustom {
get {
@@ -259,7 +259,7 @@ namespace v2rayN.Resx {
}
/// <summary>
/// 查找类似 Please fill in the user ID 的本地化字符串。
/// Looks up a localized string similar to Please fill in the user ID.
/// </summary>
internal static string FillUUID {
get {
@@ -268,7 +268,7 @@ namespace v2rayN.Resx {
}
/// <summary>
/// 查找类似 is not the correct client configuration file, please check 的本地化字符串。
/// Looks up a localized string similar to is not the correct client configuration file, please check.
/// </summary>
internal static string IncorrectClientConfiguration {
get {
@@ -277,7 +277,7 @@ namespace v2rayN.Resx {
}
/// <summary>
/// 查找类似 is not the correct configuration, please check 的本地化字符串。
/// Looks up a localized string similar to is not the correct configuration, please check.
/// </summary>
internal static string Incorrectconfiguration {
get {
@@ -286,7 +286,7 @@ namespace v2rayN.Resx {
}
/// <summary>
/// 查找类似 is not the correct server configuration file, please check 的本地化字符串。
/// Looks up a localized string similar to is not the correct server configuration file, please check.
/// </summary>
internal static string IncorrectServerConfiguration {
get {
@@ -295,7 +295,7 @@ namespace v2rayN.Resx {
}
/// <summary>
/// 查找类似 Initial Configuration 的本地化字符串。
/// Looks up a localized string similar to Initial Configuration.
/// </summary>
internal static string InitialConfiguration {
get {
@@ -304,7 +304,7 @@ namespace v2rayN.Resx {
}
/// <summary>
/// 查找类似 {0} already up to date. 的本地化字符串。
/// Looks up a localized string similar to {0} already up to date..
/// </summary>
internal static string IsLatestCore {
get {
@@ -313,7 +313,7 @@ namespace v2rayN.Resx {
}
/// <summary>
/// 查找类似 {0} already up to date. 的本地化字符串。
/// Looks up a localized string similar to {0} already up to date..
/// </summary>
internal static string IsLatestN {
get {
@@ -322,7 +322,7 @@ namespace v2rayN.Resx {
}
/// <summary>
/// 查找类似 LAN 的本地化字符串。
/// Looks up a localized string similar to LAN.
/// </summary>
internal static string LabLAN {
get {
@@ -331,7 +331,7 @@ namespace v2rayN.Resx {
}
/// <summary>
/// 查找类似 Local 的本地化字符串。
/// Looks up a localized string similar to Local.
/// </summary>
internal static string LabLocal {
get {
@@ -340,7 +340,7 @@ namespace v2rayN.Resx {
}
/// <summary>
/// 查找类似 Address 的本地化字符串。
/// Looks up a localized string similar to Address.
/// </summary>
internal static string LvAddress {
get {
@@ -349,7 +349,7 @@ namespace v2rayN.Resx {
}
/// <summary>
/// 查找类似 Alias 的本地化字符串。
/// Looks up a localized string similar to Alias.
/// </summary>
internal static string LvAlias {
get {
@@ -358,7 +358,7 @@ namespace v2rayN.Resx {
}
/// <summary>
/// 查找类似 Count 的本地化字符串。
/// Looks up a localized string similar to Count.
/// </summary>
internal static string LvCount {
get {
@@ -367,7 +367,7 @@ namespace v2rayN.Resx {
}
/// <summary>
/// 查找类似 Custom Icon 的本地化字符串。
/// Looks up a localized string similar to Custom Icon.
/// </summary>
internal static string LvCustomIcon {
get {
@@ -376,7 +376,7 @@ namespace v2rayN.Resx {
}
/// <summary>
/// 查找类似 Security 的本地化字符串。
/// Looks up a localized string similar to Security.
/// </summary>
internal static string LvEncryptionMethod {
get {
@@ -385,7 +385,7 @@ namespace v2rayN.Resx {
}
/// <summary>
/// 查找类似 Port 的本地化字符串。
/// Looks up a localized string similar to Port.
/// </summary>
internal static string LvPort {
get {
@@ -394,7 +394,7 @@ namespace v2rayN.Resx {
}
/// <summary>
/// 查找类似 remarks 的本地化字符串。
/// Looks up a localized string similar to remarks.
/// </summary>
internal static string LvRemarks {
get {
@@ -403,7 +403,7 @@ namespace v2rayN.Resx {
}
/// <summary>
/// 查找类似 Type 的本地化字符串。
/// Looks up a localized string similar to Type.
/// </summary>
internal static string LvServiceType {
get {
@@ -412,7 +412,7 @@ namespace v2rayN.Resx {
}
/// <summary>
/// 查找类似 Subs 的本地化字符串。
/// Looks up a localized string similar to Subs.
/// </summary>
internal static string LvSubscription {
get {
@@ -421,7 +421,7 @@ namespace v2rayN.Resx {
}
/// <summary>
/// 查找类似 Test Results 的本地化字符串。
/// Looks up a localized string similar to Test Results.
/// </summary>
internal static string LvTestResults {
get {
@@ -430,7 +430,7 @@ namespace v2rayN.Resx {
}
/// <summary>
/// 查找类似 TLS 的本地化字符串。
/// Looks up a localized string similar to TLS.
/// </summary>
internal static string LvTLS {
get {
@@ -439,7 +439,7 @@ namespace v2rayN.Resx {
}
/// <summary>
/// 查找类似 Today download traffic 的本地化字符串。
/// Looks up a localized string similar to Download traffic today.
/// </summary>
internal static string LvTodayDownloadDataAmount {
get {
@@ -448,7 +448,7 @@ namespace v2rayN.Resx {
}
/// <summary>
/// 查找类似 Today upload traffic 的本地化字符串。
/// Looks up a localized string similar to Upload traffic today.
/// </summary>
internal static string LvTodayUploadDataAmount {
get {
@@ -457,7 +457,7 @@ namespace v2rayN.Resx {
}
/// <summary>
/// 查找类似 Total download traffic 的本地化字符串。
/// Looks up a localized string similar to Total download traffic.
/// </summary>
internal static string LvTotalDownloadDataAmount {
get {
@@ -466,7 +466,7 @@ namespace v2rayN.Resx {
}
/// <summary>
/// 查找类似 Total upload traffic 的本地化字符串。
/// Looks up a localized string similar to Total upload traffic.
/// </summary>
internal static string LvTotalUploadDataAmount {
get {
@@ -475,7 +475,7 @@ namespace v2rayN.Resx {
}
/// <summary>
/// 查找类似 Transport 的本地化字符串。
/// Looks up a localized string similar to Transport.
/// </summary>
internal static string LvTransportProtocol {
get {
@@ -484,7 +484,7 @@ namespace v2rayN.Resx {
}
/// <summary>
/// 查找类似 Url 的本地化字符串。
/// Looks up a localized string similar to Url.
/// </summary>
internal static string LvUrl {
get {
@@ -493,7 +493,7 @@ namespace v2rayN.Resx {
}
/// <summary>
/// 查找类似 MediumFresh 的本地化字符串。
/// Looks up a localized string similar to Medium.
/// </summary>
internal static string MediumFresh {
get {
@@ -502,7 +502,7 @@ namespace v2rayN.Resx {
}
/// <summary>
/// 查找类似 Clear original subscription content 的本地化字符串。
/// Looks up a localized string similar to Clear original subscription content.
/// </summary>
internal static string MsgClearSubscription {
get {
@@ -511,7 +511,7 @@ namespace v2rayN.Resx {
}
/// <summary>
/// 查找类似 Download GeoFile: {0} successfully 的本地化字符串。
/// Looks up a localized string similar to Download GeoFile: {0} successfully.
/// </summary>
internal static string MsgDownloadGeoFileSuccessfully {
get {
@@ -520,7 +520,7 @@ namespace v2rayN.Resx {
}
/// <summary>
/// 查找类似 Download Core successfully 的本地化字符串。
/// Looks up a localized string similar to Download Core successfully.
/// </summary>
internal static string MsgDownloadV2rayCoreSuccessfully {
get {
@@ -529,7 +529,7 @@ namespace v2rayN.Resx {
}
/// <summary>
/// 查找类似 Failed to import subscription content 的本地化字符串。
/// Looks up a localized string similar to Failed to import subscription content.
/// </summary>
internal static string MsgFailedImportSubscription {
get {
@@ -538,7 +538,7 @@ namespace v2rayN.Resx {
}
/// <summary>
/// 查找类似 Get the subscription content successfully 的本地化字符串。
/// Looks up a localized string similar to Get subscription content successfully.
/// </summary>
internal static string MsgGetSubscriptionSuccessfully {
get {
@@ -547,7 +547,7 @@ namespace v2rayN.Resx {
}
/// <summary>
/// 查找类似 Informations (Filter : {0}) 的本地化字符串。
/// Looks up a localized string similar to Information (Filter : {0}).
/// </summary>
internal static string MsgInformationTitle {
get {
@@ -556,7 +556,7 @@ namespace v2rayN.Resx {
}
/// <summary>
/// 查找类似 Please fill in the address (Url) 的本地化字符串。
/// Looks up a localized string similar to Please fill in the address (Url).
/// </summary>
internal static string MsgNeedUrl {
get {
@@ -565,7 +565,7 @@ namespace v2rayN.Resx {
}
/// <summary>
/// 查找类似 No valid subscriptions set 的本地化字符串。
/// Looks up a localized string similar to No valid subscriptions set.
/// </summary>
internal static string MsgNoValidSubscription {
get {
@@ -574,7 +574,7 @@ namespace v2rayN.Resx {
}
/// <summary>
/// 查找类似 PAC update failed 的本地化字符串。
/// Looks up a localized string similar to PAC update failed.
/// </summary>
internal static string MsgPACUpdateFailed {
get {
@@ -583,7 +583,7 @@ namespace v2rayN.Resx {
}
/// <summary>
/// 查找类似 PAC update succeeded 的本地化字符串。
/// Looks up a localized string similar to PAC update succeeded.
/// </summary>
internal static string MsgPACUpdateSuccessfully {
get {
@@ -592,7 +592,7 @@ namespace v2rayN.Resx {
}
/// <summary>
/// 查找类似 Resolve {0} successfully 的本地化字符串。
/// Looks up a localized string similar to Resolve {0} successfully.
/// </summary>
internal static string MsgParsingSuccessfully {
get {
@@ -601,7 +601,7 @@ namespace v2rayN.Resx {
}
/// <summary>
/// 查找类似 Servers (Filter : {0}) 的本地化字符串。
/// Looks up a localized string similar to Servers (Filter : {0}).
/// </summary>
internal static string MsgServerTitle {
get {
@@ -610,7 +610,7 @@ namespace v2rayN.Resx {
}
/// <summary>
/// 查找类似 Simplify PAC Success 的本地化字符串。
/// Looks up a localized string similar to Simplify PAC Success.
/// </summary>
internal static string MsgSimplifyPAC {
get {
@@ -619,7 +619,7 @@ namespace v2rayN.Resx {
}
/// <summary>
/// 查找类似 Start getting subscriptions 的本地化字符串。
/// Looks up a localized string similar to Start getting subscriptions.
/// </summary>
internal static string MsgStartGettingSubscriptions {
get {
@@ -628,7 +628,7 @@ namespace v2rayN.Resx {
}
/// <summary>
/// 查找类似 Start updating {0}... 的本地化字符串。
/// Looks up a localized string similar to Start updating {0}....
/// </summary>
internal static string MsgStartUpdating {
get {
@@ -637,7 +637,7 @@ namespace v2rayN.Resx {
}
/// <summary>
/// 查找类似 Start updating PAC... 的本地化字符串。
/// Looks up a localized string similar to Start updating PAC....
/// </summary>
internal static string MsgStartUpdatingPAC {
get {
@@ -646,7 +646,7 @@ namespace v2rayN.Resx {
}
/// <summary>
/// 查找类似 Invalid subscription content 的本地化字符串。
/// Looks up a localized string similar to Invalid subscription content.
/// </summary>
internal static string MsgSubscriptionDecodingFailed {
get {
@@ -655,7 +655,7 @@ namespace v2rayN.Resx {
}
/// <summary>
/// 查找类似 is unpacking... 的本地化字符串。
/// Looks up a localized string similar to is unpacking....
/// </summary>
internal static string MsgUnpacking {
get {
@@ -664,7 +664,7 @@ namespace v2rayN.Resx {
}
/// <summary>
/// 查找类似 Update subscription end 的本地化字符串。
/// Looks up a localized string similar to Update subscription end.
/// </summary>
internal static string MsgUpdateSubscriptionEnd {
get {
@@ -673,7 +673,7 @@ namespace v2rayN.Resx {
}
/// <summary>
/// 查找类似 Update subscription starts 的本地化字符串。
/// Looks up a localized string similar to Update subscription starts.
/// </summary>
internal static string MsgUpdateSubscriptionStart {
get {
@@ -682,7 +682,7 @@ namespace v2rayN.Resx {
}
/// <summary>
/// 查找类似 Update Core successfully 的本地化字符串。
/// Looks up a localized string similar to Update Core successfully.
/// </summary>
internal static string MsgUpdateV2rayCoreSuccessfully {
get {
@@ -691,7 +691,7 @@ namespace v2rayN.Resx {
}
/// <summary>
/// 查找类似 Update Core successfully! Restarting service... 的本地化字符串。
/// Looks up a localized string similar to Update Core successfully! Restarting service....
/// </summary>
internal static string MsgUpdateV2rayCoreSuccessfullyMore {
get {
@@ -700,7 +700,7 @@ namespace v2rayN.Resx {
}
/// <summary>
/// 查找类似 This feature relies on the Http global proxy, please set it correctly first. 的本地化字符串。
/// Looks up a localized string similar to This feature relies on the Http global proxy, please set it correctly first..
/// </summary>
internal static string NeedHttpGlobalProxy {
get {
@@ -709,7 +709,7 @@ namespace v2rayN.Resx {
}
/// <summary>
/// 查找类似 Non-vmess or ss protocol 的本地化字符串。
/// Looks up a localized string similar to Non-vmess or ss protocol.
/// </summary>
internal static string NonvmessOrssProtocol {
get {
@@ -718,7 +718,7 @@ namespace v2rayN.Resx {
}
/// <summary>
/// 查找类似 non-Vmess service, this feature is invalid 的本地化字符串。
/// Looks up a localized string similar to non-Vmess service, this feature is invalid.
/// </summary>
internal static string NonVmessService {
get {
@@ -727,7 +727,7 @@ namespace v2rayN.Resx {
}
/// <summary>
/// 查找类似 Core not found, please download: {0} 的本地化字符串。
/// Looks up a localized string similar to Core not found, please download: {0}.
/// </summary>
internal static string NotFoundCore {
get {
@@ -736,7 +736,7 @@ namespace v2rayN.Resx {
}
/// <summary>
/// 查找类似 Scan completed, no valid QR code found 的本地化字符串。
/// Looks up a localized string similar to Scan completed, no valid QR code found.
/// </summary>
internal static string NoValidQRcodeFound {
get {
@@ -745,7 +745,7 @@ namespace v2rayN.Resx {
}
/// <summary>
/// 查找类似 operation failed, please check retry 的本地化字符串。
/// Looks up a localized string similar to operation failed, please check and retry.
/// </summary>
internal static string OperationFailed {
get {
@@ -754,7 +754,7 @@ namespace v2rayN.Resx {
}
/// <summary>
/// 查找类似 Operation success 的本地化字符串。
/// Looks up a localized string similar to Operation success.
/// </summary>
internal static string OperationSuccess {
get {
@@ -763,7 +763,7 @@ namespace v2rayN.Resx {
}
/// <summary>
/// 查找类似 Please Fill Remarks 的本地化字符串。
/// Looks up a localized string similar to Please Fill Remarks.
/// </summary>
internal static string PleaseFillRemarks {
get {
@@ -772,7 +772,7 @@ namespace v2rayN.Resx {
}
/// <summary>
/// 查找类似 Please select the encryption method 的本地化字符串。
/// Looks up a localized string similar to Please select the encryption method.
/// </summary>
internal static string PleaseSelectEncryption {
get {
@@ -781,7 +781,7 @@ namespace v2rayN.Resx {
}
/// <summary>
/// 查找类似 Please select an agreement 的本地化字符串。
/// Looks up a localized string similar to Please select a protocol.
/// </summary>
internal static string PleaseSelectProtocol {
get {
@@ -790,7 +790,7 @@ namespace v2rayN.Resx {
}
/// <summary>
/// 查找类似 Please select rules 的本地化字符串。
/// Looks up a localized string similar to Please select rules.
/// </summary>
internal static string PleaseSelectRules {
get {
@@ -799,7 +799,7 @@ namespace v2rayN.Resx {
}
/// <summary>
/// 查找类似 Please select the server first 的本地化字符串。
/// Looks up a localized string similar to Please select the server first.
/// </summary>
internal static string PleaseSelectServer {
get {
@@ -808,7 +808,7 @@ namespace v2rayN.Resx {
}
/// <summary>
/// 查找类似 QuickFresh 的本地化字符串。
/// Looks up a localized string similar to Fast.
/// </summary>
internal static string QuickFresh {
get {
@@ -817,7 +817,7 @@ namespace v2rayN.Resx {
}
/// <summary>
/// 查找类似 Global hotkey {0} registered failed, reason {1} 的本地化字符串。
/// Looks up a localized string similar to Global hotkey {0} registered failed, reason {1}.
/// </summary>
internal static string RegisterGlobalHotkeyFailed {
get {
@@ -826,7 +826,7 @@ namespace v2rayN.Resx {
}
/// <summary>
/// 查找类似 Global hotkey {0} registered successfully 的本地化字符串。
/// Looks up a localized string similar to Global hotkey {0} registered successfully.
/// </summary>
internal static string RegisterGlobalHotkeySuccessfully {
get {
@@ -835,7 +835,7 @@ namespace v2rayN.Resx {
}
/// <summary>
/// 查找类似 Servers deduplication completed. Old: {0}, New: {1}. 的本地化字符串。
/// Looks up a localized string similar to Servers deduplication completed. Old: {0}, New: {1}..
/// </summary>
internal static string RemoveDuplicateServerResult {
get {
@@ -844,7 +844,7 @@ namespace v2rayN.Resx {
}
/// <summary>
/// 查找类似 Are you sure to remove the rules? 的本地化字符串。
/// Looks up a localized string similar to Are you sure to remove the rules?.
/// </summary>
internal static string RemoveRules {
get {
@@ -853,7 +853,7 @@ namespace v2rayN.Resx {
}
/// <summary>
/// 查找类似 Are you sure to remove the server? 的本地化字符串。
/// Looks up a localized string similar to Are you sure to remove the server?.
/// </summary>
internal static string RemoveServer {
get {
@@ -862,7 +862,7 @@ namespace v2rayN.Resx {
}
/// <summary>
/// 查找类似 {0},One of the required. 的本地化字符串。
/// Looks up a localized string similar to {0},One of the required..
/// </summary>
internal static string RoutingRuleDetailRequiredTips {
get {
@@ -871,7 +871,7 @@ namespace v2rayN.Resx {
}
/// <summary>
/// 查找类似 The client configuration file is saved at: {0} 的本地化字符串。
/// Looks up a localized string similar to The client configuration file is saved at: {0}.
/// </summary>
internal static string SaveClientConfigurationIn {
get {
@@ -880,7 +880,7 @@ namespace v2rayN.Resx {
}
/// <summary>
/// 查找类似 The server configuration file is saved at: {0} 的本地化字符串。
/// Looks up a localized string similar to The server configuration file is saved at: {0}.
/// </summary>
internal static string SaveServerConfigurationIn {
get {
@@ -889,7 +889,7 @@ namespace v2rayN.Resx {
}
/// <summary>
/// 查找类似 SlowFresh 的本地化字符串。
/// Looks up a localized string similar to Slow.
/// </summary>
internal static string SlowFresh {
get {
@@ -898,7 +898,7 @@ namespace v2rayN.Resx {
}
/// <summary>
/// 查找类似 Note: After this function relies on the Http global proxy test, please manually adjust the Http global proxy and active node! 的本地化字符串。
/// Looks up a localized string similar to Note: This feature relies on the Http global proxy. Please manually adjust the Http global proxy and active node after testing..
/// </summary>
internal static string SpeedServerTips {
get {
@@ -907,7 +907,7 @@ namespace v2rayN.Resx {
}
/// <summary>
/// 查找类似 Speed Test... 的本地化字符串。
/// Looks up a localized string similar to Speed Test....
/// </summary>
internal static string Speedtesting {
get {
@@ -916,7 +916,7 @@ namespace v2rayN.Resx {
}
/// <summary>
/// 查找类似 PAC failed to start. Run it with Admin right. 的本地化字符串。
/// Looks up a localized string similar to PAC failed to start. Please run this program as Administrator..
/// </summary>
internal static string StartPacFailed {
get {
@@ -925,7 +925,7 @@ namespace v2rayN.Resx {
}
/// <summary>
/// 查找类似 Start service ({0})... 的本地化字符串。
/// Looks up a localized string similar to Start service ({0})....
/// </summary>
internal static string StartService {
get {
@@ -934,8 +934,8 @@ namespace v2rayN.Resx {
}
/// <summary>
/// 查找类似 Successful configuration
///{0} 的本地化字符串。
/// Looks up a localized string similar to Configuration successful
///{0}.
/// </summary>
internal static string SuccessfulConfiguration {
get {
@@ -944,7 +944,7 @@ namespace v2rayN.Resx {
}
/// <summary>
/// 查找类似 Successfully imported custom configuration server 的本地化字符串。
/// Looks up a localized string similar to Custom configuration server imported successfully..
/// </summary>
internal static string SuccessfullyImportedCustomServer {
get {
@@ -953,7 +953,7 @@ namespace v2rayN.Resx {
}
/// <summary>
/// 查找类似 {0} servers have been imported from clipboard. 的本地化字符串。
/// Looks up a localized string similar to {0} servers have been imported from clipboard..
/// </summary>
internal static string SuccessfullyImportedServerViaClipboard {
get {
@@ -962,7 +962,7 @@ namespace v2rayN.Resx {
}
/// <summary>
/// 查找类似 Scan import URL successfully 的本地化字符串。
/// Looks up a localized string similar to Scan import URL successfully.
/// </summary>
internal static string SuccessfullyImportedServerViaScan {
get {
@@ -971,7 +971,7 @@ namespace v2rayN.Resx {
}
/// <summary>
/// 查找类似 System proxy 的本地化字符串。
/// Looks up a localized string similar to System proxy.
/// </summary>
internal static string SystemProxy {
get {
@@ -980,7 +980,7 @@ namespace v2rayN.Resx {
}
/// <summary>
/// 查找类似 The ping of current service: {0} ms 的本地化字符串。
/// Looks up a localized string similar to The ping of current service: {0} ms.
/// </summary>
internal static string TestMeOutput {
get {
@@ -989,7 +989,7 @@ namespace v2rayN.Resx {
}
/// <summary>
/// 查找类似 Too many servers, please open the main interface 的本地化字符串。
/// Looks up a localized string similar to Too many servers, please open the main interface.
/// </summary>
internal static string TooManyServersTip {
get {
@@ -998,7 +998,7 @@ namespace v2rayN.Resx {
}
/// <summary>
/// 查找类似 *tcp camouflage type 的本地化字符串。
/// Looks up a localized string similar to *tcp camouflage type.
/// </summary>
internal static string TransportHeaderTypeTip1 {
get {
@@ -1007,7 +1007,7 @@ namespace v2rayN.Resx {
}
/// <summary>
/// 查找类似 *kcp camouflage type 的本地化字符串。
/// Looks up a localized string similar to *kcp camouflage type.
/// </summary>
internal static string TransportHeaderTypeTip2 {
get {
@@ -1016,7 +1016,7 @@ namespace v2rayN.Resx {
}
/// <summary>
/// 查找类似 *QUIC camouflage type 的本地化字符串。
/// Looks up a localized string similar to *QUIC camouflage type.
/// </summary>
internal static string TransportHeaderTypeTip3 {
get {
@@ -1025,7 +1025,7 @@ namespace v2rayN.Resx {
}
/// <summary>
/// 查找类似 *grpc mode 的本地化字符串。
/// Looks up a localized string similar to *grpc mode.
/// </summary>
internal static string TransportHeaderTypeTip4 {
get {
@@ -1034,7 +1034,7 @@ namespace v2rayN.Resx {
}
/// <summary>
/// 查找类似 *ws path 的本地化字符串。
/// Looks up a localized string similar to *ws path.
/// </summary>
internal static string TransportPathTip1 {
get {
@@ -1043,7 +1043,7 @@ namespace v2rayN.Resx {
}
/// <summary>
/// 查找类似 *h2 path 的本地化字符串。
/// Looks up a localized string similar to *h2 path.
/// </summary>
internal static string TransportPathTip2 {
get {
@@ -1052,7 +1052,7 @@ namespace v2rayN.Resx {
}
/// <summary>
/// 查找类似 *QUIC key/Kcp seed 的本地化字符串。
/// Looks up a localized string similar to *QUIC key/Kcp seed.
/// </summary>
internal static string TransportPathTip3 {
get {
@@ -1061,7 +1061,7 @@ namespace v2rayN.Resx {
}
/// <summary>
/// 查找类似 *grpc serviceName 的本地化字符串。
/// Looks up a localized string similar to *grpc serviceName.
/// </summary>
internal static string TransportPathTip4 {
get {
@@ -1070,7 +1070,7 @@ namespace v2rayN.Resx {
}
/// <summary>
/// 查找类似 *Kcp seed 的本地化字符串。
/// Looks up a localized string similar to *Kcp seed.
/// </summary>
internal static string TransportPathTip5 {
get {
@@ -1079,7 +1079,7 @@ namespace v2rayN.Resx {
}
/// <summary>
/// 查找类似 *http host Separated by commas (,) 的本地化字符串。
/// Looks up a localized string similar to *http host Separated by commas (,).
/// </summary>
internal static string TransportRequestHostTip1 {
get {
@@ -1088,7 +1088,7 @@ namespace v2rayN.Resx {
}
/// <summary>
/// 查找类似 *ws host 的本地化字符串。
/// Looks up a localized string similar to *ws host.
/// </summary>
internal static string TransportRequestHostTip2 {
get {
@@ -1097,7 +1097,7 @@ namespace v2rayN.Resx {
}
/// <summary>
/// 查找类似 *h2 host Separated by commas (,) 的本地化字符串。
/// Looks up a localized string similar to *h2 host Separated by commas (,).
/// </summary>
internal static string TransportRequestHostTip3 {
get {
@@ -1106,7 +1106,7 @@ namespace v2rayN.Resx {
}
/// <summary>
/// 查找类似 *QUIC securty 的本地化字符串。
/// Looks up a localized string similar to *QUIC securty.
/// </summary>
internal static string TransportRequestHostTip4 {
get {
@@ -1115,7 +1115,7 @@ namespace v2rayN.Resx {
}
/// <summary>
/// 查找类似 Ungrouped 的本地化字符串。
/// Looks up a localized string similar to Ungrouped.
/// </summary>
internal static string UngroupedServers {
get {

View File

@@ -127,7 +127,7 @@
<value>Please check the server settings first</value>
</data>
<data name="ConfigurationFormatIncorrect" xml:space="preserve">
<value> configuration format is incorrect</value>
<value>Invalid configuration format</value>
</data>
<data name="CustomServerTips" xml:space="preserve">
<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>
@@ -136,7 +136,7 @@
<value>Downloading...</value>
</data>
<data name="downloadSpeed" xml:space="preserve">
<value>DOWN</value>
<value>Download</value>
</data>
<data name="DownloadYesNo" xml:space="preserve">
<value>Whether to download? {0}</value>
@@ -214,10 +214,10 @@
<value>Test Results</value>
</data>
<data name="LvTodayDownloadDataAmount" xml:space="preserve">
<value>Today download traffic</value>
<value>Download traffic today</value>
</data>
<data name="LvTodayUploadDataAmount" xml:space="preserve">
<value>Today upload traffic</value>
<value>Upload traffic today</value>
</data>
<data name="LvTotalDownloadDataAmount" xml:space="preserve">
<value>Total download traffic</value>
@@ -229,7 +229,7 @@
<value>Transport</value>
</data>
<data name="MediumFresh" xml:space="preserve">
<value>MediumFresh</value>
<value>Medium</value>
</data>
<data name="MsgClearSubscription" xml:space="preserve">
<value>Clear original subscription content</value>
@@ -241,7 +241,7 @@
<value>Failed to import subscription content</value>
</data>
<data name="MsgGetSubscriptionSuccessfully" xml:space="preserve">
<value>Get the subscription content successfully</value>
<value>Get subscription content successfully</value>
</data>
<data name="MsgNoValidSubscription" xml:space="preserve">
<value>No valid subscriptions set</value>
@@ -301,7 +301,7 @@
<value>Scan completed, no valid QR code found</value>
</data>
<data name="OperationFailed" xml:space="preserve">
<value> operation failed, please check retry</value>
<value> operation failed, please check and retry</value>
</data>
<data name="PleaseFillRemarks" xml:space="preserve">
<value>Please Fill Remarks</value>
@@ -310,13 +310,13 @@
<value>Please select the encryption method</value>
</data>
<data name="PleaseSelectProtocol" xml:space="preserve">
<value>Please select an agreement</value>
<value>Please select a protocol</value>
</data>
<data name="PleaseSelectServer" xml:space="preserve">
<value>Please select the server first</value>
</data>
<data name="QuickFresh" xml:space="preserve">
<value>QuickFresh</value>
<value>Fast</value>
</data>
<data name="RemoveDuplicateServerResult" xml:space="preserve">
<value>Servers deduplication completed. Old: {0}, New: {1}.</value>
@@ -331,23 +331,23 @@
<value>The server configuration file is saved at: {0}</value>
</data>
<data name="SlowFresh" xml:space="preserve">
<value>SlowFresh</value>
<value>Slow</value>
</data>
<data name="SpeedServerTips" xml:space="preserve">
<value>Note: After this function relies on the Http global proxy test, please manually adjust the Http global proxy and active node!</value>
<value>Note: This feature relies on the Http global proxy. Please manually adjust the Http global proxy and active node after testing.</value>
</data>
<data name="StartPacFailed" xml:space="preserve">
<value>PAC failed to start. Run it with Admin right.</value>
<value>PAC failed to start. Please run this program as Administrator.</value>
</data>
<data name="StartService" xml:space="preserve">
<value>Start service ({0})...</value>
</data>
<data name="SuccessfulConfiguration" xml:space="preserve">
<value>Successful configuration
<value>Configuration successful
{0}</value>
</data>
<data name="SuccessfullyImportedCustomServer" xml:space="preserve">
<value>Successfully imported custom configuration server</value>
<value>Custom configuration server imported successfully.</value>
</data>
<data name="SuccessfullyImportedServerViaClipboard" xml:space="preserve">
<value>{0} servers have been imported from clipboard.</value>
@@ -389,7 +389,7 @@
<value>Download GeoFile: {0} successfully</value>
</data>
<data name="MsgInformationTitle" xml:space="preserve">
<value>Informations (Filter : {0})</value>
<value>Information (Filter : {0})</value>
</data>
<data name="LvCustomIcon" xml:space="preserve">
<value>Custom Icon</value>

View File

@@ -13,23 +13,27 @@ namespace v2rayN.Tool
{
public static void Setup()
{
Hierarchy hierarchy = (Hierarchy)LogManager.GetRepository();
var hierarchy = (Hierarchy)LogManager.GetRepository();
PatternLayout patternLayout = new PatternLayout();
patternLayout.ConversionPattern = "%date [%thread] %-5level %logger - %message%newline";
var patternLayout = new PatternLayout
{
ConversionPattern = "%date [%thread] %-5level %logger - %message%newline"
};
patternLayout.ActivateOptions();
RollingFileAppender roller = new RollingFileAppender();
roller.AppendToFile = true;
roller.RollingStyle = RollingFileAppender.RollingMode.Date;
roller.DatePattern = "yyyy-MM-dd'.txt'";
roller.File = Utils.GetPath(@"guiLogs\");
roller.Layout = patternLayout;
roller.StaticLogFileName = false;
var roller = new RollingFileAppender
{
AppendToFile = true,
RollingStyle = RollingFileAppender.RollingMode.Date,
DatePattern = "yyyy-MM-dd'.txt'",
File = Utils.GetPath(@"guiLogs\"),
Layout = patternLayout,
StaticLogFileName = false
};
roller.ActivateOptions();
hierarchy.Root.AddAppender(roller);
MemoryAppender memory = new MemoryAppender();
var memory = new MemoryAppender();
memory.ActivateOptions();
hierarchy.Root.AddAppender(memory);

View File

@@ -951,7 +951,7 @@ namespace v2rayN
public static string GetDownloadFileName(string url)
{
var fileName = System.IO.Path.GetFileName(url);
var fileName = Path.GetFileName(url);
fileName += "_temp";
return fileName;

View File

@@ -307,6 +307,7 @@
</EmbeddedResource>
<EmbeddedResource Include="Forms\OptionSettingForm.zh-Hans.resx">
<DependentUpon>OptionSettingForm.cs</DependentUpon>
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="Forms\QRCodeControl.zh-Hans.resx">
<DependentUpon>QRCodeControl.cs</DependentUpon>