diff --git a/v2rayN/v2rayN/Handler/ConfigHandler.cs b/v2rayN/v2rayN/Handler/ConfigHandler.cs index 7dac6126..1e15824a 100644 --- a/v2rayN/v2rayN/Handler/ConfigHandler.cs +++ b/v2rayN/v2rayN/Handler/ConfigHandler.cs @@ -403,8 +403,14 @@ namespace v2rayN.Handler /// public static int CopyServer(ref Config config, List indexs) { - foreach (var item in indexs) + foreach (var it in indexs) { + var item = LazyConfig.Instance.GetProfileItem(it.indexId); + if (item is null) + { + continue; + } + ProfileItem profileItem = Utils.DeepCopy(item); profileItem.indexId = string.Empty; profileItem.remarks = $"{item.remarks}-clone"; diff --git a/v2rayN/v2rayN/Handler/LazyConfig.cs b/v2rayN/v2rayN/Handler/LazyConfig.cs index ed915c24..9a2a3ec1 100644 --- a/v2rayN/v2rayN/Handler/LazyConfig.cs +++ b/v2rayN/v2rayN/Handler/LazyConfig.cs @@ -112,7 +112,7 @@ namespace v2rayN.Handler { filter = filter.Replace("'", ""); } - sql += $" and a.remarks like '%{filter}%'"; + sql += String.Format(" and (a.remarks like '%{0}%' or a.address like '%{0}%') ", filter); } return SqliteHelper.Instance.Query(sql).ToList(); diff --git a/v2rayN/v2rayN/ViewModels/MainWindowViewModel.cs b/v2rayN/v2rayN/ViewModels/MainWindowViewModel.cs index 734ab89b..a6edad19 100644 --- a/v2rayN/v2rayN/ViewModels/MainWindowViewModel.cs +++ b/v2rayN/v2rayN/ViewModels/MainWindowViewModel.cs @@ -700,7 +700,7 @@ namespace v2rayN.ViewModels _subId = SelectedSub?.id; _config.subIndexId = _subId; - RefreshServers(); + RefreshServers(false); _updateView("ProfilesFocus"); } @@ -715,11 +715,13 @@ namespace v2rayN.ViewModels RefreshServers(); } - private void RefreshServers() + private void RefreshServers(bool blCheckDefault = true) { List lstModel = LazyConfig.Instance.ProfileItems(_subId, _serverFilter); - ConfigHandler.SetDefaultServer(_config, lstModel); - + if (blCheckDefault) + { + ConfigHandler.SetDefaultServer(_config, lstModel); + } List lstServerStat = new(); if (_statistics != null && _statistics.Enable) { @@ -782,6 +784,11 @@ namespace v2rayN.ViewModels RunningServerDisplay = $"{ResUI.menuServers}:{runningSummary}"; RunningServerToolTipText = runningSummary; } + else + { + RunningServerDisplay = + RunningServerToolTipText = ResUI.CheckServerSettings; + } })); } @@ -838,9 +845,11 @@ namespace v2rayN.ViewModels { return -1; } + + var orderProfiles = SelectedProfiles?.OrderBy(t => t.sort); if (latest) { - foreach (var profile in SelectedProfiles) + foreach (var profile in orderProfiles) { var item = LazyConfig.Instance.GetProfileItem(profile.indexId); if (item is not null) @@ -851,7 +860,7 @@ namespace v2rayN.ViewModels } else { - lstSelecteds = Utils.FromJson>(Utils.ToJson(SelectedProfiles)); + lstSelecteds = Utils.FromJson>(Utils.ToJson(orderProfiles)); } return 0; @@ -971,7 +980,7 @@ namespace v2rayN.ViewModels } private void CopyServer() { - if (GetProfileItems(out List lstSelecteds, true) < 0) + if (GetProfileItems(out List lstSelecteds, false) < 0) { return; } diff --git a/v2rayN/v2rayN/Views/MainWindow.xaml b/v2rayN/v2rayN/Views/MainWindow.xaml index 92ec420b..c54166b1 100644 --- a/v2rayN/v2rayN/Views/MainWindow.xaml +++ b/v2rayN/v2rayN/Views/MainWindow.xaml @@ -617,7 +617,7 @@ - +