diff --git a/v2rayN/ServiceLib/Resx/ResUI.Designer.cs b/v2rayN/ServiceLib/Resx/ResUI.Designer.cs index 6b854e1b..d0422079 100644 --- a/v2rayN/ServiceLib/Resx/ResUI.Designer.cs +++ b/v2rayN/ServiceLib/Resx/ResUI.Designer.cs @@ -1248,15 +1248,6 @@ namespace ServiceLib.Resx { } } - /// - /// 查找类似 Russia 的本地化字符串。 - /// - public static string menuRegionalPresetsRussia { - get { - return ResourceManager.GetString("menuRegionalPresetsRussia", resourceCulture); - } - } - /// /// 查找类似 Iran 的本地化字符串。 /// @@ -1266,6 +1257,15 @@ namespace ServiceLib.Resx { } } + /// + /// 查找类似 Russia 的本地化字符串。 + /// + public static string menuRegionalPresetsRussia { + get { + return ResourceManager.GetString("menuRegionalPresetsRussia", resourceCulture); + } + } + /// /// 查找类似 Reload 的本地化字符串。 /// diff --git a/v2rayN/ServiceLib/ViewModels/RoutingRuleSettingViewModel.cs b/v2rayN/ServiceLib/ViewModels/RoutingRuleSettingViewModel.cs index 1e678776..f931170d 100644 --- a/v2rayN/ServiceLib/ViewModels/RoutingRuleSettingViewModel.cs +++ b/v2rayN/ServiceLib/ViewModels/RoutingRuleSettingViewModel.cs @@ -177,12 +177,12 @@ namespace ServiceLib.ViewModels } var lst = new List(); - foreach (var it in SelectedSources ?? [SelectedSource]) + var sources = SelectedSources ?? [SelectedSource]; + foreach (var it in _rules) { - var item = _rules.FirstOrDefault(t => t.Id == it?.Id); - if (item != null) + if (sources.Any(t => t.Id == it?.Id)) { - var item2 = JsonUtils.DeepCopy(item); //JsonUtils.Deserialize(JsonUtils.Serialize(item)); + var item2 = JsonUtils.DeepCopy(it); item2.Id = null; lst.Add(item2 ?? new()); } diff --git a/v2rayN/v2rayN.Desktop/Views/ProfilesView.axaml.cs b/v2rayN/v2rayN.Desktop/Views/ProfilesView.axaml.cs index 4ddfa2c2..4f66d926 100644 --- a/v2rayN/v2rayN.Desktop/Views/ProfilesView.axaml.cs +++ b/v2rayN/v2rayN.Desktop/Views/ProfilesView.axaml.cs @@ -187,12 +187,7 @@ namespace v2rayN.Desktop.Views private void lstProfiles_SelectionChanged(object? sender, SelectionChangedEventArgs e) { - List lst = []; - foreach (var item in lstProfiles.SelectedItems) - { - lst.Add((ProfileItemModel)item); - } - ViewModel.SelectedProfiles = lst; + ViewModel.SelectedProfiles = lstProfiles.SelectedItems.Cast().ToList(); } private void LstProfiles_DoubleTapped(object? sender, Avalonia.Input.TappedEventArgs e) diff --git a/v2rayN/v2rayN.Desktop/Views/RoutingRuleSettingWindow.axaml.cs b/v2rayN/v2rayN.Desktop/Views/RoutingRuleSettingWindow.axaml.cs index 5be3c793..deeba10d 100644 --- a/v2rayN/v2rayN.Desktop/Views/RoutingRuleSettingWindow.axaml.cs +++ b/v2rayN/v2rayN.Desktop/Views/RoutingRuleSettingWindow.axaml.cs @@ -166,12 +166,7 @@ namespace v2rayN.Desktop.Views private void lstRules_SelectionChanged(object? sender, SelectionChangedEventArgs e) { - List lst = []; - foreach (var item in lstRules.SelectedItems) - { - lst.Add((RulesItemModel)item); - } - ViewModel.SelectedSources = lst; + ViewModel.SelectedSources = lstRules.SelectedItems.Cast().ToList(); } private void LstRules_DoubleTapped(object? sender, Avalonia.Input.TappedEventArgs e) diff --git a/v2rayN/v2rayN.Desktop/Views/RoutingSettingWindow.axaml.cs b/v2rayN/v2rayN.Desktop/Views/RoutingSettingWindow.axaml.cs index de74c39e..15f5dd2f 100644 --- a/v2rayN/v2rayN.Desktop/Views/RoutingSettingWindow.axaml.cs +++ b/v2rayN/v2rayN.Desktop/Views/RoutingSettingWindow.axaml.cs @@ -107,12 +107,7 @@ namespace v2rayN.Desktop.Views private void lstRoutings_SelectionChanged(object? sender, SelectionChangedEventArgs e) { - List lst = []; - foreach (var item in lstRoutings.SelectedItems) - { - lst.Add((RoutingItemModel)item); - } - ViewModel.SelectedSources = lst; + ViewModel.SelectedSources = lstRoutings.SelectedItems.Cast().ToList(); } private void LstRoutings_DoubleTapped(object? sender, TappedEventArgs e) diff --git a/v2rayN/v2rayN.Desktop/Views/SubSettingWindow.axaml.cs b/v2rayN/v2rayN.Desktop/Views/SubSettingWindow.axaml.cs index 7a9aad66..b37f5ac1 100644 --- a/v2rayN/v2rayN.Desktop/Views/SubSettingWindow.axaml.cs +++ b/v2rayN/v2rayN.Desktop/Views/SubSettingWindow.axaml.cs @@ -82,12 +82,7 @@ namespace v2rayN.Desktop.Views private void LstSubscription_SelectionChanged(object? sender, SelectionChangedEventArgs e) { - List lst = []; - foreach (var item in lstSubscription.SelectedItems) - { - lst.Add((SubItem)item); - } - ViewModel.SelectedSources = lst; + ViewModel.SelectedSources = lstSubscription.SelectedItems.Cast().ToList(); } private void menuClose_Click(object? sender, RoutedEventArgs e)