diff --git a/v2rayN/ServiceLib/Handler/ConfigHandler.cs b/v2rayN/ServiceLib/Handler/ConfigHandler.cs index 994d4284..63e54694 100644 --- a/v2rayN/ServiceLib/Handler/ConfigHandler.cs +++ b/v2rayN/ServiceLib/Handler/ConfigHandler.cs @@ -1051,6 +1051,27 @@ namespace ServiceLib.Handler return itemSocks; } + public static async Task RemoveInvalidServerResult(Config config, string subid) + { + var lstModel = await AppHandler.Instance.ProfileItems(subid, ""); + if (lstModel is { Count: <= 0 }) + { + return -1; + } + var lstProfileExs = await ProfileExHandler.Instance.GetProfileExs(); + var lstProfile = (from t in lstModel + join t2 in lstProfileExs on t.IndexId equals t2.IndexId + where t2.Delay == -1 + select t.IndexId).ToList(); + + foreach (var item in lstProfile) + { + await RemoveProfileItem(config, item); + } + + return lstProfile.Count; + } + #endregion Server #region Batch add servers diff --git a/v2rayN/ServiceLib/Resx/ResUI.Designer.cs b/v2rayN/ServiceLib/Resx/ResUI.Designer.cs index 9872f880..5cbf7c95 100644 --- a/v2rayN/ServiceLib/Resx/ResUI.Designer.cs +++ b/v2rayN/ServiceLib/Resx/ResUI.Designer.cs @@ -1311,6 +1311,15 @@ namespace ServiceLib.Resx { } } + /// + /// 查找类似 Remove invalid by test results 的本地化字符串。 + /// + public static string menuRemoveInvalidServerResult { + get { + return ResourceManager.GetString("menuRemoveInvalidServerResult", resourceCulture); + } + } + /// /// 查找类似 Remove selected servers (Delete) 的本地化字符串。 /// @@ -1680,6 +1689,15 @@ namespace ServiceLib.Resx { } } + /// + /// 查找类似 By test result 的本地化字符串。 + /// + public static string menuTestServerResult { + get { + return ResourceManager.GetString("menuTestServerResult", resourceCulture); + } + } + /// /// 查找类似 {0} Website 的本地化字符串。 /// @@ -2004,6 +2022,15 @@ namespace ServiceLib.Resx { } } + /// + /// 查找类似 Removed {0} invalid test results. 的本地化字符串。 + /// + public static string RemoveInvalidServerResultTip { + get { + return ResourceManager.GetString("RemoveInvalidServerResultTip", resourceCulture); + } + } + /// /// 查找类似 Are you sure to remove the rules? 的本地化字符串。 /// @@ -3221,7 +3248,7 @@ namespace ServiceLib.Resx { } /// - /// 查找类似 Number per time for auto batch during speedtest(max 1000) 的本地化字符串。 + /// 查找类似 The number of concurrent during multi-test 的本地化字符串。 /// public static string TbSettingsMixedConcurrencyCount { get { diff --git a/v2rayN/ServiceLib/Resx/ResUI.fa-Ir.resx b/v2rayN/ServiceLib/Resx/ResUI.fa-Ir.resx index 2fbc1581..e39d1836 100644 --- a/v2rayN/ServiceLib/Resx/ResUI.fa-Ir.resx +++ b/v2rayN/ServiceLib/Resx/ResUI.fa-Ir.resx @@ -1396,4 +1396,13 @@ شروع آزمایش مجدد قطعات ناموفق، {0} باقی مانده است. برای خاتمه ESC را فشار دهید... + + By test result + + + Remove invalid by test results + + + Removed {0} invalid test results. + \ No newline at end of file diff --git a/v2rayN/ServiceLib/Resx/ResUI.hu.resx b/v2rayN/ServiceLib/Resx/ResUI.hu.resx index eedf8d5a..bd2bfaa0 100644 --- a/v2rayN/ServiceLib/Resx/ResUI.hu.resx +++ b/v2rayN/ServiceLib/Resx/ResUI.hu.resx @@ -1396,4 +1396,13 @@ Starting retesting failed parts, {0} remaining. Press ESC to terminate... + + By test result + + + Remove invalid by test results + + + Removed {0} invalid test results. + \ No newline at end of file diff --git a/v2rayN/ServiceLib/Resx/ResUI.resx b/v2rayN/ServiceLib/Resx/ResUI.resx index 2ee8aa8b..cc2f6c0c 100644 --- a/v2rayN/ServiceLib/Resx/ResUI.resx +++ b/v2rayN/ServiceLib/Resx/ResUI.resx @@ -1396,4 +1396,13 @@ Starting retesting failed parts, {0} remaining. Press ESC to terminate... + + By test result + + + Remove invalid by test results + + + Removed {0} invalid test results. + \ No newline at end of file diff --git a/v2rayN/ServiceLib/Resx/ResUI.ru.resx b/v2rayN/ServiceLib/Resx/ResUI.ru.resx index 9278636a..be3a7eba 100644 --- a/v2rayN/ServiceLib/Resx/ResUI.ru.resx +++ b/v2rayN/ServiceLib/Resx/ResUI.ru.resx @@ -1396,4 +1396,13 @@ Starting retesting failed parts, {0} remaining. Press ESC to terminate... + + By test result + + + Remove invalid by test results + + + Removed {0} invalid test results. + \ No newline at end of file diff --git a/v2rayN/ServiceLib/Resx/ResUI.zh-Hans.resx b/v2rayN/ServiceLib/Resx/ResUI.zh-Hans.resx index 5c55a8ed..a5f7bd9c 100644 --- a/v2rayN/ServiceLib/Resx/ResUI.zh-Hans.resx +++ b/v2rayN/ServiceLib/Resx/ResUI.zh-Hans.resx @@ -1393,4 +1393,13 @@ 开始对失败部分进行重新测试,剩余 {0} 个。可按 ESC 终止... + + 按测试结果 + + + 按测试结果移除无效 + + + 移除无效测试结果 {0} 个。 + \ No newline at end of file diff --git a/v2rayN/ServiceLib/Resx/ResUI.zh-Hant.resx b/v2rayN/ServiceLib/Resx/ResUI.zh-Hant.resx index cddc4645..2a1c70ca 100644 --- a/v2rayN/ServiceLib/Resx/ResUI.zh-Hant.resx +++ b/v2rayN/ServiceLib/Resx/ResUI.zh-Hant.resx @@ -1394,4 +1394,13 @@ 開始對失敗部分進行重新測試,剩餘 {0} 個。可按 ESC 終止... + + 按測試結果 + + + 按測試結果移除無效 + + + 移除無效測試結果 {0} 個。 + \ No newline at end of file diff --git a/v2rayN/ServiceLib/ViewModels/ProfilesViewModel.cs b/v2rayN/ServiceLib/ViewModels/ProfilesViewModel.cs index 6aa7c17d..e83195d8 100644 --- a/v2rayN/ServiceLib/ViewModels/ProfilesViewModel.cs +++ b/v2rayN/ServiceLib/ViewModels/ProfilesViewModel.cs @@ -79,6 +79,7 @@ namespace ServiceLib.ViewModels public ReactiveCommand RealPingServerCmd { get; } public ReactiveCommand SpeedServerCmd { get; } public ReactiveCommand SortServerResultCmd { get; } + public ReactiveCommand RemoveInvalidServerResultCmd { get; } //servers export public ReactiveCommand Export2ClientConfigCmd { get; } @@ -197,6 +198,10 @@ namespace ServiceLib.ViewModels { await SortServer(EServerColName.DelayVal.ToString()); }); + RemoveInvalidServerResultCmd = ReactiveCommand.CreateFromTask(async () => + { + await RemoveInvalidServerResult(); + }); //servers export Export2ClientConfigCmd = ReactiveCommand.CreateFromTask(async () => { @@ -659,6 +664,13 @@ namespace ServiceLib.ViewModels RefreshServers(); } + public async Task RemoveInvalidServerResult() + { + var count = await ConfigHandler.RemoveInvalidServerResult(_config, _config.SubIndexId); + RefreshServers(); + NoticeHandler.Instance.Enqueue(string.Format(ResUI.RemoveInvalidServerResultTip, count)); + } + //move server private async Task MoveToGroup(bool c) { diff --git a/v2rayN/v2rayN.Desktop/Views/ProfilesView.axaml b/v2rayN/v2rayN.Desktop/Views/ProfilesView.axaml index f007f4fe..fbadc95b 100644 --- a/v2rayN/v2rayN.Desktop/Views/ProfilesView.axaml +++ b/v2rayN/v2rayN.Desktop/Views/ProfilesView.axaml @@ -104,14 +104,16 @@ - - + + + + @@ -245,4 +247,4 @@ - \ No newline at end of file + diff --git a/v2rayN/v2rayN.Desktop/Views/ProfilesView.axaml.cs b/v2rayN/v2rayN.Desktop/Views/ProfilesView.axaml.cs index be0072a8..a5bb3d7d 100644 --- a/v2rayN/v2rayN.Desktop/Views/ProfilesView.axaml.cs +++ b/v2rayN/v2rayN.Desktop/Views/ProfilesView.axaml.cs @@ -85,7 +85,8 @@ namespace v2rayN.Desktop.Views this.BindCommand(ViewModel, vm => vm.RealPingServerCmd, v => v.menuRealPingServer).DisposeWith(disposables); this.BindCommand(ViewModel, vm => vm.SpeedServerCmd, v => v.menuSpeedServer).DisposeWith(disposables); this.BindCommand(ViewModel, vm => vm.SortServerResultCmd, v => v.menuSortServerResult).DisposeWith(disposables); - + this.BindCommand(ViewModel, vm => vm.RemoveInvalidServerResultCmd, v => v.menuRemoveInvalidServerResult).DisposeWith(disposables); + //servers export this.BindCommand(ViewModel, vm => vm.Export2ClientConfigCmd, v => v.menuExport2ClientConfig).DisposeWith(disposables); this.BindCommand(ViewModel, vm => vm.Export2ClientConfigClipboardCmd, v => v.menuExport2ClientConfigClipboard).DisposeWith(disposables); diff --git a/v2rayN/v2rayN/Views/ProfilesView.xaml b/v2rayN/v2rayN/Views/ProfilesView.xaml index 1d4c57d4..d2e6cd75 100644 --- a/v2rayN/v2rayN/Views/ProfilesView.xaml +++ b/v2rayN/v2rayN/Views/ProfilesView.xaml @@ -146,10 +146,16 @@ x:Name="menuSpeedServer" Height="{StaticResource MenuItemHeight}" Header="{x:Static resx:ResUI.menuSpeedServer}" /> - + + + + - \ No newline at end of file + diff --git a/v2rayN/v2rayN/Views/ProfilesView.xaml.cs b/v2rayN/v2rayN/Views/ProfilesView.xaml.cs index 0bfa9669..749a31e9 100644 --- a/v2rayN/v2rayN/Views/ProfilesView.xaml.cs +++ b/v2rayN/v2rayN/Views/ProfilesView.xaml.cs @@ -79,6 +79,7 @@ namespace v2rayN.Views this.BindCommand(ViewModel, vm => vm.RealPingServerCmd, v => v.menuRealPingServer).DisposeWith(disposables); this.BindCommand(ViewModel, vm => vm.SpeedServerCmd, v => v.menuSpeedServer).DisposeWith(disposables); this.BindCommand(ViewModel, vm => vm.SortServerResultCmd, v => v.menuSortServerResult).DisposeWith(disposables); + this.BindCommand(ViewModel, vm => vm.RemoveInvalidServerResultCmd, v => v.menuRemoveInvalidServerResult).DisposeWith(disposables); //servers export this.BindCommand(ViewModel, vm => vm.Export2ClientConfigCmd, v => v.menuExport2ClientConfig).DisposeWith(disposables);