mirror of
https://github.com/2dust/v2rayN.git
synced 2025-05-02 21:28:51 +00:00
Improve test
This commit is contained in:
parent
73c79ca7bf
commit
38c739c45d
6 changed files with 35 additions and 23 deletions
|
@ -767,8 +767,8 @@ namespace v2rayN.Forms
|
||||||
|
|
||||||
private void tsbTestMe_Click(object sender, EventArgs e)
|
private void tsbTestMe_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
string result = (new DownloadHandle()).RunAvailabilityCheck(null) + "ms";
|
var updateHandle = new UpdateHandle();
|
||||||
AppendText(false, string.Format(ResUI.TestMeOutput, result));
|
updateHandle.RunAvailabilityCheck(UpdateTaskHandler);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void menuClearStatistic_Click(object sender, EventArgs e)
|
private void menuClearStatistic_Click(object sender, EventArgs e)
|
||||||
|
@ -1366,7 +1366,10 @@ namespace v2rayN.Forms
|
||||||
menuExit_Click(null, null);
|
menuExit_Click(null, null);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
(new UpdateHandle()).CheckUpdateGuiN(config, _updateUI);
|
Task.Run(() =>
|
||||||
|
{
|
||||||
|
(new UpdateHandle()).CheckUpdateGuiN(config, _updateUI);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private void tsbCheckUpdateCore_Click(object sender, EventArgs e)
|
private void tsbCheckUpdateCore_Click(object sender, EventArgs e)
|
||||||
|
@ -1399,7 +1402,10 @@ namespace v2rayN.Forms
|
||||||
AppendText(false, ResUI.MsgUpdateV2rayCoreSuccessfully);
|
AppendText(false, ResUI.MsgUpdateV2rayCoreSuccessfully);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
(new UpdateHandle()).CheckUpdateCore(type, config, _updateUI);
|
Task.Run(() =>
|
||||||
|
{
|
||||||
|
(new UpdateHandle()).CheckUpdateCore(type, config, _updateUI);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private void tsbCheckUpdateGeo_Click(object sender, EventArgs e)
|
private void tsbCheckUpdateGeo_Click(object sender, EventArgs e)
|
||||||
|
|
|
@ -176,21 +176,17 @@ namespace v2rayN.Handler
|
||||||
webProxy = new WebProxy(Global.Loopback, httpPort);
|
webProxy = new WebProxy(Global.Loopback, httpPort);
|
||||||
}
|
}
|
||||||
|
|
||||||
Task<int> t = Task.Run(() =>
|
try
|
||||||
{
|
{
|
||||||
try
|
string status = GetRealPingTime(Global.SpeedPingTestUrl, webProxy, out int responseTime);
|
||||||
{
|
bool noError = Utils.IsNullOrEmpty(status);
|
||||||
string status = GetRealPingTime(Global.SpeedPingTestUrl, webProxy, out int responseTime);
|
return noError ? responseTime : -1;
|
||||||
bool noError = Utils.IsNullOrEmpty(status);
|
}
|
||||||
return noError ? responseTime : -1;
|
catch (Exception ex)
|
||||||
}
|
{
|
||||||
catch (Exception ex)
|
Utils.SaveLog(ex.Message, ex);
|
||||||
{
|
return -1;
|
||||||
Utils.SaveLog(ex.Message, ex);
|
}
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return t.Result;
|
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
|
|
@ -250,8 +250,8 @@ 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)
|
||||||
{
|
{
|
||||||
|
@ -272,6 +272,16 @@ namespace v2rayN.Handler
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void RunAvailabilityCheck(Action<bool, string> update)
|
||||||
|
{
|
||||||
|
Task.Run(() =>
|
||||||
|
{
|
||||||
|
var time = (new DownloadHandle()).RunAvailabilityCheck(null);
|
||||||
|
|
||||||
|
update(false, string.Format(ResUI.TestMeOutput, time));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
#region private
|
#region private
|
||||||
|
|
||||||
private async void CheckUpdateAsync(ECoreType type)
|
private async void CheckUpdateAsync(ECoreType type)
|
||||||
|
|
2
v2rayN/v2rayN/Resx/ResUI.Designer.cs
generated
2
v2rayN/v2rayN/Resx/ResUI.Designer.cs
generated
|
@ -953,7 +953,7 @@ namespace v2rayN.Resx {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 查找类似 The ping of current service: {0} 的本地化字符串。
|
/// 查找类似 The ping of current service: {0} ms 的本地化字符串。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
internal static string TestMeOutput {
|
internal static string TestMeOutput {
|
||||||
get {
|
get {
|
||||||
|
|
|
@ -356,7 +356,7 @@
|
||||||
<value>Scan import URL successfully</value>
|
<value>Scan import URL successfully</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="TestMeOutput" xml:space="preserve">
|
<data name="TestMeOutput" xml:space="preserve">
|
||||||
<value>The ping of current service: {0}</value>
|
<value>The ping of current service: {0} ms</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="OperationSuccess" xml:space="preserve">
|
<data name="OperationSuccess" xml:space="preserve">
|
||||||
<value>Operation success</value>
|
<value>Operation success</value>
|
||||||
|
|
|
@ -356,7 +356,7 @@
|
||||||
<value>扫描导入URL成功</value>
|
<value>扫描导入URL成功</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="TestMeOutput" xml:space="preserve">
|
<data name="TestMeOutput" xml:space="preserve">
|
||||||
<value>当前服务的真连接延迟: {0}</value>
|
<value>当前服务的真连接延迟: {0} ms</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="OperationSuccess" xml:space="preserve">
|
<data name="OperationSuccess" xml:space="preserve">
|
||||||
<value>操作成功</value>
|
<value>操作成功</value>
|
||||||
|
|
Loading…
Reference in a new issue