mirror of
https://github.com/2dust/v2rayN.git
synced 2025-04-19 21:52:25 +00:00
Improve test logic
Retest the failed part of the test and call it recursively. Remove the number of batches that are automatically divided when testing parameters.
This commit is contained in:
parent
67ffa810d3
commit
7ea8fae2da
16 changed files with 134 additions and 75 deletions
|
@ -72,6 +72,7 @@ namespace ServiceLib
|
||||||
public const string LocalAppData = "V2RAYN_LOCAL_APPLICATION_DATA";
|
public const string LocalAppData = "V2RAYN_LOCAL_APPLICATION_DATA";
|
||||||
public const string V2RayLocalAsset = "V2RAY_LOCATION_ASSET";
|
public const string V2RayLocalAsset = "V2RAY_LOCATION_ASSET";
|
||||||
public const string XrayLocalAsset = "XRAY_LOCATION_ASSET";
|
public const string XrayLocalAsset = "XRAY_LOCATION_ASSET";
|
||||||
|
public const int SpeedTestPageSize = 1000;
|
||||||
|
|
||||||
public static readonly List<string> IEProxyProtocols =
|
public static readonly List<string> IEProxyProtocols =
|
||||||
[
|
[
|
||||||
|
|
|
@ -287,7 +287,7 @@ namespace ServiceLib.Handler
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Logging.SaveLog(_tag, ex);
|
Logging.SaveLog(_tag, ex);
|
||||||
UpdateFunc(true, ex.Message);
|
UpdateFunc(mayNeedSudo, ex.Message);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
9
v2rayN/ServiceLib/Resx/ResUI.Designer.cs
generated
9
v2rayN/ServiceLib/Resx/ResUI.Designer.cs
generated
|
@ -2094,6 +2094,15 @@ namespace ServiceLib.Resx {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 查找类似 Starting retesting failed parts, {0} remaining. Press ESC to terminate... 的本地化字符串。
|
||||||
|
/// </summary>
|
||||||
|
public static string SpeedtestingTestFailedPart {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("SpeedtestingTestFailedPart", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 查找类似 Waiting for testing (press ESC to terminate)... 的本地化字符串。
|
/// 查找类似 Waiting for testing (press ESC to terminate)... 的本地化字符串。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -1393,4 +1393,7 @@
|
||||||
<data name="menuCopyProxyCmdToClipboard" xml:space="preserve">
|
<data name="menuCopyProxyCmdToClipboard" xml:space="preserve">
|
||||||
<value>کپی کردن دستور پروکسی در کلیپ بورد</value>
|
<value>کپی کردن دستور پروکسی در کلیپ بورد</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="SpeedtestingTestFailedPart" xml:space="preserve">
|
||||||
|
<value>Starting retesting failed parts, {0} remaining. Press ESC to terminate...</value>
|
||||||
|
</data>
|
||||||
</root>
|
</root>
|
|
@ -1393,4 +1393,7 @@
|
||||||
<data name="menuCopyProxyCmdToClipboard" xml:space="preserve">
|
<data name="menuCopyProxyCmdToClipboard" xml:space="preserve">
|
||||||
<value>Copy proxy command to clipboard</value>
|
<value>Copy proxy command to clipboard</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="SpeedtestingTestFailedPart" xml:space="preserve">
|
||||||
|
<value>Starting retesting failed parts, {0} remaining. Press ESC to terminate...</value>
|
||||||
|
</data>
|
||||||
</root>
|
</root>
|
|
@ -1393,4 +1393,7 @@
|
||||||
<data name="menuCopyProxyCmdToClipboard" xml:space="preserve">
|
<data name="menuCopyProxyCmdToClipboard" xml:space="preserve">
|
||||||
<value>Copy proxy command to clipboard</value>
|
<value>Copy proxy command to clipboard</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="SpeedtestingTestFailedPart" xml:space="preserve">
|
||||||
|
<value>Starting retesting failed parts, {0} remaining. Press ESC to terminate...</value>
|
||||||
|
</data>
|
||||||
</root>
|
</root>
|
|
@ -1393,4 +1393,7 @@
|
||||||
<data name="menuCopyProxyCmdToClipboard" xml:space="preserve">
|
<data name="menuCopyProxyCmdToClipboard" xml:space="preserve">
|
||||||
<value>Copy proxy command to clipboard</value>
|
<value>Copy proxy command to clipboard</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="SpeedtestingTestFailedPart" xml:space="preserve">
|
||||||
|
<value>Starting retesting failed parts, {0} remaining. Press ESC to terminate...</value>
|
||||||
|
</data>
|
||||||
</root>
|
</root>
|
|
@ -1390,4 +1390,7 @@
|
||||||
<data name="menuCopyProxyCmdToClipboard" xml:space="preserve">
|
<data name="menuCopyProxyCmdToClipboard" xml:space="preserve">
|
||||||
<value>复制终端代理命令至剪贴板</value>
|
<value>复制终端代理命令至剪贴板</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="SpeedtestingTestFailedPart" xml:space="preserve">
|
||||||
|
<value>开始对失败部分进行重新测试,剩余 {0} 个。可按 ESC 终止...</value>
|
||||||
|
</data>
|
||||||
</root>
|
</root>
|
|
@ -1391,4 +1391,7 @@
|
||||||
<data name="menuCopyProxyCmdToClipboard" xml:space="preserve">
|
<data name="menuCopyProxyCmdToClipboard" xml:space="preserve">
|
||||||
<value>複製終端代理指令至剪貼簿</value>
|
<value>複製終端代理指令至剪貼簿</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="SpeedtestingTestFailedPart" xml:space="preserve">
|
||||||
|
<value>開始對失敗部分進行重新測試,剩餘 {0} 個。可按 ESC 終止...</value>
|
||||||
|
</data>
|
||||||
</root>
|
</root>
|
|
@ -13,11 +13,69 @@ namespace ServiceLib.Services
|
||||||
private bool _exitLoop = false;
|
private bool _exitLoop = false;
|
||||||
private static readonly string _tag = "SpeedtestService";
|
private static readonly string _tag = "SpeedtestService";
|
||||||
|
|
||||||
public SpeedtestService(Config config, List<ProfileItem> selecteds, ESpeedActionType actionType, Action<SpeedTestResult> updateFunc)
|
public SpeedtestService(Config config, ESpeedActionType actionType, List<ProfileItem> selecteds, Action<SpeedTestResult> updateFunc)
|
||||||
{
|
{
|
||||||
_config = config;
|
_config = config;
|
||||||
_updateFunc = updateFunc;
|
_updateFunc = updateFunc;
|
||||||
|
|
||||||
|
MessageBus.Current.Listen<string>(EMsgCommand.StopSpeedtest.ToString()).Subscribe(ExitLoop);
|
||||||
|
|
||||||
|
Task.Run(async () =>
|
||||||
|
{
|
||||||
|
var lstSelected = GetClearItem(actionType, selecteds);
|
||||||
|
await RunAsync(actionType, lstSelected);
|
||||||
|
UpdateFunc("", ResUI.SpeedtestingCompleted);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task RunAsync(ESpeedActionType actionType, List<ServerTestItem> lstSelected, int pageSize = 0)
|
||||||
|
{
|
||||||
|
if (actionType == ESpeedActionType.Tcping)
|
||||||
|
{
|
||||||
|
await RunTcpingAsync(lstSelected);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pageSize <= 0)
|
||||||
|
{
|
||||||
|
pageSize = lstSelected.Count < Global.SpeedTestPageSize ? lstSelected.Count : Global.SpeedTestPageSize;
|
||||||
|
}
|
||||||
|
var lstTest = GetTestBatchItem(lstSelected, pageSize);
|
||||||
|
|
||||||
|
List<ServerTestItem> lstFailed = new();
|
||||||
|
foreach (var lst in lstTest)
|
||||||
|
{
|
||||||
|
var ret = actionType switch
|
||||||
|
{
|
||||||
|
ESpeedActionType.Realping => await RunRealPingAsync(lst),
|
||||||
|
ESpeedActionType.Speedtest => await RunSpeedTestAsync(lst),
|
||||||
|
ESpeedActionType.Mixedtest => await RunMixedTestAsync(lst),
|
||||||
|
_ => true
|
||||||
|
};
|
||||||
|
if (ret == false)
|
||||||
|
{
|
||||||
|
lstFailed.AddRange(lst);
|
||||||
|
}
|
||||||
|
await Task.Delay(100);
|
||||||
|
}
|
||||||
|
|
||||||
|
//Retest the failed part
|
||||||
|
var pageSizeNext = pageSize / 2;
|
||||||
|
if (lstFailed.Count > 0 && pageSizeNext > 0)
|
||||||
|
{
|
||||||
|
if (_exitLoop)
|
||||||
|
{
|
||||||
|
UpdateFunc("", ResUI.SpeedtestingSkip);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
UpdateFunc("", string.Format(ResUI.SpeedtestingTestFailedPart, lstFailed.Count));
|
||||||
|
await RunAsync(actionType, lstFailed, pageSizeNext);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<ServerTestItem> GetClearItem(ESpeedActionType actionType, List<ProfileItem> selecteds)
|
||||||
|
{
|
||||||
var lstSelected = new List<ServerTestItem>();
|
var lstSelected = new List<ServerTestItem>();
|
||||||
foreach (var it in selecteds)
|
foreach (var it in selecteds)
|
||||||
{
|
{
|
||||||
|
@ -25,10 +83,12 @@ namespace ServiceLib.Services
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (it.Port <= 0)
|
if (it.Port <= 0)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
lstSelected.Add(new ServerTestItem()
|
lstSelected.Add(new ServerTestItem()
|
||||||
{
|
{
|
||||||
IndexId = it.IndexId,
|
IndexId = it.IndexId,
|
||||||
|
@ -62,25 +122,11 @@ namespace ServiceLib.Services
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
MessageBus.Current.Listen<string>(EMsgCommand.StopSpeedtest.ToString()).Subscribe(ExitLoop);
|
return lstSelected;
|
||||||
|
|
||||||
Task.Run(async () => { await RunAsync(actionType, lstSelected); });
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task RunAsync(ESpeedActionType actionType, List<ServerTestItem> lstSelected)
|
private List<List<ServerTestItem>> GetTestBatchItem(List<ServerTestItem> lstSelected, int pageSize)
|
||||||
{
|
{
|
||||||
if (actionType == ESpeedActionType.Tcping)
|
|
||||||
{
|
|
||||||
await RunTcpingAsync(lstSelected);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var pageSize = _config.SpeedTestItem.SpeedTestPageSize;
|
|
||||||
if (pageSize is <= 0 or > 1000)
|
|
||||||
{
|
|
||||||
pageSize = 1000;
|
|
||||||
}
|
|
||||||
|
|
||||||
List<List<ServerTestItem>> lstTest = new();
|
List<List<ServerTestItem>> lstTest = new();
|
||||||
var lst1 = lstSelected.Where(t => t.ConfigType is not (EConfigType.Hysteria2 or EConfigType.TUIC or EConfigType.WireGuard)).ToList();
|
var lst1 = lstSelected.Where(t => t.ConfigType is not (EConfigType.Hysteria2 or EConfigType.TUIC or EConfigType.WireGuard)).ToList();
|
||||||
var lst2 = lstSelected.Where(t => t.ConfigType is EConfigType.Hysteria2 or EConfigType.TUIC or EConfigType.WireGuard).ToList();
|
var lst2 = lstSelected.Where(t => t.ConfigType is EConfigType.Hysteria2 or EConfigType.TUIC or EConfigType.WireGuard).ToList();
|
||||||
|
@ -94,27 +140,7 @@ namespace ServiceLib.Services
|
||||||
lstTest.Add(lst2.Skip(num * pageSize).Take(pageSize).ToList());
|
lstTest.Add(lst2.Skip(num * pageSize).Take(pageSize).ToList());
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (var lst in lstTest)
|
return lstTest;
|
||||||
{
|
|
||||||
switch (actionType)
|
|
||||||
{
|
|
||||||
case ESpeedActionType.Realping:
|
|
||||||
await RunRealPingAsync(lst);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case ESpeedActionType.Speedtest:
|
|
||||||
await RunSpeedTestAsync(lst);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case ESpeedActionType.Mixedtest:
|
|
||||||
await RunMixedTestAsync(lst);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
await Task.Delay(100);
|
|
||||||
}
|
|
||||||
|
|
||||||
UpdateFunc("", ResUI.SpeedtestingCompleted);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ExitLoop(string x)
|
private void ExitLoop(string x)
|
||||||
|
@ -164,7 +190,7 @@ namespace ServiceLib.Services
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task RunRealPingAsync(List<ServerTestItem> selecteds)
|
private async Task<bool> RunRealPingAsync(List<ServerTestItem> selecteds)
|
||||||
{
|
{
|
||||||
var pid = -1;
|
var pid = -1;
|
||||||
try
|
try
|
||||||
|
@ -172,8 +198,7 @@ namespace ServiceLib.Services
|
||||||
pid = await CoreHandler.Instance.LoadCoreConfigSpeedtest(selecteds);
|
pid = await CoreHandler.Instance.LoadCoreConfigSpeedtest(selecteds);
|
||||||
if (pid < 0)
|
if (pid < 0)
|
||||||
{
|
{
|
||||||
UpdateFunc("", ResUI.FailedToRunCore);
|
return false;
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var downloadHandle = new DownloadService();
|
var downloadHandle = new DownloadService();
|
||||||
|
@ -221,16 +246,16 @@ namespace ServiceLib.Services
|
||||||
}
|
}
|
||||||
await ProfileExHandler.Instance.SaveTo();
|
await ProfileExHandler.Instance.SaveTo();
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task RunSpeedTestAsync(List<ServerTestItem> selecteds)
|
private async Task<bool> RunSpeedTestAsync(List<ServerTestItem> selecteds)
|
||||||
{
|
{
|
||||||
var pid = -1;
|
var pid = -1;
|
||||||
pid = await CoreHandler.Instance.LoadCoreConfigSpeedtest(selecteds);
|
pid = await CoreHandler.Instance.LoadCoreConfigSpeedtest(selecteds);
|
||||||
if (pid < 0)
|
if (pid < 0)
|
||||||
{
|
{
|
||||||
UpdateFunc("", ResUI.FailedToRunCore);
|
return false;
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var url = _config.SpeedTestItem.SpeedTestUrl;
|
var url = _config.SpeedTestItem.SpeedTestUrl;
|
||||||
|
@ -283,16 +308,16 @@ namespace ServiceLib.Services
|
||||||
await ProcUtils.ProcessKill(pid);
|
await ProcUtils.ProcessKill(pid);
|
||||||
}
|
}
|
||||||
await ProfileExHandler.Instance.SaveTo();
|
await ProfileExHandler.Instance.SaveTo();
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task RunSpeedTestMulti(List<ServerTestItem> selecteds)
|
private async Task<bool> RunSpeedTestMulti(List<ServerTestItem> selecteds)
|
||||||
{
|
{
|
||||||
var pid = -1;
|
var pid = -1;
|
||||||
pid = await CoreHandler.Instance.LoadCoreConfigSpeedtest(selecteds);
|
pid = await CoreHandler.Instance.LoadCoreConfigSpeedtest(selecteds);
|
||||||
if (pid < 0)
|
if (pid < 0)
|
||||||
{
|
{
|
||||||
UpdateFunc("", ResUI.FailedToRunCore);
|
return false;
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var url = _config.SpeedTestItem.SpeedTestUrl;
|
var url = _config.SpeedTestItem.SpeedTestUrl;
|
||||||
|
@ -348,21 +373,30 @@ namespace ServiceLib.Services
|
||||||
await ProcUtils.ProcessKill(pid);
|
await ProcUtils.ProcessKill(pid);
|
||||||
}
|
}
|
||||||
await ProfileExHandler.Instance.SaveTo();
|
await ProfileExHandler.Instance.SaveTo();
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task RunMixedTestAsync(List<ServerTestItem> selecteds)
|
private async Task<bool> RunMixedTestAsync(List<ServerTestItem> selecteds)
|
||||||
{
|
{
|
||||||
await RunRealPingAsync(selecteds);
|
var ret = await RunRealPingAsync(selecteds);
|
||||||
|
if (ret == false)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
await Task.Delay(1000);
|
await Task.Delay(1000);
|
||||||
|
|
||||||
await RunSpeedTestMulti(selecteds);
|
var ret2 = await RunSpeedTestMulti(selecteds);
|
||||||
|
if (ret2 == false)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task<string> GetRealPingTime(DownloadService downloadHandle, IWebProxy webProxy)
|
private async Task<string> GetRealPingTime(DownloadService downloadHandle, IWebProxy webProxy)
|
||||||
{
|
{
|
||||||
var responseTime = await downloadHandle.GetRealPingTime(_config.SpeedTestItem.SpeedPingTestUrl, webProxy, 10);
|
var responseTime = await downloadHandle.GetRealPingTime(_config.SpeedTestItem.SpeedPingTestUrl, webProxy, 10);
|
||||||
//string output = Utile.IsNullOrEmpty(status) ? FormatOut(responseTime, "ms") : status;
|
|
||||||
return FormatOut(responseTime, Global.DelayUnit);
|
return FormatOut(responseTime, Global.DelayUnit);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -63,7 +63,7 @@ namespace ServiceLib.ViewModels
|
||||||
[Reactive] public int SpeedTestTimeout { get; set; }
|
[Reactive] public int SpeedTestTimeout { get; set; }
|
||||||
[Reactive] public string SpeedTestUrl { get; set; }
|
[Reactive] public string SpeedTestUrl { get; set; }
|
||||||
[Reactive] public string SpeedPingTestUrl { get; set; }
|
[Reactive] public string SpeedPingTestUrl { get; set; }
|
||||||
[Reactive] public int SpeedTestPageSize { get; set; }
|
//[Reactive] public int SpeedTestPageSize { get; set; }
|
||||||
[Reactive] public bool EnableHWA { get; set; }
|
[Reactive] public bool EnableHWA { get; set; }
|
||||||
[Reactive] public string SubConvertUrl { get; set; }
|
[Reactive] public string SubConvertUrl { get; set; }
|
||||||
[Reactive] public int MainGirdOrientation { get; set; }
|
[Reactive] public int MainGirdOrientation { get; set; }
|
||||||
|
@ -178,7 +178,7 @@ namespace ServiceLib.ViewModels
|
||||||
CurrentFontFamily = _config.UiItem.CurrentFontFamily;
|
CurrentFontFamily = _config.UiItem.CurrentFontFamily;
|
||||||
SpeedTestTimeout = _config.SpeedTestItem.SpeedTestTimeout;
|
SpeedTestTimeout = _config.SpeedTestItem.SpeedTestTimeout;
|
||||||
SpeedTestUrl = _config.SpeedTestItem.SpeedTestUrl;
|
SpeedTestUrl = _config.SpeedTestItem.SpeedTestUrl;
|
||||||
SpeedTestPageSize = _config.SpeedTestItem.SpeedTestPageSize;
|
//SpeedTestPageSize = _config.SpeedTestItem.SpeedTestPageSize;
|
||||||
SpeedPingTestUrl = _config.SpeedTestItem.SpeedPingTestUrl;
|
SpeedPingTestUrl = _config.SpeedTestItem.SpeedPingTestUrl;
|
||||||
EnableHWA = _config.GuiItem.EnableHWA;
|
EnableHWA = _config.GuiItem.EnableHWA;
|
||||||
SubConvertUrl = _config.ConstItem.SubConvertUrl;
|
SubConvertUrl = _config.ConstItem.SubConvertUrl;
|
||||||
|
@ -332,7 +332,7 @@ namespace ServiceLib.ViewModels
|
||||||
_config.GuiItem.TrayMenuServersLimit = TrayMenuServersLimit;
|
_config.GuiItem.TrayMenuServersLimit = TrayMenuServersLimit;
|
||||||
_config.UiItem.CurrentFontFamily = CurrentFontFamily;
|
_config.UiItem.CurrentFontFamily = CurrentFontFamily;
|
||||||
_config.SpeedTestItem.SpeedTestTimeout = SpeedTestTimeout;
|
_config.SpeedTestItem.SpeedTestTimeout = SpeedTestTimeout;
|
||||||
_config.SpeedTestItem.SpeedTestPageSize = SpeedTestPageSize;
|
//_config.SpeedTestItem.SpeedTestPageSize = SpeedTestPageSize;
|
||||||
_config.SpeedTestItem.SpeedTestUrl = SpeedTestUrl;
|
_config.SpeedTestItem.SpeedTestUrl = SpeedTestUrl;
|
||||||
_config.SpeedTestItem.SpeedPingTestUrl = SpeedPingTestUrl;
|
_config.SpeedTestItem.SpeedPingTestUrl = SpeedPingTestUrl;
|
||||||
_config.GuiItem.EnableHWA = EnableHWA;
|
_config.GuiItem.EnableHWA = EnableHWA;
|
||||||
|
|
|
@ -259,11 +259,6 @@ namespace ServiceLib.ViewModels
|
||||||
Locator.Current.GetService<MainWindowViewModel>()?.Reload();
|
Locator.Current.GetService<MainWindowViewModel>()?.Reload();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void UpdateSpeedtestHandler(SpeedTestResult result)
|
|
||||||
{
|
|
||||||
_updateView?.Invoke(EViewAction.DispatcherSpeedTest, result);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void SetSpeedTestResult(SpeedTestResult result)
|
public void SetSpeedTestResult(SpeedTestResult result)
|
||||||
{
|
{
|
||||||
if (Utils.IsNullOrEmpty(result.IndexId))
|
if (Utils.IsNullOrEmpty(result.IndexId))
|
||||||
|
@ -272,7 +267,7 @@ namespace ServiceLib.ViewModels
|
||||||
NoticeHandler.Instance.Enqueue(result.Delay);
|
NoticeHandler.Instance.Enqueue(result.Delay);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var item = _profileItems.Where(it => it.IndexId == result.IndexId).FirstOrDefault();
|
var item = _profileItems.FirstOrDefault(it => it.IndexId == result.IndexId);
|
||||||
if (item != null)
|
if (item != null)
|
||||||
{
|
{
|
||||||
if (Utils.IsNotEmpty(result.Delay))
|
if (Utils.IsNotEmpty(result.Delay))
|
||||||
|
@ -293,7 +288,7 @@ namespace ServiceLib.ViewModels
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var item = _profileItems.Where(it => it.IndexId == update.IndexId).FirstOrDefault();
|
var item = _profileItems.FirstOrDefault(it => it.IndexId == update.IndexId);
|
||||||
if (item != null)
|
if (item != null)
|
||||||
{
|
{
|
||||||
item.TodayDown = Utils.HumanFy(update.TodayDown);
|
item.TodayDown = Utils.HumanFy(update.TodayDown);
|
||||||
|
@ -726,9 +721,11 @@ namespace ServiceLib.ViewModels
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
//ClearTestResult();
|
|
||||||
|
|
||||||
_ = new SpeedtestService(_config, lstSelecteds, actionType, UpdateSpeedtestHandler);
|
_ = new SpeedtestService(_config, actionType, lstSelecteds, (SpeedTestResult result) =>
|
||||||
|
{
|
||||||
|
_updateView?.Invoke(EViewAction.DispatcherSpeedTest, result);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ServerSpeedtestStop()
|
public void ServerSpeedtestStop()
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
<Window
|
<Window
|
||||||
x:Class="v2rayN.Desktop.Views.OptionSettingWindow"
|
x:Class="v2rayN.Desktop.Views.OptionSettingWindow"
|
||||||
xmlns="https://github.com/avaloniaui"
|
xmlns="https://github.com/avaloniaui"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
@ -518,7 +518,7 @@
|
||||||
Classes="Margin8"
|
Classes="Margin8"
|
||||||
Text="{x:Static resx:ResUI.TbSettingsCurrentFontFamilyLinuxTip}"
|
Text="{x:Static resx:ResUI.TbSettingsCurrentFontFamilyLinuxTip}"
|
||||||
TextWrapping="Wrap" />
|
TextWrapping="Wrap" />
|
||||||
|
<!--
|
||||||
<TextBlock
|
<TextBlock
|
||||||
Grid.Row="16"
|
Grid.Row="16"
|
||||||
Grid.Column="0"
|
Grid.Column="0"
|
||||||
|
@ -532,7 +532,7 @@
|
||||||
Width="200"
|
Width="200"
|
||||||
HorizontalAlignment="Left"
|
HorizontalAlignment="Left"
|
||||||
Classes="Margin8" />
|
Classes="Margin8" />
|
||||||
|
-->
|
||||||
<TextBlock
|
<TextBlock
|
||||||
Grid.Row="17"
|
Grid.Row="17"
|
||||||
Grid.Column="0"
|
Grid.Column="0"
|
||||||
|
|
|
@ -139,7 +139,7 @@ namespace v2rayN.Desktop.Views
|
||||||
this.Bind(ViewModel, vm => vm.SpeedTestTimeout, v => v.cmbSpeedTestTimeout.SelectedValue).DisposeWith(disposables);
|
this.Bind(ViewModel, vm => vm.SpeedTestTimeout, v => v.cmbSpeedTestTimeout.SelectedValue).DisposeWith(disposables);
|
||||||
this.Bind(ViewModel, vm => vm.SpeedTestUrl, v => v.cmbSpeedTestUrl.SelectedValue).DisposeWith(disposables);
|
this.Bind(ViewModel, vm => vm.SpeedTestUrl, v => v.cmbSpeedTestUrl.SelectedValue).DisposeWith(disposables);
|
||||||
this.Bind(ViewModel, vm => vm.SpeedPingTestUrl, v => v.cmbSpeedPingTestUrl.SelectedValue).DisposeWith(disposables);
|
this.Bind(ViewModel, vm => vm.SpeedPingTestUrl, v => v.cmbSpeedPingTestUrl.SelectedValue).DisposeWith(disposables);
|
||||||
this.Bind(ViewModel, vm => vm.SpeedTestPageSize, v => v.txtSpeedTestPageSize.Text).DisposeWith(disposables);
|
//this.Bind(ViewModel, vm => vm.SpeedTestPageSize, v => v.txtSpeedTestPageSize.Text).DisposeWith(disposables);
|
||||||
this.Bind(ViewModel, vm => vm.SubConvertUrl, v => v.cmbSubConvertUrl.SelectedValue).DisposeWith(disposables);
|
this.Bind(ViewModel, vm => vm.SubConvertUrl, v => v.cmbSubConvertUrl.SelectedValue).DisposeWith(disposables);
|
||||||
this.Bind(ViewModel, vm => vm.MainGirdOrientation, v => v.cmbMainGirdOrientation.SelectedIndex).DisposeWith(disposables);
|
this.Bind(ViewModel, vm => vm.MainGirdOrientation, v => v.cmbMainGirdOrientation.SelectedIndex).DisposeWith(disposables);
|
||||||
this.Bind(ViewModel, vm => vm.GeoFileSourceUrl, v => v.cmbGetFilesSourceUrl.SelectedValue).DisposeWith(disposables);
|
this.Bind(ViewModel, vm => vm.GeoFileSourceUrl, v => v.cmbGetFilesSourceUrl.SelectedValue).DisposeWith(disposables);
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
<reactiveui:ReactiveWindow
|
<reactiveui:ReactiveWindow
|
||||||
x:Class="v2rayN.Views.OptionSettingWindow"
|
x:Class="v2rayN.Views.OptionSettingWindow"
|
||||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
@ -776,7 +776,7 @@
|
||||||
Style="{StaticResource ToolbarTextBlock}"
|
Style="{StaticResource ToolbarTextBlock}"
|
||||||
Text="{x:Static resx:ResUI.TbSettingsCurrentFontFamilyTip}"
|
Text="{x:Static resx:ResUI.TbSettingsCurrentFontFamilyTip}"
|
||||||
TextWrapping="Wrap" />
|
TextWrapping="Wrap" />
|
||||||
|
<!--
|
||||||
<TextBlock
|
<TextBlock
|
||||||
Grid.Row="16"
|
Grid.Row="16"
|
||||||
Grid.Column="0"
|
Grid.Column="0"
|
||||||
|
@ -792,7 +792,7 @@
|
||||||
Margin="{StaticResource Margin8}"
|
Margin="{StaticResource Margin8}"
|
||||||
HorizontalAlignment="Left"
|
HorizontalAlignment="Left"
|
||||||
Style="{StaticResource DefTextBox}" />
|
Style="{StaticResource DefTextBox}" />
|
||||||
|
-->
|
||||||
<TextBlock
|
<TextBlock
|
||||||
Grid.Row="17"
|
Grid.Row="17"
|
||||||
Grid.Column="0"
|
Grid.Column="0"
|
||||||
|
|
|
@ -150,7 +150,7 @@ namespace v2rayN.Views
|
||||||
this.Bind(ViewModel, vm => vm.SpeedTestTimeout, v => v.cmbSpeedTestTimeout.Text).DisposeWith(disposables);
|
this.Bind(ViewModel, vm => vm.SpeedTestTimeout, v => v.cmbSpeedTestTimeout.Text).DisposeWith(disposables);
|
||||||
this.Bind(ViewModel, vm => vm.SpeedTestUrl, v => v.cmbSpeedTestUrl.Text).DisposeWith(disposables);
|
this.Bind(ViewModel, vm => vm.SpeedTestUrl, v => v.cmbSpeedTestUrl.Text).DisposeWith(disposables);
|
||||||
this.Bind(ViewModel, vm => vm.SpeedPingTestUrl, v => v.cmbSpeedPingTestUrl.Text).DisposeWith(disposables);
|
this.Bind(ViewModel, vm => vm.SpeedPingTestUrl, v => v.cmbSpeedPingTestUrl.Text).DisposeWith(disposables);
|
||||||
this.Bind(ViewModel, vm => vm.SpeedTestPageSize, v => v.txtSpeedTestPageSize.Text).DisposeWith(disposables);
|
//this.Bind(ViewModel, vm => vm.SpeedTestPageSize, v => v.txtSpeedTestPageSize.Text).DisposeWith(disposables);
|
||||||
this.Bind(ViewModel, vm => vm.EnableHWA, v => v.togEnableHWA.IsChecked).DisposeWith(disposables);
|
this.Bind(ViewModel, vm => vm.EnableHWA, v => v.togEnableHWA.IsChecked).DisposeWith(disposables);
|
||||||
this.Bind(ViewModel, vm => vm.SubConvertUrl, v => v.cmbSubConvertUrl.Text).DisposeWith(disposables);
|
this.Bind(ViewModel, vm => vm.SubConvertUrl, v => v.cmbSubConvertUrl.Text).DisposeWith(disposables);
|
||||||
this.Bind(ViewModel, vm => vm.MainGirdOrientation, v => v.cmbMainGirdOrientation.SelectedIndex).DisposeWith(disposables);
|
this.Bind(ViewModel, vm => vm.MainGirdOrientation, v => v.cmbMainGirdOrientation.SelectedIndex).DisposeWith(disposables);
|
||||||
|
|
Loading…
Reference in a new issue