Compare commits

...

19 Commits
5.11 ... 5.14

Author SHA1 Message Date
2dust
73c79ca7bf Update AssemblyInfo.cs 2022-04-12 16:58:31 +08:00
2dust
978975ee2d update package 2022-04-12 16:58:09 +08:00
2dust
d7dc0dff50 Adjusting the tray server display 2022-04-12 14:49:57 +08:00
2dust
a3aa6c045f Improve speed test 2022-04-12 13:38:42 +08:00
2dust
785ebc49fc fix clash port 2022-04-12 13:38:10 +08:00
2dust
fde1c98ddd add group sort 2022-04-12 13:37:41 +08:00
2dust
024040163a Update AssemblyInfo.cs 2022-04-11 19:16:52 +08:00
2dust
e95b5e04c0 remove expired tls 2022-04-11 19:16:35 +08:00
2dust
815826c856 Refactor download/update/speedtest 2022-04-11 15:26:32 +08:00
2dust
1c5cc190c5 modify res 2022-04-11 15:24:59 +08:00
2dust
50b109ca71 Auto update subscription 2022-04-11 15:24:24 +08:00
2dust
3aa48a9a3e Update AssemblyInfo.cs 2022-04-07 20:36:10 +08:00
2dust
09702b9bde fix bugs 2022-04-07 17:05:56 +08:00
2dust
35f6cd3d9c Merge pull request #2164 from Lemonawa/master
Update issue templates
2022-04-06 19:49:52 +08:00
Lemonawa
b62f1786a9 Update issue templates 2022-04-05 23:19:37 +08:00
Lemonawa
b21ad28d5b Delete config.yaml 2022-04-05 23:10:16 +08:00
Lemonawa
8d66c0d180 Delete issue_template.md 2022-04-05 23:10:08 +08:00
Lemonawa
ec8aa0df18 Update issue templates 2022-04-05 23:09:30 +08:00
Lemonawa
e824d8e91d Create config.yaml 2022-04-05 23:06:42 +08:00
32 changed files with 2515 additions and 2958 deletions

View File

@@ -1,3 +1,12 @@
---
name: Bug 报告
about: 在提出问题前请先自行排除服务器端问题和升级到最新客户端,同时也请通过搜索确认是否有人提出过相同问题。
title: "[BUG]"
labels: bug
assignees: ''
---
在提出问题前请先自行排除服务器端问题和升级到最新客户端,同时也请通过搜索确认是否有人提出过相同问题。 在提出问题前请先自行排除服务器端问题和升级到最新客户端,同时也请通过搜索确认是否有人提出过相同问题。
### 预期行为 ### 预期行为
@@ -22,4 +31,3 @@
### 环境信息(客户端请升级至最新正式版) ### 环境信息(客户端请升级至最新正式版)
### 额外信息(可选) ### 额外信息(可选)

20
.github/ISSUE_TEMPLATE/feature---.md vendored Normal file
View File

@@ -0,0 +1,20 @@
---
name: Feature 请求
about: 为这个项目提出一个建议
title: "[Feature request]"
labels: enhancement
assignees: ''
---
**你的功能请求是否与一个问题有关?请描述。**
清楚而简洁地描述问题是什么。例如。我总是感到沮丧,当 [...]
**描述你希望的解决方案**
对你希望发生的事情进行清晰、简明的描述。
**描述你所考虑的替代方案**
对你考虑过的任何替代解决方案或功能进行清晰、简洁的描述。
**Additional context**
Add any other context or screenshots about the feature request here.

View File

@@ -0,0 +1,235 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Threading;
using System.Threading.Tasks;
namespace v2rayN.Base
{
/// <summary>
/// </summary>
public class HttpClientHelper
{
private static HttpClientHelper httpClientHelper = null;
private HttpClient httpClient;
/// <summary>
/// </summary>
private HttpClientHelper() { }
/// <summary>
/// </summary>
/// <returns></returns>
public static HttpClientHelper GetInstance()
{
if (httpClientHelper != null)
{
return httpClientHelper;
}
else
{
HttpClientHelper httpClientHelper = new HttpClientHelper();
HttpClientHandler handler = new HttpClientHandler() { UseCookies = false };
httpClientHelper.httpClient = new HttpClient(handler);
return httpClientHelper;
}
}
public async Task<string> GetAsync(string url)
{
if (string.IsNullOrEmpty(url))
{
return null;
}
try
{
HttpResponseMessage response = await httpClient.GetAsync(url);
return await response.Content.ReadAsStringAsync();
}
catch
{
}
return null;
}
public async Task<string> GetAsync(HttpClient client, string url)
{
if (string.IsNullOrEmpty(url))
{
return null;
}
try
{
var cts = new CancellationTokenSource();
cts.CancelAfter(5000);
HttpResponseMessage response = await client.GetAsync(url, cts.Token);
return await response.Content.ReadAsStringAsync();
}
catch (Exception ex)
{
Utils.SaveLog("GetAsync", ex);
}
return null;
}
public async Task PutAsync(string url, Dictionary<string, string> headers)
{
var myContent = Utils.ToJson(headers);
var buffer = System.Text.Encoding.UTF8.GetBytes(myContent);
var byteContent = new ByteArrayContent(buffer);
byteContent.Headers.ContentType = new MediaTypeHeaderValue("application/json");
var result = await httpClient.PutAsync(url, byteContent);
}
public async Task DownloadFileAsync(HttpClient client, string url, string fileName, IProgress<double> progress, CancellationToken token)
{
if (string.IsNullOrEmpty(url))
{
throw new ArgumentNullException("url");
}
if (string.IsNullOrEmpty(fileName))
{
throw new ArgumentNullException("fileName");
}
if (File.Exists(fileName))
{
File.Delete(fileName);
}
var response = await client.GetAsync(url, HttpCompletionOption.ResponseHeadersRead, token);
if (!response.IsSuccessStatusCode)
{
throw new Exception(string.Format("The request returned with HTTP status code {0}", response.StatusCode));
}
var total = response.Content.Headers.ContentLength.HasValue ? response.Content.Headers.ContentLength.Value : -1L;
var canReportProgress = total != -1 && progress != null;
using (var stream = await response.Content.ReadAsStreamAsync())
{
using (var file = File.Create(fileName))
{
var totalRead = 0L;
var buffer = new byte[1024 * 1024];
var isMoreToRead = true;
var progressPercentage = 0;
do
{
token.ThrowIfCancellationRequested();
var read = await stream.ReadAsync(buffer, 0, buffer.Length, token);
if (read == 0)
{
isMoreToRead = false;
}
else
{
var data = new byte[read];
buffer.ToList().CopyTo(0, data, 0, read);
// TODO: put here the code to write the file to disk
file.Write(data, 0, read);
totalRead += read;
if (canReportProgress)
{
var percent = Convert.ToInt32((totalRead * 1d) / (total * 1d) * 100);
if (progressPercentage != percent && percent % 10 == 0)
{
progressPercentage = percent;
progress.Report(percent);
}
}
}
} while (isMoreToRead);
file.Close();
if (canReportProgress)
{
progress.Report(101);
}
}
}
}
public async Task DownloadDataAsync4Speed(HttpClient client, string url, IProgress<double> progress, CancellationToken token)
{
if (string.IsNullOrEmpty(url))
{
throw new ArgumentNullException("url");
}
var response = await client.GetAsync(url, HttpCompletionOption.ResponseHeadersRead, token);
if (!response.IsSuccessStatusCode)
{
throw new Exception(string.Format("The request returned with HTTP status code {0}", response.StatusCode));
}
var total = response.Content.Headers.ContentLength.HasValue ? response.Content.Headers.ContentLength.Value : -1L;
var canReportProgress = total != -1 && progress != null;
using (var stream = await response.Content.ReadAsStreamAsync())
{
var totalRead = 0L;
var buffer = new byte[1024 * 64];
var isMoreToRead = true;
var progressPercentage = 0;
DateTime totalDatetime = DateTime.Now;
do
{
if (token.IsCancellationRequested)
{
if (totalRead > 0)
{
return;
}
else
{
token.ThrowIfCancellationRequested();
}
}
var read = await stream.ReadAsync(buffer, 0, buffer.Length, token);
if (read == 0)
{
isMoreToRead = false;
}
else
{
var data = new byte[read];
buffer.ToList().CopyTo(0, data, 0, read);
// TODO:
totalRead += read;
if (canReportProgress)
{
TimeSpan ts = (DateTime.Now - totalDatetime);
var speed = totalRead * 1d / ts.TotalMilliseconds / 1000;
var percent = Convert.ToInt32((totalRead * 1d) / (total * 1d) * 100);
if (progressPercentage != percent)
{
progressPercentage = percent;
progress.Report(speed);
}
}
}
} while (isMoreToRead);
}
}
}
}

View File

@@ -1,37 +0,0 @@
using System;
using System.Net;
namespace v2rayN.Base
{
class WebClientEx : WebClient
{
public int Timeout
{
get; set;
}
public WebClientEx(int timeout = 3000)
{
Timeout = timeout;
}
protected override WebRequest GetWebRequest(Uri address)
{
HttpWebRequest request;
request = (HttpWebRequest)base.GetWebRequest(address);
request.Timeout = Timeout;
request.ReadWriteTimeout = Timeout;
//request.AllowAutoRedirect = false;
//request.AllowWriteStreamBuffering = true;
request.ServicePoint.BindIPEndPointDelegate = (servicePoint, remoteEndPoint, retryCount) =>
{
if (remoteEndPoint.AddressFamily == System.Net.Sockets.AddressFamily.InterNetworkV6)
return new IPEndPoint(IPAddress.IPv6Any, 0);
else
return new IPEndPoint(IPAddress.Any, 0);
};
return request;
}
}
}

View File

@@ -33,15 +33,20 @@
this.btnRemove = new System.Windows.Forms.Button(); this.btnRemove = new System.Windows.Forms.Button();
this.txtRemarks = new System.Windows.Forms.TextBox(); this.txtRemarks = new System.Windows.Forms.TextBox();
this.label2 = new System.Windows.Forms.Label(); this.label2 = new System.Windows.Forms.Label();
this.numSort = new System.Windows.Forms.NumericUpDown();
this.label1 = new System.Windows.Forms.Label();
this.grbMain.SuspendLayout(); this.grbMain.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.numSort)).BeginInit();
this.SuspendLayout(); this.SuspendLayout();
// //
// grbMain // grbMain
// //
resources.ApplyResources(this.grbMain, "grbMain"); this.grbMain.Controls.Add(this.label1);
this.grbMain.Controls.Add(this.numSort);
this.grbMain.Controls.Add(this.btnRemove); this.grbMain.Controls.Add(this.btnRemove);
this.grbMain.Controls.Add(this.txtRemarks); this.grbMain.Controls.Add(this.txtRemarks);
this.grbMain.Controls.Add(this.label2); this.grbMain.Controls.Add(this.label2);
resources.ApplyResources(this.grbMain, "grbMain");
this.grbMain.Name = "grbMain"; this.grbMain.Name = "grbMain";
this.grbMain.TabStop = false; this.grbMain.TabStop = false;
// //
@@ -63,6 +68,17 @@
resources.ApplyResources(this.label2, "label2"); resources.ApplyResources(this.label2, "label2");
this.label2.Name = "label2"; this.label2.Name = "label2";
// //
// numSort
//
resources.ApplyResources(this.numSort, "numSort");
this.numSort.Name = "numSort";
this.numSort.Leave += new System.EventHandler(this.txtRemarks_Leave);
//
// label1
//
resources.ApplyResources(this.label1, "label1");
this.label1.Name = "label1";
//
// GroupSettingControl // GroupSettingControl
// //
resources.ApplyResources(this, "$this"); resources.ApplyResources(this, "$this");
@@ -72,6 +88,7 @@
this.Load += new System.EventHandler(this.GroupSettingControl_Load); this.Load += new System.EventHandler(this.GroupSettingControl_Load);
this.grbMain.ResumeLayout(false); this.grbMain.ResumeLayout(false);
this.grbMain.PerformLayout(); this.grbMain.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.numSort)).EndInit();
this.ResumeLayout(false); this.ResumeLayout(false);
} }
@@ -82,5 +99,7 @@
private System.Windows.Forms.TextBox txtRemarks; private System.Windows.Forms.TextBox txtRemarks;
private System.Windows.Forms.Label label2; private System.Windows.Forms.Label label2;
private System.Windows.Forms.Button btnRemove; private System.Windows.Forms.Button btnRemove;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.NumericUpDown numSort;
} }
} }

View File

@@ -32,6 +32,7 @@ namespace v2rayN.Forms
if (groupItem != null) if (groupItem != null)
{ {
txtRemarks.Text = groupItem.remarks.ToString(); txtRemarks.Text = groupItem.remarks.ToString();
numSort.Value = groupItem.sort;
} }
} }
private void EndBindingSub() private void EndBindingSub()
@@ -39,6 +40,7 @@ namespace v2rayN.Forms
if (groupItem != null) if (groupItem != null)
{ {
groupItem.remarks = txtRemarks.Text.TrimEx(); groupItem.remarks = txtRemarks.Text.TrimEx();
groupItem.sort = Convert.ToInt32(numSort.Value);
} }
} }
private void txtRemarks_Leave(object sender, EventArgs e) private void txtRemarks_Leave(object sender, EventArgs e)

View File

@@ -118,126 +118,177 @@
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader> </resheader>
<assembly alias="mscorlib" name="mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" /> <assembly alias="mscorlib" name="mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="grbMain.TabIndex" type="System.Int32, mscorlib"> <data name="label1.AutoSize" type="System.Boolean, mscorlib">
<value>10</value> <value>True</value>
</data>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="label1.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
<value>NoControl</value>
</data> </data>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /> <assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="$this.AutoScaleDimensions" type="System.Drawing.SizeF, System.Drawing"> <data name="label1.Location" type="System.Drawing.Point, System.Drawing">
<value>6, 12</value> <value>12, 61</value>
</data> </data>
<data name="&gt;&gt;grbMain.ZOrder" xml:space="preserve"> <data name="label1.Size" type="System.Drawing.Size, System.Drawing">
<value>71, 12</value>
</data>
<data name="label1.TabIndex" type="System.Int32, mscorlib">
<value>26</value>
</data>
<data name="label1.Text" xml:space="preserve">
<value>Sort number</value>
</data>
<data name="&gt;&gt;label1.Name" xml:space="preserve">
<value>label1</value>
</data>
<data name="&gt;&gt;label1.Type" xml:space="preserve">
<value>System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;label1.Parent" xml:space="preserve">
<value>grbMain</value>
</data>
<data name="&gt;&gt;label1.ZOrder" xml:space="preserve">
<value>0</value> <value>0</value>
</data> </data>
<data name="txtRemarks.Size" type="System.Drawing.Size, System.Drawing"> <data name="numSort.Location" type="System.Drawing.Point, System.Drawing">
<value>292, 21</value> <value>127, 57</value>
</data>
<data name="numSort.Size" type="System.Drawing.Size, System.Drawing">
<value>120, 21</value>
</data>
<data name="numSort.TabIndex" type="System.Int32, mscorlib">
<value>25</value>
</data>
<data name="&gt;&gt;numSort.Name" xml:space="preserve">
<value>numSort</value>
</data>
<data name="&gt;&gt;numSort.Type" xml:space="preserve">
<value>System.Windows.Forms.NumericUpDown, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;numSort.Parent" xml:space="preserve">
<value>grbMain</value>
</data>
<data name="&gt;&gt;numSort.ZOrder" xml:space="preserve">
<value>1</value>
</data>
<data name="btnRemove.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
<value>NoControl</value>
</data> </data>
<data name="btnRemove.Location" type="System.Drawing.Point, System.Drawing"> <data name="btnRemove.Location" type="System.Drawing.Point, System.Drawing">
<value>525, 21</value> <value>525, 21</value>
</data> </data>
<data name="txtRemarks.Location" type="System.Drawing.Point, System.Drawing"> <data name="btnRemove.Size" type="System.Drawing.Size, System.Drawing">
<value>127, 21</value> <value>75, 23</value>
</data>
<data name="&gt;&gt;btnRemove.Parent" xml:space="preserve">
<value>grbMain</value>
</data>
<data name="label2.Location" type="System.Drawing.Point, System.Drawing">
<value>12, 25</value>
</data> </data>
<data name="btnRemove.TabIndex" type="System.Int32, mscorlib"> <data name="btnRemove.TabIndex" type="System.Int32, mscorlib">
<value>24</value> <value>24</value>
</data> </data>
<data name="&gt;&gt;$this.Type" xml:space="preserve"> <data name="btnRemove.Text" xml:space="preserve">
<value>System.Windows.Forms.UserControl, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> <value>Remove</value>
</data> </data>
<data name="&gt;&gt;$this.Name" xml:space="preserve"> <data name="&gt;&gt;btnRemove.Name" xml:space="preserve">
<value>GroupSettingControl</value> <value>btnRemove</value>
</data>
<data name="&gt;&gt;label2.Parent" xml:space="preserve">
<value>grbMain</value>
</data> </data>
<data name="&gt;&gt;btnRemove.Type" xml:space="preserve"> <data name="&gt;&gt;btnRemove.Type" xml:space="preserve">
<value>System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> <value>System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data> </data>
<data name="&gt;&gt;grbMain.Name" xml:space="preserve"> <data name="&gt;&gt;btnRemove.Parent" xml:space="preserve">
<value>grbMain</value> <value>grbMain</value>
</data> </data>
<data name="&gt;&gt;label2.Type" xml:space="preserve"> <data name="&gt;&gt;btnRemove.ZOrder" xml:space="preserve">
<value>System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;label2.ZOrder" xml:space="preserve">
<value>2</value> <value>2</value>
</data> </data>
<data name="txtRemarks.Location" type="System.Drawing.Point, System.Drawing">
<value>127, 21</value>
</data>
<data name="txtRemarks.Size" type="System.Drawing.Size, System.Drawing">
<value>292, 21</value>
</data>
<data name="txtRemarks.TabIndex" type="System.Int32, mscorlib">
<value>1</value>
</data>
<data name="&gt;&gt;txtRemarks.Name" xml:space="preserve">
<value>txtRemarks</value>
</data>
<data name="&gt;&gt;txtRemarks.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;txtRemarks.Parent" xml:space="preserve">
<value>grbMain</value>
</data>
<data name="&gt;&gt;txtRemarks.ZOrder" xml:space="preserve">
<value>3</value>
</data>
<data name="label2.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="label2.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
<value>NoControl</value>
</data>
<data name="label2.Location" type="System.Drawing.Point, System.Drawing">
<value>12, 25</value>
</data>
<data name="label2.Size" type="System.Drawing.Size, System.Drawing">
<value>47, 12</value>
</data>
<data name="label2.TabIndex" type="System.Int32, mscorlib">
<value>10</value>
</data>
<data name="label2.Text" xml:space="preserve">
<value>Remarks</value>
</data>
<data name="&gt;&gt;label2.Name" xml:space="preserve"> <data name="&gt;&gt;label2.Name" xml:space="preserve">
<value>label2</value> <value>label2</value>
</data> </data>
<data name="btnRemove.Size" type="System.Drawing.Size, System.Drawing"> <data name="&gt;&gt;label2.Type" xml:space="preserve">
<value>75, 23</value> <value>System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;label2.Parent" xml:space="preserve">
<value>grbMain</value>
</data>
<data name="&gt;&gt;label2.ZOrder" xml:space="preserve">
<value>4</value>
</data>
<data name="grbMain.Dock" type="System.Windows.Forms.DockStyle, System.Windows.Forms">
<value>Fill</value>
</data> </data>
<data name="grbMain.Location" type="System.Drawing.Point, System.Drawing"> <data name="grbMain.Location" type="System.Drawing.Point, System.Drawing">
<value>0, 0</value> <value>0, 0</value>
</data> </data>
<data name="grbMain.Size" type="System.Drawing.Size, System.Drawing"> <data name="grbMain.Size" type="System.Drawing.Size, System.Drawing">
<value>619, 61</value> <value>619, 91</value>
</data> </data>
<data name="label2.Text" xml:space="preserve"> <data name="grbMain.TabIndex" type="System.Int32, mscorlib">
<value>Remarks</value> <value>10</value>
</data>
<data name="&gt;&gt;txtRemarks.Parent" xml:space="preserve">
<value>grbMain</value>
</data> </data>
<data name="grbMain.Text" xml:space="preserve"> <data name="grbMain.Text" xml:space="preserve">
<value>Group details</value> <value>Group details</value>
</data> </data>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" /> <data name="&gt;&gt;grbMain.Name" xml:space="preserve">
<data name="label2.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms"> <value>grbMain</value>
<value>NoControl</value>
</data>
<data name="txtRemarks.TabIndex" type="System.Int32, mscorlib">
<value>1</value>
</data>
<data name="&gt;&gt;txtRemarks.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="label2.Size" type="System.Drawing.Size, System.Drawing">
<value>47, 12</value>
</data>
<data name="&gt;&gt;txtRemarks.Name" xml:space="preserve">
<value>txtRemarks</value>
</data>
<data name="&gt;&gt;btnRemove.ZOrder" xml:space="preserve">
<value>0</value>
</data>
<data name="&gt;&gt;btnRemove.Name" xml:space="preserve">
<value>btnRemove</value>
</data>
<data name="grbMain.Dock" type="System.Windows.Forms.DockStyle, System.Windows.Forms">
<value>Fill</value>
</data>
<data name="label2.TabIndex" type="System.Int32, mscorlib">
<value>10</value>
</data>
<data name="label2.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="btnRemove.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
<value>NoControl</value>
</data> </data>
<data name="&gt;&gt;grbMain.Type" xml:space="preserve"> <data name="&gt;&gt;grbMain.Type" xml:space="preserve">
<value>System.Windows.Forms.GroupBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> <value>System.Windows.Forms.GroupBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data> </data>
<data name="&gt;&gt;txtRemarks.ZOrder" xml:space="preserve">
<value>1</value>
</data>
<data name="&gt;&gt;grbMain.Parent" xml:space="preserve"> <data name="&gt;&gt;grbMain.Parent" xml:space="preserve">
<value>$this</value> <value>$this</value>
</data> </data>
<data name="$this.Size" type="System.Drawing.Size, System.Drawing"> <data name="&gt;&gt;grbMain.ZOrder" xml:space="preserve">
<value>619, 61</value> <value>0</value>
</data>
<data name="btnRemove.Text" xml:space="preserve">
<value>Remove</value>
</data> </data>
<metadata name="$this.Localizable" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <metadata name="$this.Localizable" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value> <value>True</value>
</metadata> </metadata>
<data name="$this.AutoScaleDimensions" type="System.Drawing.SizeF, System.Drawing">
<value>6, 12</value>
</data>
<data name="$this.Size" type="System.Drawing.Size, System.Drawing">
<value>619, 91</value>
</data>
<data name="&gt;&gt;$this.Name" xml:space="preserve">
<value>GroupSettingControl</value>
</data>
<data name="&gt;&gt;$this.Type" xml:space="preserve">
<value>System.Windows.Forms.UserControl, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
</root> </root>

View File

@@ -130,4 +130,7 @@
<data name="grbMain.Text" xml:space="preserve"> <data name="grbMain.Text" xml:space="preserve">
<value>分组详情</value> <value>分组详情</value>
</data> </data>
<data name="label1.Text" xml:space="preserve">
<value>排序编号</value>
</data>
</root> </root>

View File

@@ -94,7 +94,6 @@
this.menuKeepNothing = new System.Windows.Forms.ToolStripMenuItem(); this.menuKeepNothing = new System.Windows.Forms.ToolStripMenuItem();
this.menuRoutings = new System.Windows.Forms.ToolStripMenuItem(); this.menuRoutings = new System.Windows.Forms.ToolStripMenuItem();
this.menuServers = new System.Windows.Forms.ToolStripMenuItem(); this.menuServers = new System.Windows.Forms.ToolStripMenuItem();
this.menuServers2 = new System.Windows.Forms.ToolStripComboBox();
this.toolStripSeparator13 = new System.Windows.Forms.ToolStripSeparator(); this.toolStripSeparator13 = new System.Windows.Forms.ToolStripSeparator();
this.menuAddServers2 = new System.Windows.Forms.ToolStripMenuItem(); this.menuAddServers2 = new System.Windows.Forms.ToolStripMenuItem();
this.menuScanScreen2 = new System.Windows.Forms.ToolStripMenuItem(); this.menuScanScreen2 = new System.Windows.Forms.ToolStripMenuItem();
@@ -126,8 +125,7 @@
this.tsbCheckUpdateCore = new System.Windows.Forms.ToolStripMenuItem(); this.tsbCheckUpdateCore = new System.Windows.Forms.ToolStripMenuItem();
this.tsbCheckUpdateXrayCore = new System.Windows.Forms.ToolStripMenuItem(); this.tsbCheckUpdateXrayCore = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator15 = new System.Windows.Forms.ToolStripSeparator(); this.toolStripSeparator15 = new System.Windows.Forms.ToolStripSeparator();
this.tsbCheckUpdateGeoSite = new System.Windows.Forms.ToolStripMenuItem(); this.tsbCheckUpdateGeo = new System.Windows.Forms.ToolStripMenuItem();
this.tsbCheckUpdateGeoIP = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator10 = new System.Windows.Forms.ToolStripSeparator(); this.toolStripSeparator10 = new System.Windows.Forms.ToolStripSeparator();
this.tsbHelp = new System.Windows.Forms.ToolStripDropDownButton(); this.tsbHelp = new System.Windows.Forms.ToolStripDropDownButton();
this.tsbAbout = new System.Windows.Forms.ToolStripMenuItem(); this.tsbAbout = new System.Windows.Forms.ToolStripMenuItem();
@@ -586,7 +584,6 @@
this.menuSysAgentMode, this.menuSysAgentMode,
this.menuRoutings, this.menuRoutings,
this.menuServers, this.menuServers,
this.menuServers2,
this.toolStripSeparator13, this.toolStripSeparator13,
this.menuAddServers2, this.menuAddServers2,
this.menuScanScreen2, this.menuScanScreen2,
@@ -636,14 +633,6 @@
this.menuServers.Name = "menuServers"; this.menuServers.Name = "menuServers";
resources.ApplyResources(this.menuServers, "menuServers"); resources.ApplyResources(this.menuServers, "menuServers");
// //
// menuServers2
//
this.menuServers2.BackColor = System.Drawing.SystemColors.Window;
this.menuServers2.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.menuServers2.DropDownWidth = 500;
resources.ApplyResources(this.menuServers2, "menuServers2");
this.menuServers2.Name = "menuServers2";
//
// toolStripSeparator13 // toolStripSeparator13
// //
this.toolStripSeparator13.Name = "toolStripSeparator13"; this.toolStripSeparator13.Name = "toolStripSeparator13";
@@ -831,8 +820,7 @@
this.tsbCheckUpdateCore, this.tsbCheckUpdateCore,
this.tsbCheckUpdateXrayCore, this.tsbCheckUpdateXrayCore,
this.toolStripSeparator15, this.toolStripSeparator15,
this.tsbCheckUpdateGeoSite, this.tsbCheckUpdateGeo});
this.tsbCheckUpdateGeoIP});
this.tsbCheckUpdate.Image = global::v2rayN.Properties.Resources.checkupdate; this.tsbCheckUpdate.Image = global::v2rayN.Properties.Resources.checkupdate;
resources.ApplyResources(this.tsbCheckUpdate, "tsbCheckUpdate"); resources.ApplyResources(this.tsbCheckUpdate, "tsbCheckUpdate");
this.tsbCheckUpdate.Name = "tsbCheckUpdate"; this.tsbCheckUpdate.Name = "tsbCheckUpdate";
@@ -860,17 +848,11 @@
this.toolStripSeparator15.Name = "toolStripSeparator15"; this.toolStripSeparator15.Name = "toolStripSeparator15";
resources.ApplyResources(this.toolStripSeparator15, "toolStripSeparator15"); resources.ApplyResources(this.toolStripSeparator15, "toolStripSeparator15");
// //
// tsbCheckUpdateGeoSite // tsbCheckUpdateGeo
// //
this.tsbCheckUpdateGeoSite.Name = "tsbCheckUpdateGeoSite"; this.tsbCheckUpdateGeo.Name = "tsbCheckUpdateGeo";
resources.ApplyResources(this.tsbCheckUpdateGeoSite, "tsbCheckUpdateGeoSite"); resources.ApplyResources(this.tsbCheckUpdateGeo, "tsbCheckUpdateGeo");
this.tsbCheckUpdateGeoSite.Click += new System.EventHandler(this.tsbCheckUpdateGeoSite_Click); this.tsbCheckUpdateGeo.Click += new System.EventHandler(this.tsbCheckUpdateGeo_Click);
//
// tsbCheckUpdateGeoIP
//
this.tsbCheckUpdateGeoIP.Name = "tsbCheckUpdateGeoIP";
resources.ApplyResources(this.tsbCheckUpdateGeoIP, "tsbCheckUpdateGeoIP");
this.tsbCheckUpdateGeoIP.Click += new System.EventHandler(this.tsbCheckUpdateGeoIP_Click);
// //
// toolStripSeparator10 // toolStripSeparator10
// //
@@ -1071,14 +1053,12 @@
private System.Windows.Forms.ToolStripSeparator toolStripSeparator14; private System.Windows.Forms.ToolStripSeparator toolStripSeparator14;
private System.Windows.Forms.ToolStripMenuItem tsbBackupGuiNConfig; private System.Windows.Forms.ToolStripMenuItem tsbBackupGuiNConfig;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator15; private System.Windows.Forms.ToolStripSeparator toolStripSeparator15;
private System.Windows.Forms.ToolStripMenuItem tsbCheckUpdateGeoSite; private System.Windows.Forms.ToolStripMenuItem tsbCheckUpdateGeo;
private System.Windows.Forms.ToolStripMenuItem tsbCheckUpdateGeoIP;
private System.Windows.Forms.SplitContainer splitContainer1; private System.Windows.Forms.SplitContainer splitContainer1;
private System.Windows.Forms.ToolStripMenuItem menuMsgBoxFilter; private System.Windows.Forms.ToolStripMenuItem menuMsgBoxFilter;
private System.Windows.Forms.ToolStripStatusLabel toolSslInboundInfo; private System.Windows.Forms.ToolStripStatusLabel toolSslInboundInfo;
private System.Windows.Forms.ToolStripStatusLabel toolSslRoutingRule; private System.Windows.Forms.ToolStripStatusLabel toolSslRoutingRule;
private System.Windows.Forms.ToolStripStatusLabel toolSslBlank2; private System.Windows.Forms.ToolStripStatusLabel toolSslBlank2;
private System.Windows.Forms.ToolStripComboBox menuServers2;
private System.Windows.Forms.ToolStripMenuItem tsbSubUpdateViaProxy; private System.Windows.Forms.ToolStripMenuItem tsbSubUpdateViaProxy;
private System.Windows.Forms.ToolStripMenuItem menuUpdateSubViaProxy; private System.Windows.Forms.ToolStripMenuItem menuUpdateSubViaProxy;
private System.Windows.Forms.ToolStripMenuItem menuMsgBoxClear; private System.Windows.Forms.ToolStripMenuItem menuMsgBoxClear;

View File

@@ -83,12 +83,12 @@ namespace v2rayN.Forms
RefreshRoutingsMenu(); RefreshRoutingsMenu();
RestoreUI(); RestoreUI();
_ = LoadV2ray();
HideForm(); HideForm();
MainFormHandler.Instance.UpdateTask(config, UpdateTaskHandler); MainFormHandler.Instance.UpdateTask(config, UpdateTaskHandler);
MainFormHandler.Instance.RegisterGlobalHotkey(config, OnHotkeyHandler, UpdateTaskHandler); MainFormHandler.Instance.RegisterGlobalHotkey(config, OnHotkeyHandler, UpdateTaskHandler);
_ = LoadV2ray();
} }
private void MainForm_FormClosing(object sender, FormClosingEventArgs e) private void MainForm_FormClosing(object sender, FormClosingEventArgs e)
@@ -273,7 +273,7 @@ namespace v2rayN.Forms
/// </summary> /// </summary>
private void RefreshServersView() private void RefreshServersView()
{ {
int index = lvServers.SelectedIndices.Count > 0 ? lvServers.SelectedIndices[0] : -1; int index = GetLvSelectedIndex(false);
lvServers.BeginUpdate(); lvServers.BeginUpdate();
lvServers.Items.Clear(); lvServers.Items.Clear();
@@ -281,29 +281,12 @@ namespace v2rayN.Forms
for (int k = 0; k < lstVmess.Count; k++) for (int k = 0; k < lstVmess.Count; k++)
{ {
string def = string.Empty; string def = string.Empty;
string totalUp = string.Empty,
totalDown = string.Empty,
todayUp = string.Empty,
todayDown = string.Empty;
VmessItem item = lstVmess[k]; VmessItem item = lstVmess[k];
if (config.IsActiveNode(item)) if (config.IsActiveNode(item))
{ {
def = "√"; def = "√";
} }
bool stats = statistics != null && statistics.Enable;
if (stats)
{
ServerStatItem sItem = statistics.Statistic.Find(item_ => item_.itemId == item.indexId);
if (sItem != null)
{
totalUp = Utils.HumanFy(sItem.totalUp);
totalDown = Utils.HumanFy(sItem.totalDown);
todayUp = Utils.HumanFy(sItem.todayUp);
todayDown = Utils.HumanFy(sItem.todayDown);
}
}
ListViewItem lvItem = new ListViewItem(def); ListViewItem lvItem = new ListViewItem(def);
Utils.AddSubItem(lvItem, EServerColName.configType.ToString(), (item.configType).ToString()); Utils.AddSubItem(lvItem, EServerColName.configType.ToString(), (item.configType).ToString());
Utils.AddSubItem(lvItem, EServerColName.remarks.ToString(), item.remarks); Utils.AddSubItem(lvItem, EServerColName.remarks.ToString(), item.remarks);
@@ -314,8 +297,22 @@ namespace v2rayN.Forms
Utils.AddSubItem(lvItem, EServerColName.streamSecurity.ToString(), item.streamSecurity); Utils.AddSubItem(lvItem, EServerColName.streamSecurity.ToString(), item.streamSecurity);
Utils.AddSubItem(lvItem, EServerColName.subRemarks.ToString(), item.GetSubRemarks(config)); Utils.AddSubItem(lvItem, EServerColName.subRemarks.ToString(), item.GetSubRemarks(config));
Utils.AddSubItem(lvItem, EServerColName.testResult.ToString(), item.testResult); Utils.AddSubItem(lvItem, EServerColName.testResult.ToString(), item.testResult);
if (stats)
if (statistics != null && statistics.Enable)
{ {
string totalUp = string.Empty,
totalDown = string.Empty,
todayUp = string.Empty,
todayDown = string.Empty;
ServerStatItem sItem = statistics.Statistic.Find(item_ => item_.itemId == item.indexId);
if (sItem != null)
{
totalUp = Utils.HumanFy(sItem.totalUp);
totalDown = Utils.HumanFy(sItem.totalDown);
todayUp = Utils.HumanFy(sItem.todayUp);
todayDown = Utils.HumanFy(sItem.todayDown);
}
Utils.AddSubItem(lvItem, EServerColName.todayDown.ToString(), todayDown); Utils.AddSubItem(lvItem, EServerColName.todayDown.ToString(), todayDown);
Utils.AddSubItem(lvItem, EServerColName.todayUp.ToString(), todayUp); Utils.AddSubItem(lvItem, EServerColName.todayUp.ToString(), todayUp);
Utils.AddSubItem(lvItem, EServerColName.totalDown.ToString(), totalDown); Utils.AddSubItem(lvItem, EServerColName.totalDown.ToString(), totalDown);
@@ -350,31 +347,13 @@ namespace v2rayN.Forms
private void RefreshServersMenu() private void RefreshServersMenu()
{ {
menuServers.DropDownItems.Clear(); menuServers.DropDownItems.Clear();
menuServers2.SelectedIndexChanged -= MenuServers2_SelectedIndexChanged;
menuServers2.Items.Clear();
menuServers.Visible = false;
menuServers2.Visible = false;
if (lstVmess.Count > 20) if (lstVmess.Count > 30)
{ {
for (int k = 0; k < lstVmess.Count; k++) menuServers.DropDownItems.Add(new ToolStripMenuItem(ResUI.TooManyServersTip));
{ return;
VmessItem item = lstVmess[k]; }
string name = item.GetSummary();
if (config.IsActiveNode(item))
{
name = $"√ {name}";
}
menuServers2.Items.Add(name);
}
menuServers2.SelectedIndex = lstVmess.FindIndex(it => it.indexId == config.indexId);
menuServers2.SelectedIndexChanged += MenuServers2_SelectedIndexChanged;
menuServers2.Visible = true;
}
else
{
List<ToolStripMenuItem> lst = new List<ToolStripMenuItem>(); List<ToolStripMenuItem> lst = new List<ToolStripMenuItem>();
for (int k = 0; k < lstVmess.Count; k++) for (int k = 0; k < lstVmess.Count; k++)
{ {
@@ -395,12 +374,6 @@ namespace v2rayN.Forms
menuServers.DropDownItems.AddRange(lst.ToArray()); menuServers.DropDownItems.AddRange(lst.ToArray());
menuServers.Visible = true; menuServers.Visible = true;
} }
}
private void MenuServers2_SelectedIndexChanged(object sender, EventArgs e)
{
SetDefaultServer(((ToolStripComboBox)sender).SelectedIndex);
}
private void ts_Click(object sender, EventArgs e) private void ts_Click(object sender, EventArgs e)
{ {
@@ -417,22 +390,6 @@ namespace v2rayN.Forms
private void lvServers_SelectedIndexChanged(object sender, EventArgs e) private void lvServers_SelectedIndexChanged(object sender, EventArgs e)
{ {
int index = -1;
try
{
if (lvServers.SelectedIndices.Count > 0)
{
index = lvServers.SelectedIndices[0];
}
}
catch
{
}
if (index < 0)
{
return;
}
//qrCodeControl.showQRCode(index, config);
} }
private void ssMain_ItemClicked(object sender, ToolStripItemClickedEventArgs e) private void ssMain_ItemClicked(object sender, ToolStripItemClickedEventArgs e)
@@ -491,7 +448,7 @@ namespace v2rayN.Forms
tabPage.Name = ""; tabPage.Name = "";
tabGroup.TabPages.Add(tabPage); tabGroup.TabPages.Add(tabPage);
foreach (var item in config.groupItem) foreach (var item in config.groupItem.OrderBy(t => t.sort))
{ {
var tabPage2 = new TabPage($" {item.remarks} "); var tabPage2 = new TabPage($" {item.remarks} ");
tabPage2.Name = item.id; tabPage2.Name = item.id;
@@ -558,13 +515,15 @@ namespace v2rayN.Forms
#endregion #endregion
#region v2ray #region v2ray
/// <summary> /// <summary>
/// 载入V2ray /// 载入V2ray
/// </summary> /// </summary>
async Task LoadV2ray() async Task LoadV2ray()
{
this.BeginInvoke(new Action(() =>
{ {
tsbReload.Enabled = false; tsbReload.Enabled = false;
}));
if (Global.reloadV2ray) if (Global.reloadV2ray)
{ {
@@ -581,7 +540,10 @@ namespace v2rayN.Forms
ChangePACButtonStatus(config.sysProxyType); ChangePACButtonStatus(config.sysProxyType);
this.BeginInvoke(new Action(() =>
{
tsbReload.Enabled = true; tsbReload.Enabled = true;
}));
} }
/// <summary> /// <summary>
@@ -603,17 +565,7 @@ namespace v2rayN.Forms
private void lvServers_Click(object sender, EventArgs e) private void lvServers_Click(object sender, EventArgs e)
{ {
int index = -1; int index = GetLvSelectedIndex(false);
try
{
if (lvServers.SelectedIndices.Count > 0)
{
index = lvServers.SelectedIndices[0];
}
}
catch
{
}
if (index < 0) if (index < 0)
{ {
return; return;
@@ -810,13 +762,12 @@ namespace v2rayN.Forms
{ {
if (GetLvSelectedIndex() < 0) return; if (GetLvSelectedIndex() < 0) return;
ClearTestResult(); ClearTestResult();
SpeedtestHandler statistics = new SpeedtestHandler(ref config, v2rayHandler, lstSelecteds, actionType, UpdateSpeedtestHandler); SpeedtestHandler statistics = new SpeedtestHandler(config, v2rayHandler, lstSelecteds, actionType, UpdateSpeedtestHandler);
} }
private void tsbTestMe_Click(object sender, EventArgs e) private void tsbTestMe_Click(object sender, EventArgs e)
{ {
SpeedtestHandler statistics = new SpeedtestHandler(ref config); string result = (new DownloadHandle()).RunAvailabilityCheck(null) + "ms";
string result = statistics.RunAvailabilityCheck() + "ms";
AppendText(false, string.Format(ResUI.TestMeOutput, result)); AppendText(false, string.Format(ResUI.TestMeOutput, result));
} }
@@ -911,9 +862,9 @@ namespace v2rayN.Forms
var fm = new GlobalHotkeySettingForm(); var fm = new GlobalHotkeySettingForm();
if (fm.ShowDialog() == DialogResult.OK) if (fm.ShowDialog() == DialogResult.OK)
{ {
RefreshRoutingsMenu(); //RefreshRoutingsMenu();
RefreshServers(); //RefreshServers();
_ = LoadV2ray(); //_ = LoadV2ray();
} }
} }
@@ -966,15 +917,18 @@ namespace v2rayN.Forms
/// 取得ListView选中的行 /// 取得ListView选中的行
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
private int GetLvSelectedIndex() private int GetLvSelectedIndex(bool show = true)
{ {
int index = -1; int index = -1;
lstSelecteds.Clear(); lstSelecteds.Clear();
try try
{ {
if (lvServers.SelectedIndices.Count <= 0) if (lvServers.SelectedIndices.Count <= 0)
{
if (show)
{ {
UI.Show(ResUI.PleaseSelectServer); UI.Show(ResUI.PleaseSelectServer);
}
return index; return index;
} }
@@ -1190,11 +1144,13 @@ namespace v2rayN.Forms
this.ShowInTaskbar = true; this.ShowInTaskbar = true;
//this.notifyIcon1.Visible = false; //this.notifyIcon1.Visible = false;
this.txtMsgBox.ScrollToCaret(); this.txtMsgBox.ScrollToCaret();
//if (config.index >= 0 && config.index < lvServers.Items.Count)
//{ int index = GetLvSelectedIndex(false);
// lvServers.Items[config.index].Selected = true; if (index >= 0 && index < lvServers.Items.Count && lvServers.Items.Count > 0)
// lvServers.EnsureVisible(config.index); // workaround {
//} lvServers.Items[index].Selected = true;
lvServers.EnsureVisible(index); // workaround
}
SetVisibleCore(true); SetVisibleCore(true);
} }
@@ -1221,6 +1177,10 @@ namespace v2rayN.Forms
lstVmess[k].testResult = txt; lstVmess[k].testResult = txt;
lvServers.Items[k].SubItems["testResult"].Text = txt; lvServers.Items[k].SubItems["testResult"].Text = txt;
} }
else
{
AppendText(false, txt);
}
} }
private void SetTestResult(int k, string txt) private void SetTestResult(int k, string txt)
{ {
@@ -1273,26 +1233,6 @@ namespace v2rayN.Forms
}); });
} }
for (int i = 0; i < lstVmess.Count; i++)
{
int index = statistics.FindIndex(item_ => item_.itemId == lstVmess[i].indexId);
if (index != -1)
{
lvServers.Invoke((MethodInvoker)delegate
{
lvServers.BeginUpdate();
lvServers.Items[i].SubItems["todayDown"].Text = Utils.HumanFy(statistics[index].todayDown);
lvServers.Items[i].SubItems["todayUp"].Text = Utils.HumanFy(statistics[index].todayUp);
lvServers.Items[i].SubItems["totalDown"].Text = Utils.HumanFy(statistics[index].totalDown);
lvServers.Items[i].SubItems["totalUp"].Text = Utils.HumanFy(statistics[index].totalUp);
lvServers.EndUpdate();
});
}
}
} }
catch (Exception ex) catch (Exception ex)
{ {
@@ -1300,13 +1240,13 @@ namespace v2rayN.Forms
} }
} }
private void UpdateTaskHandler(bool success, string msg) private async void UpdateTaskHandler(bool success, string msg)
{ {
AppendText(false, msg); AppendText(false, msg);
if (success) if (success)
{ {
Global.reloadV2ray = true; Global.reloadV2ray = true;
_ = LoadV2ray(); await LoadV2ray();
} }
} }
#endregion #endregion
@@ -1462,31 +1402,16 @@ namespace v2rayN.Forms
(new UpdateHandle()).CheckUpdateCore(type, config, _updateUI); (new UpdateHandle()).CheckUpdateCore(type, config, _updateUI);
} }
private void tsbCheckUpdateGeoSite_Click(object sender, EventArgs e) private void tsbCheckUpdateGeo_Click(object sender, EventArgs e)
{ {
(new UpdateHandle()).UpdateGeoFile("geosite", config, (bool success, string msg) => Task.Run(() =>
{ {
AppendText(false, msg); var updateHandle = new UpdateHandle();
if (success) updateHandle.UpdateGeoFile("geosite", config, UpdateTaskHandler);
{ updateHandle.UpdateGeoFile("geoip", config, UpdateTaskHandler);
Global.reloadV2ray = true;
_ = LoadV2ray();
}
}); });
} }
private void tsbCheckUpdateGeoIP_Click(object sender, EventArgs e)
{
(new UpdateHandle()).UpdateGeoFile("geoip", config, (bool success, string msg) =>
{
AppendText(false, msg);
if (success)
{
Global.reloadV2ray = true;
_ = LoadV2ray();
}
});
}
#endregion #endregion
#region Help #region Help

View File

@@ -321,7 +321,7 @@
<value>ImageAboveText</value> <value>ImageAboveText</value>
</data> </data>
<data name="cmsLv.Size" type="System.Drawing.Size, System.Drawing"> <data name="cmsLv.Size" type="System.Drawing.Size, System.Drawing">
<value>356, 666</value> <value>356, 644</value>
</data> </data>
<data name="&gt;&gt;cmsLv.Name" xml:space="preserve"> <data name="&gt;&gt;cmsLv.Name" xml:space="preserve">
<value>cmsLv</value> <value>cmsLv</value>
@@ -750,73 +750,61 @@
<value>Do not change system proxy</value> <value>Do not change system proxy</value>
</data> </data>
<data name="menuSysAgentMode.Size" type="System.Drawing.Size, System.Drawing"> <data name="menuSysAgentMode.Size" type="System.Drawing.Size, System.Drawing">
<value>264, 22</value> <value>277, 22</value>
</data> </data>
<data name="menuSysAgentMode.Text" xml:space="preserve"> <data name="menuSysAgentMode.Text" xml:space="preserve">
<value>System proxy</value> <value>System proxy</value>
</data> </data>
<data name="menuRoutings.Size" type="System.Drawing.Size, System.Drawing"> <data name="menuRoutings.Size" type="System.Drawing.Size, System.Drawing">
<value>264, 22</value> <value>277, 22</value>
</data> </data>
<data name="menuRoutings.Text" xml:space="preserve"> <data name="menuRoutings.Text" xml:space="preserve">
<value>Routing</value> <value>Routing</value>
</data> </data>
<data name="menuServers.Size" type="System.Drawing.Size, System.Drawing"> <data name="menuServers.Size" type="System.Drawing.Size, System.Drawing">
<value>264, 22</value> <value>277, 22</value>
</data> </data>
<data name="menuServers.Text" xml:space="preserve"> <data name="menuServers.Text" xml:space="preserve">
<value>Server</value> <value>Server</value>
</data> </data>
<data name="menuServers2.FlatStyle" type="System.Windows.Forms.FlatStyle, System.Windows.Forms">
<value>Standard</value>
</data>
<data name="menuServers2.MaxDropDownItems" type="System.Int32, mscorlib">
<value>50</value>
</data>
<data name="menuServers2.Size" type="System.Drawing.Size, System.Drawing">
<value>200, 25</value>
</data>
<data name="menuServers2.ToolTipText" xml:space="preserve">
<value>Server</value>
</data>
<data name="toolStripSeparator13.Size" type="System.Drawing.Size, System.Drawing"> <data name="toolStripSeparator13.Size" type="System.Drawing.Size, System.Drawing">
<value>261, 6</value> <value>274, 6</value>
</data> </data>
<data name="menuAddServers2.Size" type="System.Drawing.Size, System.Drawing"> <data name="menuAddServers2.Size" type="System.Drawing.Size, System.Drawing">
<value>264, 22</value> <value>277, 22</value>
</data> </data>
<data name="menuAddServers2.Text" xml:space="preserve"> <data name="menuAddServers2.Text" xml:space="preserve">
<value>Import bulk URL from clipboard</value> <value>Import bulk URL from clipboard</value>
</data> </data>
<data name="menuScanScreen2.Size" type="System.Drawing.Size, System.Drawing"> <data name="menuScanScreen2.Size" type="System.Drawing.Size, System.Drawing">
<value>264, 22</value> <value>277, 22</value>
</data> </data>
<data name="menuScanScreen2.Text" xml:space="preserve"> <data name="menuScanScreen2.Text" xml:space="preserve">
<value>Scan QR code on the screen</value> <value>Scan QR code on the screen</value>
</data> </data>
<data name="menuUpdateSubscriptions.Size" type="System.Drawing.Size, System.Drawing"> <data name="menuUpdateSubscriptions.Size" type="System.Drawing.Size, System.Drawing">
<value>264, 22</value> <value>277, 22</value>
</data> </data>
<data name="menuUpdateSubscriptions.Text" xml:space="preserve"> <data name="menuUpdateSubscriptions.Text" xml:space="preserve">
<value>Update subscription without proxy</value> <value>Update subscription without proxy</value>
</data> </data>
<data name="menuUpdateSubViaProxy.Size" type="System.Drawing.Size, System.Drawing"> <data name="menuUpdateSubViaProxy.Size" type="System.Drawing.Size, System.Drawing">
<value>264, 22</value> <value>277, 22</value>
</data> </data>
<data name="menuUpdateSubViaProxy.Text" xml:space="preserve"> <data name="menuUpdateSubViaProxy.Text" xml:space="preserve">
<value>Update subscriptions via proxy</value> <value>Update subscriptions via proxy</value>
</data> </data>
<data name="toolStripSeparator2.Size" type="System.Drawing.Size, System.Drawing"> <data name="toolStripSeparator2.Size" type="System.Drawing.Size, System.Drawing">
<value>261, 6</value> <value>274, 6</value>
</data> </data>
<data name="menuExit.Size" type="System.Drawing.Size, System.Drawing"> <data name="menuExit.Size" type="System.Drawing.Size, System.Drawing">
<value>264, 22</value> <value>277, 22</value>
</data> </data>
<data name="menuExit.Text" xml:space="preserve"> <data name="menuExit.Text" xml:space="preserve">
<value>Exit</value> <value>Exit</value>
</data> </data>
<data name="cmsMain.Size" type="System.Drawing.Size, System.Drawing"> <data name="cmsMain.Size" type="System.Drawing.Size, System.Drawing">
<value>265, 221</value> <value>278, 192</value>
</data> </data>
<data name="&gt;&gt;cmsMain.Name" xml:space="preserve"> <data name="&gt;&gt;cmsMain.Name" xml:space="preserve">
<value>cmsMain</value> <value>cmsMain</value>
@@ -861,19 +849,19 @@
<value>6, 56</value> <value>6, 56</value>
</data> </data>
<data name="tsbSubSetting.Size" type="System.Drawing.Size, System.Drawing"> <data name="tsbSubSetting.Size" type="System.Drawing.Size, System.Drawing">
<value>182, 22</value> <value>277, 22</value>
</data> </data>
<data name="tsbSubSetting.Text" xml:space="preserve"> <data name="tsbSubSetting.Text" xml:space="preserve">
<value>Settings</value> <value>Settings</value>
</data> </data>
<data name="tsbSubUpdate.Size" type="System.Drawing.Size, System.Drawing"> <data name="tsbSubUpdate.Size" type="System.Drawing.Size, System.Drawing">
<value>182, 22</value> <value>277, 22</value>
</data> </data>
<data name="tsbSubUpdate.Text" xml:space="preserve"> <data name="tsbSubUpdate.Text" xml:space="preserve">
<value>Update subscription without proxy</value> <value>Update subscription without proxy</value>
</data> </data>
<data name="tsbSubUpdateViaProxy.Size" type="System.Drawing.Size, System.Drawing"> <data name="tsbSubUpdateViaProxy.Size" type="System.Drawing.Size, System.Drawing">
<value>182, 22</value> <value>277, 22</value>
</data> </data>
<data name="tsbSubUpdateViaProxy.Text" xml:space="preserve"> <data name="tsbSubUpdateViaProxy.Text" xml:space="preserve">
<value>Update subscription with proxy</value> <value>Update subscription with proxy</value>
@@ -995,17 +983,11 @@
<data name="toolStripSeparator15.Size" type="System.Drawing.Size, System.Drawing"> <data name="toolStripSeparator15.Size" type="System.Drawing.Size, System.Drawing">
<value>200, 6</value> <value>200, 6</value>
</data> </data>
<data name="tsbCheckUpdateGeoSite.Size" type="System.Drawing.Size, System.Drawing"> <data name="tsbCheckUpdateGeo.Size" type="System.Drawing.Size, System.Drawing">
<value>203, 22</value> <value>203, 22</value>
</data> </data>
<data name="tsbCheckUpdateGeoSite.Text" xml:space="preserve"> <data name="tsbCheckUpdateGeo.Text" xml:space="preserve">
<value>Update GeoSite</value> <value>Update Geo files</value>
</data>
<data name="tsbCheckUpdateGeoIP.Size" type="System.Drawing.Size, System.Drawing">
<value>203, 22</value>
</data>
<data name="tsbCheckUpdateGeoIP.Text" xml:space="preserve">
<value>Update GeoIP</value>
</data> </data>
<data name="tsbCheckUpdate.ImageTransparentColor" type="System.Drawing.Color, System.Drawing"> <data name="tsbCheckUpdate.ImageTransparentColor" type="System.Drawing.Color, System.Drawing">
<value>Magenta</value> <value>Magenta</value>
@@ -1439,12 +1421,6 @@
<data name="&gt;&gt;menuServers.Type" xml:space="preserve"> <data name="&gt;&gt;menuServers.Type" xml:space="preserve">
<value>System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> <value>System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data> </data>
<data name="&gt;&gt;menuServers2.Name" xml:space="preserve">
<value>menuServers2</value>
</data>
<data name="&gt;&gt;menuServers2.Type" xml:space="preserve">
<value>System.Windows.Forms.ToolStripComboBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;toolStripSeparator13.Name" xml:space="preserve"> <data name="&gt;&gt;toolStripSeparator13.Name" xml:space="preserve">
<value>toolStripSeparator13</value> <value>toolStripSeparator13</value>
</data> </data>
@@ -1619,16 +1595,10 @@
<data name="&gt;&gt;toolStripSeparator15.Type" xml:space="preserve"> <data name="&gt;&gt;toolStripSeparator15.Type" xml:space="preserve">
<value>System.Windows.Forms.ToolStripSeparator, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> <value>System.Windows.Forms.ToolStripSeparator, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data> </data>
<data name="&gt;&gt;tsbCheckUpdateGeoSite.Name" xml:space="preserve"> <data name="&gt;&gt;tsbCheckUpdateGeo.Name" xml:space="preserve">
<value>tsbCheckUpdateGeoSite</value> <value>tsbCheckUpdateGeo</value>
</data> </data>
<data name="&gt;&gt;tsbCheckUpdateGeoSite.Type" xml:space="preserve"> <data name="&gt;&gt;tsbCheckUpdateGeo.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;tsbCheckUpdateGeoIP.Name" xml:space="preserve">
<value>tsbCheckUpdateGeoIP</value>
</data>
<data name="&gt;&gt;tsbCheckUpdateGeoIP.Type" xml:space="preserve">
<value>System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> <value>System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data> </data>
<data name="&gt;&gt;toolStripSeparator10.Name" xml:space="preserve"> <data name="&gt;&gt;toolStripSeparator10.Name" xml:space="preserve">

View File

@@ -114,33 +114,34 @@
// //
// btnClose // btnClose
// //
this.btnClose.DialogResult = System.Windows.Forms.DialogResult.Cancel;
resources.ApplyResources(this.btnClose, "btnClose"); resources.ApplyResources(this.btnClose, "btnClose");
this.btnClose.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.btnClose.Name = "btnClose"; this.btnClose.Name = "btnClose";
this.btnClose.UseVisualStyleBackColor = true; this.btnClose.UseVisualStyleBackColor = true;
this.btnClose.Click += new System.EventHandler(this.btnClose_Click); this.btnClose.Click += new System.EventHandler(this.btnClose_Click);
// //
// tabControl1 // tabControl1
// //
resources.ApplyResources(this.tabControl1, "tabControl1");
this.tabControl1.Controls.Add(this.tabPage1); this.tabControl1.Controls.Add(this.tabPage1);
this.tabControl1.Controls.Add(this.tabPage2); this.tabControl1.Controls.Add(this.tabPage2);
this.tabControl1.Controls.Add(this.tabPage6); this.tabControl1.Controls.Add(this.tabPage6);
this.tabControl1.Controls.Add(this.tabPage7); this.tabControl1.Controls.Add(this.tabPage7);
this.tabControl1.Controls.Add(this.tabPageCoreType); this.tabControl1.Controls.Add(this.tabPageCoreType);
this.tabControl1.Controls.Add(this.tabPage3); this.tabControl1.Controls.Add(this.tabPage3);
resources.ApplyResources(this.tabControl1, "tabControl1");
this.tabControl1.Name = "tabControl1"; this.tabControl1.Name = "tabControl1";
this.tabControl1.SelectedIndex = 0; this.tabControl1.SelectedIndex = 0;
// //
// tabPage1 // tabPage1
// //
this.tabPage1.Controls.Add(this.groupBox1);
resources.ApplyResources(this.tabPage1, "tabPage1"); resources.ApplyResources(this.tabPage1, "tabPage1");
this.tabPage1.Controls.Add(this.groupBox1);
this.tabPage1.Name = "tabPage1"; this.tabPage1.Name = "tabPage1";
this.tabPage1.UseVisualStyleBackColor = true; this.tabPage1.UseVisualStyleBackColor = true;
// //
// groupBox1 // groupBox1
// //
resources.ApplyResources(this.groupBox1, "groupBox1");
this.groupBox1.Controls.Add(this.label16); this.groupBox1.Controls.Add(this.label16);
this.groupBox1.Controls.Add(this.label4); this.groupBox1.Controls.Add(this.label4);
this.groupBox1.Controls.Add(this.txtpass); this.groupBox1.Controls.Add(this.txtpass);
@@ -157,7 +158,6 @@
this.groupBox1.Controls.Add(this.label5); this.groupBox1.Controls.Add(this.label5);
this.groupBox1.Controls.Add(this.txtlocalPort); this.groupBox1.Controls.Add(this.txtlocalPort);
this.groupBox1.Controls.Add(this.label2); this.groupBox1.Controls.Add(this.label2);
resources.ApplyResources(this.groupBox1, "groupBox1");
this.groupBox1.Name = "groupBox1"; this.groupBox1.Name = "groupBox1";
this.groupBox1.TabStop = false; this.groupBox1.TabStop = false;
// //
@@ -207,8 +207,8 @@
// //
// cmbprotocol // cmbprotocol
// //
this.cmbprotocol.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
resources.ApplyResources(this.cmbprotocol, "cmbprotocol"); resources.ApplyResources(this.cmbprotocol, "cmbprotocol");
this.cmbprotocol.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cmbprotocol.FormattingEnabled = true; this.cmbprotocol.FormattingEnabled = true;
this.cmbprotocol.Items.AddRange(new object[] { this.cmbprotocol.Items.AddRange(new object[] {
resources.GetString("cmbprotocol.Items"), resources.GetString("cmbprotocol.Items"),
@@ -234,6 +234,7 @@
// //
// cmbloglevel // cmbloglevel
// //
resources.ApplyResources(this.cmbloglevel, "cmbloglevel");
this.cmbloglevel.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.cmbloglevel.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cmbloglevel.FormattingEnabled = true; this.cmbloglevel.FormattingEnabled = true;
this.cmbloglevel.Items.AddRange(new object[] { this.cmbloglevel.Items.AddRange(new object[] {
@@ -242,7 +243,6 @@
resources.GetString("cmbloglevel.Items2"), resources.GetString("cmbloglevel.Items2"),
resources.GetString("cmbloglevel.Items3"), resources.GetString("cmbloglevel.Items3"),
resources.GetString("cmbloglevel.Items4")}); resources.GetString("cmbloglevel.Items4")});
resources.ApplyResources(this.cmbloglevel, "cmbloglevel");
this.cmbloglevel.Name = "cmbloglevel"; this.cmbloglevel.Name = "cmbloglevel";
// //
// label5 // label5
@@ -262,10 +262,10 @@
// //
// tabPage2 // tabPage2
// //
resources.ApplyResources(this.tabPage2, "tabPage2");
this.tabPage2.Controls.Add(this.linkDnsObjectDoc); this.tabPage2.Controls.Add(this.linkDnsObjectDoc);
this.tabPage2.Controls.Add(this.txtremoteDNS); this.tabPage2.Controls.Add(this.txtremoteDNS);
this.tabPage2.Controls.Add(this.label14); this.tabPage2.Controls.Add(this.label14);
resources.ApplyResources(this.tabPage2, "tabPage2");
this.tabPage2.Name = "tabPage2"; this.tabPage2.Name = "tabPage2";
this.tabPage2.UseVisualStyleBackColor = true; this.tabPage2.UseVisualStyleBackColor = true;
// //
@@ -288,6 +288,7 @@
// //
// tabPage6 // tabPage6
// //
resources.ApplyResources(this.tabPage6, "tabPage6");
this.tabPage6.Controls.Add(this.chkKcpcongestion); this.tabPage6.Controls.Add(this.chkKcpcongestion);
this.tabPage6.Controls.Add(this.txtKcpwriteBufferSize); this.tabPage6.Controls.Add(this.txtKcpwriteBufferSize);
this.tabPage6.Controls.Add(this.label10); this.tabPage6.Controls.Add(this.label10);
@@ -301,7 +302,6 @@
this.tabPage6.Controls.Add(this.label7); this.tabPage6.Controls.Add(this.label7);
this.tabPage6.Controls.Add(this.txtKcpmtu); this.tabPage6.Controls.Add(this.txtKcpmtu);
this.tabPage6.Controls.Add(this.label6); this.tabPage6.Controls.Add(this.label6);
resources.ApplyResources(this.tabPage6, "tabPage6");
this.tabPage6.Name = "tabPage6"; this.tabPage6.Name = "tabPage6";
this.tabPage6.UseVisualStyleBackColor = true; this.tabPage6.UseVisualStyleBackColor = true;
// //
@@ -373,6 +373,7 @@
// //
// tabPage7 // tabPage7
// //
resources.ApplyResources(this.tabPage7, "tabPage7");
this.tabPage7.Controls.Add(this.chkEnableSecurityProtocolTls13); this.tabPage7.Controls.Add(this.chkEnableSecurityProtocolTls13);
this.tabPage7.Controls.Add(this.chkEnableAutoAdjustMainLvColWidth); this.tabPage7.Controls.Add(this.chkEnableAutoAdjustMainLvColWidth);
this.tabPage7.Controls.Add(this.btnSetLoopback); this.tabPage7.Controls.Add(this.btnSetLoopback);
@@ -384,7 +385,6 @@
this.tabPage7.Controls.Add(this.lbFreshrate); this.tabPage7.Controls.Add(this.lbFreshrate);
this.tabPage7.Controls.Add(this.chkEnableStatistics); this.tabPage7.Controls.Add(this.chkEnableStatistics);
this.tabPage7.Controls.Add(this.chkAutoRun); this.tabPage7.Controls.Add(this.chkAutoRun);
resources.ApplyResources(this.tabPage7, "tabPage7");
this.tabPage7.Name = "tabPage7"; this.tabPage7.Name = "tabPage7";
this.tabPage7.UseVisualStyleBackColor = true; this.tabPage7.UseVisualStyleBackColor = true;
// //
@@ -431,9 +431,9 @@
// //
// cbFreshrate // cbFreshrate
// //
resources.ApplyResources(this.cbFreshrate, "cbFreshrate");
this.cbFreshrate.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.cbFreshrate.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cbFreshrate.FormattingEnabled = true; this.cbFreshrate.FormattingEnabled = true;
resources.ApplyResources(this.cbFreshrate, "cbFreshrate");
this.cbFreshrate.Name = "cbFreshrate"; this.cbFreshrate.Name = "cbFreshrate";
// //
// lbFreshrate // lbFreshrate
@@ -455,6 +455,7 @@
// //
// tabPageCoreType // tabPageCoreType
// //
resources.ApplyResources(this.tabPageCoreType, "tabPageCoreType");
this.tabPageCoreType.Controls.Add(this.cmbCoreType6); this.tabPageCoreType.Controls.Add(this.cmbCoreType6);
this.tabPageCoreType.Controls.Add(this.labCoreType6); this.tabPageCoreType.Controls.Add(this.labCoreType6);
this.tabPageCoreType.Controls.Add(this.cmbCoreType5); this.tabPageCoreType.Controls.Add(this.cmbCoreType5);
@@ -467,15 +468,14 @@
this.tabPageCoreType.Controls.Add(this.labCoreType2); this.tabPageCoreType.Controls.Add(this.labCoreType2);
this.tabPageCoreType.Controls.Add(this.cmbCoreType1); this.tabPageCoreType.Controls.Add(this.cmbCoreType1);
this.tabPageCoreType.Controls.Add(this.labCoreType1); this.tabPageCoreType.Controls.Add(this.labCoreType1);
resources.ApplyResources(this.tabPageCoreType, "tabPageCoreType");
this.tabPageCoreType.Name = "tabPageCoreType"; this.tabPageCoreType.Name = "tabPageCoreType";
this.tabPageCoreType.UseVisualStyleBackColor = true; this.tabPageCoreType.UseVisualStyleBackColor = true;
// //
// cmbCoreType6 // cmbCoreType6
// //
resources.ApplyResources(this.cmbCoreType6, "cmbCoreType6");
this.cmbCoreType6.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.cmbCoreType6.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cmbCoreType6.FormattingEnabled = true; this.cmbCoreType6.FormattingEnabled = true;
resources.ApplyResources(this.cmbCoreType6, "cmbCoreType6");
this.cmbCoreType6.Name = "cmbCoreType6"; this.cmbCoreType6.Name = "cmbCoreType6";
// //
// labCoreType6 // labCoreType6
@@ -485,9 +485,9 @@
// //
// cmbCoreType5 // cmbCoreType5
// //
resources.ApplyResources(this.cmbCoreType5, "cmbCoreType5");
this.cmbCoreType5.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.cmbCoreType5.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cmbCoreType5.FormattingEnabled = true; this.cmbCoreType5.FormattingEnabled = true;
resources.ApplyResources(this.cmbCoreType5, "cmbCoreType5");
this.cmbCoreType5.Name = "cmbCoreType5"; this.cmbCoreType5.Name = "cmbCoreType5";
// //
// labCoreType5 // labCoreType5
@@ -497,9 +497,9 @@
// //
// cmbCoreType4 // cmbCoreType4
// //
resources.ApplyResources(this.cmbCoreType4, "cmbCoreType4");
this.cmbCoreType4.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.cmbCoreType4.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cmbCoreType4.FormattingEnabled = true; this.cmbCoreType4.FormattingEnabled = true;
resources.ApplyResources(this.cmbCoreType4, "cmbCoreType4");
this.cmbCoreType4.Name = "cmbCoreType4"; this.cmbCoreType4.Name = "cmbCoreType4";
// //
// labCoreType4 // labCoreType4
@@ -509,9 +509,9 @@
// //
// cmbCoreType3 // cmbCoreType3
// //
resources.ApplyResources(this.cmbCoreType3, "cmbCoreType3");
this.cmbCoreType3.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.cmbCoreType3.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cmbCoreType3.FormattingEnabled = true; this.cmbCoreType3.FormattingEnabled = true;
resources.ApplyResources(this.cmbCoreType3, "cmbCoreType3");
this.cmbCoreType3.Name = "cmbCoreType3"; this.cmbCoreType3.Name = "cmbCoreType3";
// //
// labCoreType3 // labCoreType3
@@ -521,9 +521,9 @@
// //
// cmbCoreType2 // cmbCoreType2
// //
resources.ApplyResources(this.cmbCoreType2, "cmbCoreType2");
this.cmbCoreType2.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.cmbCoreType2.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cmbCoreType2.FormattingEnabled = true; this.cmbCoreType2.FormattingEnabled = true;
resources.ApplyResources(this.cmbCoreType2, "cmbCoreType2");
this.cmbCoreType2.Name = "cmbCoreType2"; this.cmbCoreType2.Name = "cmbCoreType2";
// //
// labCoreType2 // labCoreType2
@@ -533,9 +533,9 @@
// //
// cmbCoreType1 // cmbCoreType1
// //
resources.ApplyResources(this.cmbCoreType1, "cmbCoreType1");
this.cmbCoreType1.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.cmbCoreType1.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cmbCoreType1.FormattingEnabled = true; this.cmbCoreType1.FormattingEnabled = true;
resources.ApplyResources(this.cmbCoreType1, "cmbCoreType1");
this.cmbCoreType1.Name = "cmbCoreType1"; this.cmbCoreType1.Name = "cmbCoreType1";
// //
// labCoreType1 // labCoreType1
@@ -545,17 +545,17 @@
// //
// tabPage3 // tabPage3
// //
this.tabPage3.Controls.Add(this.groupBox2);
resources.ApplyResources(this.tabPage3, "tabPage3"); resources.ApplyResources(this.tabPage3, "tabPage3");
this.tabPage3.Controls.Add(this.groupBox2);
this.tabPage3.Name = "tabPage3"; this.tabPage3.Name = "tabPage3";
this.tabPage3.UseVisualStyleBackColor = true; this.tabPage3.UseVisualStyleBackColor = true;
// //
// groupBox2 // groupBox2
// //
resources.ApplyResources(this.groupBox2, "groupBox2");
this.groupBox2.Controls.Add(this.label13); this.groupBox2.Controls.Add(this.label13);
this.groupBox2.Controls.Add(this.label12); this.groupBox2.Controls.Add(this.label12);
this.groupBox2.Controls.Add(this.txtsystemProxyExceptions); this.groupBox2.Controls.Add(this.txtsystemProxyExceptions);
resources.ApplyResources(this.groupBox2, "groupBox2");
this.groupBox2.Name = "groupBox2"; this.groupBox2.Name = "groupBox2";
this.groupBox2.TabStop = false; this.groupBox2.TabStop = false;
// //
@@ -576,9 +576,9 @@
// //
// panel2 // panel2
// //
resources.ApplyResources(this.panel2, "panel2");
this.panel2.Controls.Add(this.btnClose); this.panel2.Controls.Add(this.btnClose);
this.panel2.Controls.Add(this.btnOK); this.panel2.Controls.Add(this.btnOK);
resources.ApplyResources(this.panel2, "panel2");
this.panel2.Name = "panel2"; this.panel2.Name = "panel2";
// //
// btnOK // btnOK

File diff suppressed because it is too large Load Diff

View File

@@ -121,6 +121,18 @@
<value>取消(&amp;C)</value> <value>取消(&amp;C)</value>
</data> </data>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /> <assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="tabControl1.Size" type="System.Drawing.Size, System.Drawing">
<value>662, 469</value>
</data>
<data name="tabPage1.Size" type="System.Drawing.Size, System.Drawing">
<value>654, 443</value>
</data>
<data name="tabPage1.Text" xml:space="preserve">
<value> Core:基础设置 </value>
</data>
<data name="groupBox1.Size" type="System.Drawing.Size, System.Drawing">
<value>648, 437</value>
</data>
<data name="label16.Size" type="System.Drawing.Size, System.Drawing"> <data name="label16.Size" type="System.Drawing.Size, System.Drawing">
<value>53, 12</value> <value>53, 12</value>
</data> </data>
@@ -145,15 +157,6 @@
<data name="chkdefAllowInsecure.Text" xml:space="preserve"> <data name="chkdefAllowInsecure.Text" xml:space="preserve">
<value>传输层安全选tls时默认跳过证书验证(allowInsecure)</value> <value>传输层安全选tls时默认跳过证书验证(allowInsecure)</value>
</data> </data>
<data name="chksniffingEnabled2.Location" type="System.Drawing.Point, System.Drawing">
<value>468, 117</value>
</data>
<data name="chksniffingEnabled2.Size" type="System.Drawing.Size, System.Drawing">
<value>96, 16</value>
</data>
<data name="chksniffingEnabled2.Text" xml:space="preserve">
<value>开启流量探测</value>
</data>
<data name="chkAllowLANConn.Size" type="System.Drawing.Size, System.Drawing"> <data name="chkAllowLANConn.Size" type="System.Drawing.Size, System.Drawing">
<value>144, 16</value> <value>144, 16</value>
</data> </data>
@@ -175,39 +178,6 @@
<data name="chkmuxEnabled.Text" xml:space="preserve"> <data name="chkmuxEnabled.Text" xml:space="preserve">
<value>开启Mux多路复用</value> <value>开启Mux多路复用</value>
</data> </data>
<data name="chkAllowIn2.Location" type="System.Drawing.Point, System.Drawing">
<value>15, 120</value>
</data>
<data name="chkAllowIn2.Size" type="System.Drawing.Size, System.Drawing">
<value>102, 16</value>
</data>
<data name="chkAllowIn2.Text" xml:space="preserve">
<value>本地监听端口2</value>
</data>
<data name="chkudpEnabled2.Location" type="System.Drawing.Point, System.Drawing">
<value>369, 119</value>
</data>
<data name="chkudpEnabled2.Size" type="System.Drawing.Size, System.Drawing">
<value>66, 16</value>
</data>
<data name="chkudpEnabled2.Text" xml:space="preserve">
<value>开启UDP</value>
</data>
<data name="cmbprotocol2.Location" type="System.Drawing.Point, System.Drawing">
<value>257, 117</value>
</data>
<data name="label3.Location" type="System.Drawing.Point, System.Drawing">
<value>206, 121</value>
</data>
<data name="label3.Size" type="System.Drawing.Size, System.Drawing">
<value>29, 12</value>
</data>
<data name="label3.Text" xml:space="preserve">
<value>协议</value>
</data>
<data name="txtlocalPort2.Location" type="System.Drawing.Point, System.Drawing">
<value>124, 117</value>
</data>
<data name="label1.Location" type="System.Drawing.Point, System.Drawing"> <data name="label1.Location" type="System.Drawing.Point, System.Drawing">
<value>219, 29</value> <value>219, 29</value>
</data> </data>
@@ -250,14 +220,11 @@
<data name="label2.Text" xml:space="preserve"> <data name="label2.Text" xml:space="preserve">
<value>本地监听端口</value> <value>本地监听端口</value>
</data> </data>
<data name="groupBox1.Size" type="System.Drawing.Size, System.Drawing"> <data name="tabPage2.Size" type="System.Drawing.Size, System.Drawing">
<value>648, 437</value>
</data>
<data name="tabPage1.Size" type="System.Drawing.Size, System.Drawing">
<value>654, 443</value> <value>654, 443</value>
</data> </data>
<data name="tabPage1.Text" xml:space="preserve"> <data name="tabPage2.Text" xml:space="preserve">
<value> Core:基础设置 </value> <value> Core:DNS设置 </value>
</data> </data>
<data name="linkDnsObjectDoc.Size" type="System.Drawing.Size, System.Drawing"> <data name="linkDnsObjectDoc.Size" type="System.Drawing.Size, System.Drawing">
<value>161, 12</value> <value>161, 12</value>
@@ -271,18 +238,18 @@
<data name="label14.Text" xml:space="preserve"> <data name="label14.Text" xml:space="preserve">
<value>自定义DNS(可多个,用逗号(,)隔开)</value> <value>自定义DNS(可多个,用逗号(,)隔开)</value>
</data> </data>
<data name="tabPage2.Size" type="System.Drawing.Size, System.Drawing">
<value>654, 443</value>
</data>
<data name="tabPage2.Text" xml:space="preserve">
<value> Core:DNS设置 </value>
</data>
<data name="tabPage6.Size" type="System.Drawing.Size, System.Drawing"> <data name="tabPage6.Size" type="System.Drawing.Size, System.Drawing">
<value>654, 443</value> <value>654, 443</value>
</data> </data>
<data name="tabPage6.Text" xml:space="preserve"> <data name="tabPage6.Text" xml:space="preserve">
<value> Core:KCP设置 </value> <value> Core:KCP设置 </value>
</data> </data>
<data name="tabPage7.Size" type="System.Drawing.Size, System.Drawing">
<value>654, 443</value>
</data>
<data name="tabPage7.Text" xml:space="preserve">
<value> v2rayN设置 </value>
</data>
<data name="chkEnableSecurityProtocolTls13.Text" xml:space="preserve"> <data name="chkEnableSecurityProtocolTls13.Text" xml:space="preserve">
<value>启用安全协议TLS v1.3 (订阅/检查更新/测速)</value> <value>启用安全协议TLS v1.3 (订阅/检查更新/测速)</value>
</data> </data>
@@ -296,13 +263,13 @@
<value>解除Windows10 UWP应用回环代理限制</value> <value>解除Windows10 UWP应用回环代理限制</value>
</data> </data>
<data name="txtautoUpdateInterval.Location" type="System.Drawing.Point, System.Drawing"> <data name="txtautoUpdateInterval.Location" type="System.Drawing.Point, System.Drawing">
<value>255, 156</value> <value>274, 134</value>
</data> </data>
<data name="label15.Size" type="System.Drawing.Size, System.Drawing"> <data name="label15.Size" type="System.Drawing.Size, System.Drawing">
<value>191, 12</value> <value>227, 12</value>
</data> </data>
<data name="label15.Text" xml:space="preserve"> <data name="label15.Text" xml:space="preserve">
<value>自动更新Geo文件的间隔(单位小时)</value> <value>自动更新订阅和Geo文件的间隔(单位小时)</value>
</data> </data>
<data name="chkIgnoreGeoUpdateCore.Size" type="System.Drawing.Size, System.Drawing"> <data name="chkIgnoreGeoUpdateCore.Size" type="System.Drawing.Size, System.Drawing">
<value>150, 16</value> <value>150, 16</value>
@@ -334,18 +301,24 @@
<data name="chkAutoRun.Text" xml:space="preserve"> <data name="chkAutoRun.Text" xml:space="preserve">
<value>开机自动启动(可能会不成功)</value> <value>开机自动启动(可能会不成功)</value>
</data> </data>
<data name="tabPage7.Size" type="System.Drawing.Size, System.Drawing">
<value>654, 443</value>
</data>
<data name="tabPage7.Text" xml:space="preserve">
<value> v2rayN设置 </value>
</data>
<data name="tabPageCoreType.Size" type="System.Drawing.Size, System.Drawing"> <data name="tabPageCoreType.Size" type="System.Drawing.Size, System.Drawing">
<value>654, 443</value> <value>654, 443</value>
</data> </data>
<data name="tabPageCoreType.Text" xml:space="preserve"> <data name="tabPageCoreType.Text" xml:space="preserve">
<value> Core类型设置 </value> <value> Core类型设置 </value>
</data> </data>
<data name="tabPage3.Size" type="System.Drawing.Size, System.Drawing">
<value>654, 443</value>
</data>
<data name="tabPage3.Text" xml:space="preserve">
<value> 系统代理设置 </value>
</data>
<data name="groupBox2.Size" type="System.Drawing.Size, System.Drawing">
<value>654, 443</value>
</data>
<data name="groupBox2.Text" xml:space="preserve">
<value>例外</value>
</data>
<data name="label13.Size" type="System.Drawing.Size, System.Drawing"> <data name="label13.Size" type="System.Drawing.Size, System.Drawing">
<value>95, 12</value> <value>95, 12</value>
</data> </data>
@@ -358,30 +331,15 @@
<data name="label12.Text" xml:space="preserve"> <data name="label12.Text" xml:space="preserve">
<value>对于下列字符开头的地址不使用代理服务器:</value> <value>对于下列字符开头的地址不使用代理服务器:</value>
</data> </data>
<data name="groupBox2.Size" type="System.Drawing.Size, System.Drawing">
<value>654, 443</value>
</data>
<data name="groupBox2.Text" xml:space="preserve">
<value>例外</value>
</data>
<data name="tabPage3.Size" type="System.Drawing.Size, System.Drawing">
<value>654, 443</value>
</data>
<data name="tabPage3.Text" xml:space="preserve">
<value> 系统代理设置 </value>
</data>
<data name="tabControl1.Size" type="System.Drawing.Size, System.Drawing">
<value>662, 469</value>
</data>
<data name="btnOK.Text" xml:space="preserve">
<value>确定(&amp;O)</value>
</data>
<data name="panel2.Location" type="System.Drawing.Point, System.Drawing"> <data name="panel2.Location" type="System.Drawing.Point, System.Drawing">
<value>0, 479</value> <value>0, 479</value>
</data> </data>
<data name="panel2.Size" type="System.Drawing.Size, System.Drawing"> <data name="panel2.Size" type="System.Drawing.Size, System.Drawing">
<value>662, 60</value> <value>662, 60</value>
</data> </data>
<data name="btnOK.Text" xml:space="preserve">
<value>确定(&amp;O)</value>
</data>
<data name="panel1.Size" type="System.Drawing.Size, System.Drawing"> <data name="panel1.Size" type="System.Drawing.Size, System.Drawing">
<value>662, 10</value> <value>662, 10</value>
</data> </data>

View File

@@ -1,5 +1,6 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Threading.Tasks;
using System.Windows.Forms; using System.Windows.Forms;
using v2rayN.Base; using v2rayN.Base;
using v2rayN.Handler; using v2rayN.Handler;
@@ -345,13 +346,17 @@ namespace v2rayN.Forms
UI.Show(ResUI.MsgNeedUrl); UI.Show(ResUI.MsgNeedUrl);
return; return;
} }
Task.Run(async () =>
{
DownloadHandle downloadHandle = new DownloadHandle(); DownloadHandle downloadHandle = new DownloadHandle();
string clipboardData = downloadHandle.WebDownloadStringSync(url); string result = await downloadHandle.DownloadStringAsync(url, false, "");
if (AddBatchRoutingRules(ref routingItem, clipboardData) == 0) if (AddBatchRoutingRules(ref routingItem, result) == 0)
{ {
RefreshRoutingsView(); RefreshRoutingsView();
UI.Show(ResUI.OperationSuccess); UI.Show(ResUI.OperationSuccess);
} }
});
} }
private int AddBatchRoutingRules(ref RoutingItem routingItem, string clipboardData) private int AddBatchRoutingRules(ref RoutingItem routingItem, string clipboardData)
{ {
@@ -363,8 +368,6 @@ namespace v2rayN.Forms
return ConfigHandler.AddBatchRoutingRules(ref routingItem, clipboardData, blReplace); return ConfigHandler.AddBatchRoutingRules(ref routingItem, clipboardData, blReplace);
} }
#endregion #endregion
} }

View File

@@ -15,7 +15,7 @@ namespace v2rayN.Handler
class ConfigHandler class ConfigHandler
{ {
private static string configRes = Global.ConfigFileName; private static string configRes = Global.ConfigFileName;
private static object objLock = new object(); private static readonly object objLock = new object();
#region ConfigHandler #region ConfigHandler

View File

@@ -1,7 +1,12 @@
using System; using System;
using System.Diagnostics;
using System.IO; using System.IO;
using System.Net; using System.Net;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text; using System.Text;
using System.Threading;
using System.Threading.Tasks;
using v2rayN.Base; using v2rayN.Base;
using v2rayN.Resx; using v2rayN.Resx;
@@ -29,32 +34,71 @@ namespace v2rayN.Handler
} }
} }
private int progressPercentage = -1; public async Task<int> DownloadDataAsync(string url, WebProxy webProxy, int downloadTimeout)
private long totalBytesToReceive = 0; {
private DateTime totalDatetime = new DateTime(); try
private int DownloadTimeout = -1; {
Utils.SetSecurityProtocol(LazyConfig.Instance.GetConfig().enableSecurityProtocolTls13);
public WebClientEx DownloadFileAsync(string url, WebProxy webProxy, int downloadTimeout) UpdateCompleted?.Invoke(this, new ResultEventArgs(false, ResUI.Speedtesting));
var client = new HttpClient(new WebRequestHandler()
{
Proxy = webProxy
});
var progress = new Progress<double>();
progress.ProgressChanged += (sender, value) =>
{
if (UpdateCompleted != null)
{
string msg = string.Format("{0} M/s", value.ToString("#0.0")).PadLeft(9, ' ');
UpdateCompleted(this, new ResultEventArgs(false, msg));
}
};
var cancellationToken = new CancellationTokenSource();
cancellationToken.CancelAfter(downloadTimeout * 1000);
await HttpClientHelper.GetInstance().DownloadDataAsync4Speed(client,
url,
progress,
cancellationToken.Token);
}
catch (Exception ex)
{
//Utils.SaveLog(ex.Message, ex);
Error?.Invoke(this, new ErrorEventArgs(ex));
}
return 0;
}
public void DownloadFileAsync(string url, bool blProxy, int downloadTimeout)
{ {
WebClientEx ws = new WebClientEx();
try try
{ {
Utils.SetSecurityProtocol(LazyConfig.Instance.GetConfig().enableSecurityProtocolTls13); Utils.SetSecurityProtocol(LazyConfig.Instance.GetConfig().enableSecurityProtocolTls13);
UpdateCompleted?.Invoke(this, new ResultEventArgs(false, ResUI.Downloading)); UpdateCompleted?.Invoke(this, new ResultEventArgs(false, ResUI.Downloading));
progressPercentage = -1; var client = new HttpClient(new WebRequestHandler()
totalBytesToReceive = 0;
//WebClientEx ws = new WebClientEx();
DownloadTimeout = downloadTimeout;
if (webProxy != null)
{ {
ws.Proxy = webProxy;// new WebProxy(Global.Loopback, Global.httpPort); Proxy = GetWebProxy(blProxy)
} });
ws.DownloadFileCompleted += ws_DownloadFileCompleted; var progress = new Progress<double>();
ws.DownloadProgressChanged += ws_DownloadProgressChanged; progress.ProgressChanged += (sender, value) =>
ws.DownloadFileAsync(new Uri(url), Utils.GetPath(Utils.GetDownloadFileName(url))); {
if (UpdateCompleted != null)
{
string msg = string.Format("...{0}%", value);
UpdateCompleted(this, new ResultEventArgs(value > 100 ? true : false, msg));
}
};
var cancellationToken = new CancellationTokenSource();
_ = HttpClientHelper.GetInstance().DownloadFileAsync(client,
url,
Utils.GetPath(Utils.GetDownloadFileName(url)),
progress,
cancellationToken.Token);
} }
catch (Exception ex) catch (Exception ex)
{ {
@@ -62,70 +106,27 @@ namespace v2rayN.Handler
Error?.Invoke(this, new ErrorEventArgs(ex)); Error?.Invoke(this, new ErrorEventArgs(ex));
} }
return ws;
} }
void ws_DownloadProgressChanged(object sender, DownloadProgressChangedEventArgs e) public async Task<string> UrlRedirectAsync(string url, bool blProxy)
{ {
if (UpdateCompleted != null) Utils.SetSecurityProtocol(LazyConfig.Instance.GetConfig().enableSecurityProtocolTls13);
WebRequestHandler webRequestHandler = new WebRequestHandler
{ {
if (totalBytesToReceive == 0) AllowAutoRedirect = false,
{ Proxy = GetWebProxy(blProxy)
totalDatetime = DateTime.Now; };
totalBytesToReceive = e.BytesReceived; HttpClient client = new HttpClient(webRequestHandler);
return;
}
totalBytesToReceive = e.BytesReceived;
if (DownloadTimeout != -1) HttpResponseMessage response = await client.GetAsync(url);
if (response.StatusCode.ToString() == "Redirect")
{ {
if ((DateTime.Now - totalDatetime).TotalSeconds > DownloadTimeout) return response.Headers.Location.ToString();
{
((WebClientEx)sender).CancelAsync();
}
}
if (progressPercentage != e.ProgressPercentage && e.ProgressPercentage % 10 == 0)
{
progressPercentage = e.ProgressPercentage;
string msg = string.Format("...{0}%", e.ProgressPercentage);
UpdateCompleted(this, new ResultEventArgs(false, msg));
}
}
}
void ws_DownloadFileCompleted(object sender, System.ComponentModel.AsyncCompletedEventArgs e)
{
try
{
if (UpdateCompleted != null)
{
if (e.Cancelled)
{
((WebClientEx)sender).Dispose();
TimeSpan ts = (DateTime.Now - totalDatetime);
string speed = string.Format("{0} M/s", (totalBytesToReceive / ts.TotalMilliseconds / 1000).ToString("#0.0"));
UpdateCompleted(this, new ResultEventArgs(true, speed.PadLeft(8, ' ')));
return;
}
if (e.Error == null
|| Utils.IsNullOrEmpty(e.Error.ToString()))
{
((WebClientEx)sender).Dispose();
TimeSpan ts = (DateTime.Now - totalDatetime);
string speed = string.Format("{0} M/s", (totalBytesToReceive / ts.TotalMilliseconds / 1000).ToString("#0.0"));
UpdateCompleted(this, new ResultEventArgs(true, speed.PadLeft(8, ' ')));
} }
else else
{ {
throw e.Error; Utils.SaveLog("StatusCode error: " + url);
} return null;
}
}
catch (Exception ex)
{
Utils.SaveLog(ex.Message, ex);
Error?.Invoke(this, new ErrorEventArgs(ex));
} }
} }
@@ -133,111 +134,117 @@ namespace v2rayN.Handler
/// DownloadString /// DownloadString
/// </summary> /// </summary>
/// <param name="url"></param> /// <param name="url"></param>
public void WebDownloadString(string url, WebProxy webProxy, string userAgent) public async Task<string> DownloadStringAsync(string url, bool blProxy, string userAgent)
{ {
string source = string.Empty;
try try
{ {
Utils.SetSecurityProtocol(LazyConfig.Instance.GetConfig().enableSecurityProtocolTls13); Utils.SetSecurityProtocol(LazyConfig.Instance.GetConfig().enableSecurityProtocolTls13);
var client = new HttpClient(new WebRequestHandler()
WebClientEx ws = new WebClientEx();
ws.Encoding = Encoding.UTF8;
if (webProxy != null)
{ {
ws.Proxy = webProxy; Proxy = GetWebProxy(blProxy)
} });
if (Utils.IsNullOrEmpty(userAgent)) if (Utils.IsNullOrEmpty(userAgent))
{ {
userAgent = $"{Utils.GetVersion(false)}"; userAgent = $"{Utils.GetVersion(false)}";
} }
ws.Headers.Add("user-agent", userAgent); client.DefaultRequestHeaders.UserAgent.TryParseAdd(userAgent);
Uri uri = new Uri(url); Uri uri = new Uri(url);
//Authorization Header //Authorization Header
if (!Utils.IsNullOrEmpty(uri.UserInfo)) if (!Utils.IsNullOrEmpty(uri.UserInfo))
{ {
ws.Headers.Add(HttpRequestHeader.Authorization, "Basic " + Utils.Base64Encode(uri.UserInfo)); client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", Utils.Base64Encode(uri.UserInfo));
} }
var result = await HttpClientHelper.GetInstance().GetAsync(client, url);
ws.DownloadStringCompleted += Ws_DownloadStringCompleted; return result;
ws.DownloadStringAsync(uri);
} }
catch (Exception ex) catch (Exception ex)
{ {
Utils.SaveLog(ex.Message, ex); Utils.SaveLog(ex.Message, ex);
} }
return null;
} }
private void Ws_DownloadStringCompleted(object sender, DownloadStringCompletedEventArgs e) public int RunAvailabilityCheck(WebProxy webProxy)
{ {
try try
{ {
if (e.Error == null if (webProxy == null)
|| Utils.IsNullOrEmpty(e.Error.ToString()))
{ {
string source = e.Result; var httpPort = LazyConfig.Instance.GetConfig().GetLocalPort(Global.InboundHttp2);
UpdateCompleted?.Invoke(this, new ResultEventArgs(true, source)); webProxy = new WebProxy(Global.Loopback, httpPort);
}
else
{
throw e.Error;
}
}
catch (Exception ex)
{
Utils.SaveLog(ex.Message, ex);
Error?.Invoke(this, new ErrorEventArgs(ex));
}
} }
public string WebDownloadStringSync(string url) Task<int> t = Task.Run(() =>
{ {
string source = string.Empty;
try try
{ {
Utils.SetSecurityProtocol(LazyConfig.Instance.GetConfig().enableSecurityProtocolTls13); string status = GetRealPingTime(Global.SpeedPingTestUrl, webProxy, out int responseTime);
bool noError = Utils.IsNullOrEmpty(status);
WebClientEx ws = new WebClientEx(); return noError ? responseTime : -1;
ws.Encoding = Encoding.UTF8;
return ws.DownloadString(new Uri(url));
} }
catch (Exception ex) catch (Exception ex)
{ {
Utils.SaveLog(ex.Message, ex); Utils.SaveLog(ex.Message, ex);
return string.Empty; return -1;
}
});
return t.Result;
}
catch (Exception ex)
{
Utils.SaveLog(ex.Message, ex);
return -1;
} }
} }
public WebClientEx DownloadDataAsync(string url, WebProxy webProxy, int downloadTimeout) public string GetRealPingTime(string url, WebProxy webProxy, out int responseTime)
{ {
WebClientEx ws = new WebClientEx(); string msg = string.Empty;
responseTime = -1;
try try
{ {
Utils.SetSecurityProtocol(LazyConfig.Instance.GetConfig().enableSecurityProtocolTls13); HttpWebRequest myHttpWebRequest = (HttpWebRequest)WebRequest.Create(url);
UpdateCompleted?.Invoke(this, new ResultEventArgs(false, ResUI.Downloading)); myHttpWebRequest.Timeout = 5000;
myHttpWebRequest.Proxy = webProxy;
progressPercentage = -1; Stopwatch timer = new Stopwatch();
totalBytesToReceive = 0; timer.Start();
DownloadTimeout = downloadTimeout; HttpWebResponse myHttpWebResponse = (HttpWebResponse)myHttpWebRequest.GetResponse();
if (webProxy != null) if (myHttpWebResponse.StatusCode != HttpStatusCode.OK
&& myHttpWebResponse.StatusCode != HttpStatusCode.NoContent)
{ {
ws.Proxy = webProxy; msg = myHttpWebResponse.StatusDescription;
} }
timer.Stop();
responseTime = timer.Elapsed.Milliseconds;
ws.DownloadProgressChanged += ws_DownloadProgressChanged; myHttpWebResponse.Close();
ws.DownloadDataCompleted += ws_DownloadFileCompleted;
ws.DownloadDataAsync(new Uri(url));
} }
catch (Exception ex) catch (Exception ex)
{ {
Utils.SaveLog(ex.Message, ex); Utils.SaveLog(ex.Message, ex);
msg = ex.Message;
}
return msg;
}
Error?.Invoke(this, new ErrorEventArgs(ex)); private WebProxy GetWebProxy(bool blProxy)
{
if (!blProxy)
{
return null;
} }
return ws; var httpPort = LazyConfig.Instance.GetConfig().GetLocalPort(Global.InboundHttp2);
var webProxy = new WebProxy(Global.Loopback, httpPort);
if (RunAvailabilityCheck(webProxy) > 0)
{
return webProxy;
}
return null;
} }
} }
} }

View File

@@ -71,8 +71,8 @@ namespace v2rayN.Handler
coreType = ECoreType.v2fly, coreType = ECoreType.v2fly,
coreExes = new List<string> { "wv2ray", "v2ray" }, coreExes = new List<string> { "wv2ray", "v2ray" },
arguments = "", arguments = "",
coreUrl = Global.v2flyCoreUrl coreUrl = Global.v2flyCoreUrl,
match = "V2Ray"
}); });
coreInfos.Add(new CoreInfo coreInfos.Add(new CoreInfo
@@ -80,7 +80,8 @@ namespace v2rayN.Handler
coreType = ECoreType.Xray, coreType = ECoreType.Xray,
coreExes = new List<string> { "xray" }, coreExes = new List<string> { "xray" },
arguments = "", arguments = "",
coreUrl = Global.xrayCoreUrl coreUrl = Global.xrayCoreUrl,
match = "Xray"
}); });
coreInfos.Add(new CoreInfo coreInfos.Add(new CoreInfo

View File

@@ -218,6 +218,15 @@ namespace v2rayN.Handler
} }
Utils.SaveLog("UpdateTaskRun"); Utils.SaveLog("UpdateTaskRun");
updateHandle.UpdateSubscriptionProcess(config, true, (bool success, string msg) =>
{
update(success, msg);
if (success)
Utils.SaveLog("subscription" + msg);
});
Thread.Sleep(60000);
updateHandle.UpdateGeoFile("geosite", config, (bool success, string msg) => updateHandle.UpdateGeoFile("geosite", config, (bool success, string msg) =>
{ {
update(false, msg); update(false, msg);
@@ -225,8 +234,6 @@ namespace v2rayN.Handler
Utils.SaveLog("geosite" + msg); Utils.SaveLog("geosite" + msg);
}); });
Thread.Sleep(60000);
updateHandle.UpdateGeoFile("geoip", config, (bool success, string msg) => updateHandle.UpdateGeoFile("geoip", config, (bool success, string msg) =>
{ {
update(false, msg); update(false, msg);

View File

@@ -17,12 +17,12 @@ namespace v2rayN.Handler
private List<ServerTestItem> _selecteds; private List<ServerTestItem> _selecteds;
Action<string, string> _updateFunc; Action<string, string> _updateFunc;
public SpeedtestHandler(ref Config config) public SpeedtestHandler(Config config)
{ {
_config = config; _config = config;
} }
public SpeedtestHandler(ref Config config, V2rayHandler v2rayHandler, List<VmessItem> selecteds, ESpeedActionType actionType, Action<string, string> update) public SpeedtestHandler(Config config, V2rayHandler v2rayHandler, List<VmessItem> selecteds, ESpeedActionType actionType, Action<string, string> update)
{ {
_config = config; _config = config;
_v2rayHandler = v2rayHandler; _v2rayHandler = v2rayHandler;
@@ -55,7 +55,7 @@ namespace v2rayN.Handler
} }
else if (actionType == ESpeedActionType.Speedtest) else if (actionType == ESpeedActionType.Speedtest)
{ {
Task.Run(() => RunSpeedTest()); Task.Run(() => RunSpeedTestAsync());
} }
} }
@@ -71,7 +71,7 @@ namespace v2rayN.Handler
} }
try try
{ {
updateFun(it); Task.Run(() => updateFun(it));
} }
catch (Exception ex) catch (Exception ex)
{ {
@@ -122,6 +122,7 @@ namespace v2rayN.Handler
return; return;
} }
DownloadHandle downloadHandle = new DownloadHandle();
//Thread.Sleep(5000); //Thread.Sleep(5000);
List<Task> tasks = new List<Task>(); List<Task> tasks = new List<Task>();
foreach (var it in _selecteds) foreach (var it in _selecteds)
@@ -140,7 +141,7 @@ namespace v2rayN.Handler
{ {
WebProxy webProxy = new WebProxy(Global.Loopback, it.port); WebProxy webProxy = new WebProxy(Global.Loopback, it.port);
int responseTime = -1; int responseTime = -1;
string status = GetRealPingTime(_config.constItem.speedPingTestUrl, webProxy, out responseTime); string status = downloadHandle.GetRealPingTime(_config.constItem.speedPingTestUrl, webProxy, out responseTime);
string output = Utils.IsNullOrEmpty(status) ? FormatOut(responseTime, "ms") : status; string output = Utils.IsNullOrEmpty(status) ? FormatOut(responseTime, "ms") : status;
_config.GetVmessItem(it.indexId)?.SetTestResult(output); _config.GetVmessItem(it.indexId)?.SetTestResult(output);
@@ -165,38 +166,7 @@ namespace v2rayN.Handler
} }
} }
public int RunAvailabilityCheck() // alias: isLive private async Task RunSpeedTestAsync()
{
try
{
int httpPort = _config.GetLocalPort(Global.InboundHttp2);
Task<int> t = Task.Run(() =>
{
try
{
WebProxy webProxy = new WebProxy(Global.Loopback, httpPort);
int responseTime = -1;
string status = GetRealPingTime(Global.SpeedPingTestUrl, webProxy, out responseTime);
bool noError = Utils.IsNullOrEmpty(status);
return noError ? responseTime : -1;
}
catch (Exception ex)
{
Utils.SaveLog(ex.Message, ex);
return -1;
}
});
return t.Result;
}
catch (Exception ex)
{
Utils.SaveLog(ex.Message, ex);
return -1;
}
}
private void RunSpeedTest()
{ {
string testIndexId = string.Empty; string testIndexId = string.Empty;
int pid = -1; int pid = -1;
@@ -220,7 +190,7 @@ namespace v2rayN.Handler
_updateFunc(testIndexId, args.GetException().Message); _updateFunc(testIndexId, args.GetException().Message);
}; };
var timeout = 10; var timeout = 8;
foreach (var it in _selecteds) foreach (var it in _selecteds)
{ {
if (!it.allowTest) if (!it.allowTest)
@@ -235,15 +205,9 @@ namespace v2rayN.Handler
if (_config.FindIndexId(it.indexId) < 0) continue; if (_config.FindIndexId(it.indexId) < 0) continue;
WebProxy webProxy = new WebProxy(Global.Loopback, it.port); WebProxy webProxy = new WebProxy(Global.Loopback, it.port);
var ws = downloadHandle2.DownloadDataAsync(url, webProxy, timeout - 2); await downloadHandle2.DownloadDataAsync(url, webProxy, timeout);
Thread.Sleep(1000 * timeout);
ws.CancelAsync();
ws.Dispose();
Thread.Sleep(1000 * 2);
} }
if (pid > 0) _v2rayHandler.V2rayStopPid(pid); if (pid > 0) _v2rayHandler.V2rayStopPid(pid);
} }
@@ -282,37 +246,6 @@ namespace v2rayN.Handler
return responseTime; return responseTime;
} }
private string GetRealPingTime(string url, WebProxy webProxy, out int responseTime)
{
string msg = string.Empty;
responseTime = -1;
try
{
HttpWebRequest myHttpWebRequest = (HttpWebRequest)WebRequest.Create(url);
myHttpWebRequest.Timeout = 5000;
myHttpWebRequest.Proxy = webProxy;//new WebProxy(Global.Loopback, Global.httpPort);
Stopwatch timer = new Stopwatch();
timer.Start();
HttpWebResponse myHttpWebResponse = (HttpWebResponse)myHttpWebRequest.GetResponse();
if (myHttpWebResponse.StatusCode != HttpStatusCode.OK
&& myHttpWebResponse.StatusCode != HttpStatusCode.NoContent)
{
msg = myHttpWebResponse.StatusDescription;
}
timer.Stop();
responseTime = timer.Elapsed.Milliseconds;
myHttpWebResponse.Close();
}
catch (Exception ex)
{
Utils.SaveLog(ex.Message, ex);
msg = ex.Message;
}
return msg;
}
private string FormatOut(object time, string unit) private string FormatOut(object time, string unit)
{ {
if (time.ToString().Equals("-1")) if (time.ToString().Equals("-1"))

View File

@@ -1,10 +1,9 @@
using System; using System;
using System.Diagnostics; using System.Diagnostics;
using System.IO; using System.IO;
using System.Net;
using System.Net.Http;
using System.Text; using System.Text;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
using System.Threading.Tasks;
using System.Windows.Forms; using System.Windows.Forms;
using v2rayN.Base; using v2rayN.Base;
using v2rayN.Mode; using v2rayN.Mode;
@@ -177,67 +176,49 @@ namespace v2rayN.Handler
return; return;
} }
for (int k = 1; k <= config.subItem.Count; k++) Task.Run(async () =>
{ {
string id = config.subItem[k - 1].id.TrimEx(); foreach (var item in config.subItem)
string url = config.subItem[k - 1].url.TrimEx(); {
string userAgent = config.subItem[k - 1].userAgent.TrimEx(); if (item.enabled == false)
string groupId = config.subItem[k - 1].groupId.TrimEx();
string hashCode = $"{k}){config.subItem[k - 1].remarks}->";
if (config.subItem[k - 1].enabled == false)
{ {
continue; continue;
} }
string id = item.id.TrimEx();
string url = item.url.TrimEx();
string userAgent = item.userAgent.TrimEx();
string groupId = item.groupId.TrimEx();
string hashCode = $"{item.remarks}->";
if (Utils.IsNullOrEmpty(id) || Utils.IsNullOrEmpty(url)) if (Utils.IsNullOrEmpty(id) || Utils.IsNullOrEmpty(url))
{ {
_updateFunc(false, $"{hashCode}{ResUI.MsgNoValidSubscription}"); //_updateFunc(false, $"{hashCode}{ResUI.MsgNoValidSubscription}");
continue; continue;
} }
DownloadHandle downloadHandle3 = new DownloadHandle(); _updateFunc(false, $"{hashCode}{ResUI.MsgStartGettingSubscriptions}");
downloadHandle3.UpdateCompleted += (sender2, args) => var result = await (new DownloadHandle()).DownloadStringAsync(url, blProxy, userAgent);
{
if (args.Success)
{
_updateFunc(false, $"{hashCode}{ResUI.MsgGetSubscriptionSuccessfully}"); _updateFunc(false, $"{hashCode}{ResUI.MsgGetSubscriptionSuccessfully}");
//string result = Utils.Base64Decode(args.Msg);
string result = args.Msg;
if (Utils.IsNullOrEmpty(result)) if (Utils.IsNullOrEmpty(result))
{ {
_updateFunc(false, $"{hashCode}{ResUI.MsgSubscriptionDecodingFailed}"); _updateFunc(false, $"{hashCode}{ResUI.MsgSubscriptionDecodingFailed}");
return;
} }
else
//ConfigHandler.RemoveServerViaSubid(ref config, id); {
//_updateFunc(false, $"{hashCode}{ResUI.MsgClearSubscription")}");
// RefreshServers();
int ret = ConfigHandler.AddBatchServers(ref config, result, id, groupId); int ret = ConfigHandler.AddBatchServers(ref config, result, id, groupId);
if (ret > 0) if (ret > 0)
{ {
// RefreshServers(); _updateFunc(false, $"{hashCode}{ResUI.MsgUpdateSubscriptionEnd}");
} }
else else
{ {
_updateFunc(false, $"{hashCode}{ResUI.MsgFailedImportSubscription}"); _updateFunc(false, $"{hashCode}{ResUI.MsgFailedImportSubscription}");
} }
_updateFunc(true, $"{hashCode}{ResUI.MsgUpdateSubscriptionEnd}");
} }
else _updateFunc(false, $"-------------------------------------------------------");
{
_updateFunc(false, args.Msg);
} }
}; _updateFunc(true, $"{ResUI.MsgUpdateSubscriptionEnd}");
downloadHandle3.Error += (sender2, args) => });
{
_updateFunc(false, args.GetException().Message);
};
WebProxy webProxy = blProxy ? new WebProxy(Global.Loopback, _config.GetLocalPort(Global.InboundHttp2)) : null;
downloadHandle3.WebDownloadString(url, webProxy, userAgent);
_updateFunc(false, $"{hashCode}{ResUI.MsgStartGettingSubscriptions}");
}
} }
@@ -269,7 +250,7 @@ namespace v2rayN.Handler
File.Delete(targetPath); File.Delete(targetPath);
} }
File.Move(fileName, targetPath); File.Move(fileName, targetPath);
_updateFunc(true, ""); //_updateFunc(true, "");
} }
} }
catch (Exception ex) catch (Exception ex)
@@ -287,8 +268,8 @@ namespace v2rayN.Handler
_updateFunc(false, args.GetException().Message); _updateFunc(false, args.GetException().Message);
}; };
} }
askToDownload(downloadHandle, url, false); askToDownload(downloadHandle, url, false);
} }
#region private #region private
@@ -297,19 +278,6 @@ namespace v2rayN.Handler
{ {
try try
{ {
Utils.SetSecurityProtocol(LazyConfig.Instance.GetConfig().enableSecurityProtocolTls13);
WebRequestHandler webRequestHandler = new WebRequestHandler
{
AllowAutoRedirect = false
};
if (httpProxyTest() > 0)
{
int httpPort = _config.GetLocalPort(Global.InboundHttp2);
WebProxy webProxy = new WebProxy(Global.Loopback, httpPort);
webRequestHandler.Proxy = webProxy;
}
HttpClient httpClient = new HttpClient(webRequestHandler);
string url; string url;
if (type == ECoreType.v2fly) if (type == ECoreType.v2fly)
{ {
@@ -327,10 +295,11 @@ namespace v2rayN.Handler
{ {
throw new ArgumentException("Type"); throw new ArgumentException("Type");
} }
HttpResponseMessage response = await httpClient.GetAsync(url);
if (response.StatusCode.ToString() == "Redirect") var result = await (new DownloadHandle()).UrlRedirectAsync(url, true);
if (!Utils.IsNullOrEmpty(result))
{ {
responseHandler(type, response.Headers.Location.ToString()); responseHandler(type, result);
} }
else else
{ {
@@ -352,19 +321,20 @@ namespace v2rayN.Handler
{ {
try try
{ {
var core = string.Empty;
var match = string.Empty; var coreInfo = LazyConfig.Instance.GetCoreInfo(type);
if (type == ECoreType.v2fly) string filePath = string.Empty;
foreach (string name in coreInfo.coreExes)
{ {
core = "v2ray.exe"; string vName = string.Format("{0}.exe", name);
match = "V2Ray"; vName = Utils.GetPath(vName);
} if (File.Exists(vName))
else if (type == ECoreType.Xray)
{ {
core = "xray.exe"; filePath = vName;
match = "Xray"; break;
} }
string filePath = Utils.GetPath(core); }
if (!File.Exists(filePath)) if (!File.Exists(filePath))
{ {
string msg = string.Format(ResUI.NotFoundCore, @""); string msg = string.Format(ResUI.NotFoundCore, @"");
@@ -383,7 +353,7 @@ namespace v2rayN.Handler
p.Start(); p.Start();
p.WaitForExit(5000); p.WaitForExit(5000);
string echo = p.StandardOutput.ReadToEnd(); string echo = p.StandardOutput.ReadToEnd();
string version = Regex.Match(echo, $"{match} ([0-9.]+) \\(").Groups[1].Value; string version = Regex.Match(echo, $"{coreInfo.match} ([0-9.]+) \\(").Groups[1].Value;
return version; return version;
} }
catch (Exception ex) catch (Exception ex)
@@ -458,23 +428,8 @@ namespace v2rayN.Handler
} }
if (blDownload) if (blDownload)
{ {
if (httpProxyTest() > 0) downloadHandle.DownloadFileAsync(url, true, 600);
{
int httpPort = _config.GetLocalPort(Global.InboundHttp2);
WebProxy webProxy = new WebProxy(Global.Loopback, httpPort);
downloadHandle.DownloadFileAsync(url, webProxy, 600);
} }
else
{
downloadHandle.DownloadFileAsync(url, null, 600);
}
}
}
private int httpProxyTest()
{
SpeedtestHandler statistics = new SpeedtestHandler(ref _config);
return statistics.RunAvailabilityCheck();
} }
#endregion #endregion
} }

View File

@@ -957,7 +957,7 @@ namespace v2rayN.Handler
case ECoreType.Xray: case ECoreType.Xray:
break; break;
case ECoreType.clash: case ECoreType.clash:
fileContent.Add($"port: {LazyConfig.Instance.GetConfig().GetLocalPort(Global.InboundHttp)}"); fileContent.Add($"port: {LazyConfig.Instance.GetConfig().GetLocalPort(Global.InboundHttp2)}");
fileContent.Add($"socks-port: {LazyConfig.Instance.GetConfig().GetLocalPort(Global.InboundSocks)}"); fileContent.Add($"socks-port: {LazyConfig.Instance.GetConfig().GetLocalPort(Global.InboundSocks)}");
break; break;
} }

View File

@@ -109,6 +109,10 @@ namespace v2rayN.Handler
} }
else else
{ {
if (coreInfo == null || coreInfo.coreExes == null)
{
return;
}
foreach (string vName in coreInfo.coreExes) foreach (string vName in coreInfo.coreExes)
{ {
Process[] existing = Process.GetProcessesByName(vName); Process[] existing = Process.GetProcessesByName(vName);

View File

@@ -341,19 +341,31 @@ namespace v2rayN.Mode
{ {
return subRemarks; return subRemarks;
} }
foreach (SubItem sub in config.subItem)
{
if (sub.id.EndsWith(subid))
{
return sub.remarks;
}
}
if (subid.Length <= 4) if (subid.Length <= 4)
{ {
return subid; return subid;
} }
var sub = config.subItem.FirstOrDefault(t => t.id == subid);
if (sub != null)
{
return sub.remarks;
}
return subid.Substring(0, 4); return subid.Substring(0, 4);
} }
public string GetGroupRemarks(Config config)
{
string subRemarks = string.Empty;
if (Utils.IsNullOrEmpty(groupId))
{
return subRemarks;
}
var group = config.groupItem.FirstOrDefault(t => t.id == groupId);
if (group != null)
{
return group.remarks;
}
return groupId.Substring(0, 4);
}
public List<string> GetAlpn() public List<string> GetAlpn()
{ {
@@ -763,6 +775,10 @@ namespace v2rayN.Mode
{ {
get; set; get; set;
} }
public int sort
{
get; set;
}
} }

View File

@@ -13,5 +13,7 @@ namespace v2rayN.Mode
public string arguments { get; set; } public string arguments { get; set; }
public string coreUrl { get; set; } public string coreUrl { get; set; }
public string match { get; set; }
} }
} }

View File

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

View File

@@ -619,7 +619,7 @@ namespace v2rayN.Resx {
} }
/// <summary> /// <summary>
/// 查找类似 Failed to get subscription content 的本地化字符串。 /// 查找类似 Invalid subscription content 的本地化字符串。
/// </summary> /// </summary>
internal static string MsgSubscriptionDecodingFailed { internal static string MsgSubscriptionDecodingFailed {
get { get {
@@ -879,6 +879,15 @@ namespace v2rayN.Resx {
} }
} }
/// <summary>
/// 查找类似 Speed Test... 的本地化字符串。
/// </summary>
internal static string Speedtesting {
get {
return ResourceManager.GetString("Speedtesting", resourceCulture);
}
}
/// <summary> /// <summary>
/// 查找类似 PAC failed to start. Run it with Admin right. 的本地化字符串。 /// 查找类似 PAC failed to start. Run it with Admin right. 的本地化字符串。
/// </summary> /// </summary>
@@ -952,6 +961,15 @@ namespace v2rayN.Resx {
} }
} }
/// <summary>
/// 查找类似 Too many servers, please open the main interface 的本地化字符串。
/// </summary>
internal static string TooManyServersTip {
get {
return ResourceManager.GetString("TooManyServersTip", resourceCulture);
}
}
/// <summary> /// <summary>
/// 查找类似 *tcp camouflage type 的本地化字符串。 /// 查找类似 *tcp camouflage type 的本地化字符串。
/// </summary> /// </summary>

View File

@@ -268,7 +268,7 @@
<value>Start updating PAC...</value> <value>Start updating PAC...</value>
</data> </data>
<data name="MsgSubscriptionDecodingFailed" xml:space="preserve"> <data name="MsgSubscriptionDecodingFailed" xml:space="preserve">
<value>Failed to get subscription content</value> <value>Invalid subscription content</value>
</data> </data>
<data name="MsgUnpacking" xml:space="preserve"> <data name="MsgUnpacking" xml:space="preserve">
<value>is unpacking...</value> <value>is unpacking...</value>
@@ -457,4 +457,10 @@
<data name="SystemProxy" xml:space="preserve"> <data name="SystemProxy" xml:space="preserve">
<value>System proxy</value> <value>System proxy</value>
</data> </data>
<data name="Speedtesting" xml:space="preserve">
<value>Speed Test...</value>
</data>
<data name="TooManyServersTip" xml:space="preserve">
<value>Too many servers, please open the main interface</value>
</data>
</root> </root>

View File

@@ -268,7 +268,7 @@
<value>开始更新 PAC...</value> <value>开始更新 PAC...</value>
</data> </data>
<data name="MsgSubscriptionDecodingFailed" xml:space="preserve"> <data name="MsgSubscriptionDecodingFailed" xml:space="preserve">
<value>订阅内容获取失败</value> <value>无效的订阅内容</value>
</data> </data>
<data name="MsgUnpacking" xml:space="preserve"> <data name="MsgUnpacking" xml:space="preserve">
<value>正在解压......</value> <value>正在解压......</value>
@@ -457,4 +457,10 @@
<data name="SystemProxy" xml:space="preserve"> <data name="SystemProxy" xml:space="preserve">
<value>系统代理</value> <value>系统代理</value>
</data> </data>
<data name="Speedtesting" xml:space="preserve">
<value>测速中...</value>
</data>
<data name="TooManyServersTip" xml:space="preserve">
<value>服务器太多,请打开主界面操作</value>
</data>
</root> </root>

View File

@@ -33,7 +33,7 @@ namespace v2rayN.Tool
memory.ActivateOptions(); memory.ActivateOptions();
hierarchy.Root.AddAppender(memory); hierarchy.Root.AddAppender(memory);
hierarchy.Root.Level = Level.Info; hierarchy.Root.Level = Level.Debug;
hierarchy.Configured = true; hierarchy.Configured = true;
} }

View File

@@ -753,16 +753,11 @@ namespace v2rayN
{ {
if (enableSecurityProtocolTls13) if (enableSecurityProtocolTls13)
{ {
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls ServicePointManager.SecurityProtocol |= SecurityProtocolType.Tls12 | SecurityProtocolType.Tls13;
| SecurityProtocolType.Tls11
| SecurityProtocolType.Tls12
| SecurityProtocolType.Tls13;
} }
else else
{ {
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls ServicePointManager.SecurityProtocol |= SecurityProtocolType.Tls12;
| SecurityProtocolType.Tls11
| SecurityProtocolType.Tls12;
} }
ServicePointManager.DefaultConnectionLimit = 256; ServicePointManager.DefaultConnectionLimit = 256;
} }

View File

@@ -99,6 +99,7 @@
<Reference Include="System.Xml" /> <Reference Include="System.Xml" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="Base\HttpClientHelper.cs" />
<Compile Include="Base\ListViewFlickerFree.cs"> <Compile Include="Base\ListViewFlickerFree.cs">
<SubType>Component</SubType> <SubType>Component</SubType>
</Compile> </Compile>
@@ -195,9 +196,6 @@
<Compile Include="Handler\StatisticsHandler.cs" /> <Compile Include="Handler\StatisticsHandler.cs" />
<Compile Include="Handler\DownloadHandle.cs" /> <Compile Include="Handler\DownloadHandle.cs" />
<Compile Include="Handler\ProxySetting.cs" /> <Compile Include="Handler\ProxySetting.cs" />
<Compile Include="Base\WebClientEx.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="Handler\SysProxyHandle.cs" /> <Compile Include="Handler\SysProxyHandle.cs" />
<Compile Include="Mode\ESpeedActionType.cs" /> <Compile Include="Mode\ESpeedActionType.cs" />
<Compile Include="Mode\EGlobalHotkey.cs" /> <Compile Include="Mode\EGlobalHotkey.cs" />
@@ -474,13 +472,13 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Google.Protobuf"> <PackageReference Include="Google.Protobuf">
<Version>3.19.4</Version> <Version>3.20.0</Version>
</PackageReference> </PackageReference>
<PackageReference Include="Grpc.Core"> <PackageReference Include="Grpc.Core">
<Version>2.44.0</Version> <Version>2.45.0</Version>
</PackageReference> </PackageReference>
<PackageReference Include="Grpc.Tools"> <PackageReference Include="Grpc.Tools">
<Version>2.44.0</Version> <Version>2.45.0</Version>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets> <PrivateAssets>all</PrivateAssets>
</PackageReference> </PackageReference>