Skip to content

Commit

Permalink
Fix export rule order issue
Browse files Browse the repository at this point in the history
  • Loading branch information
2dust committed Dec 31, 2024
1 parent ff642fd commit 37cba5e
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 34 deletions.
12 changes: 6 additions & 6 deletions v2rayN/ServiceLib/Resx/ResUI.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions v2rayN/ServiceLib/ViewModels/RoutingRuleSettingViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -177,12 +177,12 @@ public async Task RuleExportSelectedAsync()
}

var lst = new List<RulesItem>();
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<RulesItem4Ray>(JsonUtils.Serialize(item));
var item2 = JsonUtils.DeepCopy(it);
item2.Id = null;
lst.Add(item2 ?? new());
}
Expand Down
7 changes: 1 addition & 6 deletions v2rayN/v2rayN.Desktop/Views/ProfilesView.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -187,12 +187,7 @@ public async Task ShareServer(string url)

private void lstProfiles_SelectionChanged(object? sender, SelectionChangedEventArgs e)
{
List<ProfileItemModel> lst = [];
foreach (var item in lstProfiles.SelectedItems)
{
lst.Add((ProfileItemModel)item);
}
ViewModel.SelectedProfiles = lst;
ViewModel.SelectedProfiles = lstProfiles.SelectedItems.Cast<ProfileItemModel>().ToList();
}

private void LstProfiles_DoubleTapped(object? sender, Avalonia.Input.TappedEventArgs e)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,12 +166,7 @@ private void RoutingRuleSettingWindow_KeyDown(object? sender, KeyEventArgs e)

private void lstRules_SelectionChanged(object? sender, SelectionChangedEventArgs e)
{
List<RulesItemModel> lst = [];
foreach (var item in lstRules.SelectedItems)
{
lst.Add((RulesItemModel)item);
}
ViewModel.SelectedSources = lst;
ViewModel.SelectedSources = lstRules.SelectedItems.Cast<RulesItemModel>().ToList();
}

private void LstRules_DoubleTapped(object? sender, Avalonia.Input.TappedEventArgs e)
Expand Down
7 changes: 1 addition & 6 deletions v2rayN/v2rayN.Desktop/Views/RoutingSettingWindow.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -107,12 +107,7 @@ private void menuRoutingAdvancedSelectAll_Click(object? sender, RoutedEventArgs

private void lstRoutings_SelectionChanged(object? sender, SelectionChangedEventArgs e)
{
List<RoutingItemModel> lst = [];
foreach (var item in lstRoutings.SelectedItems)
{
lst.Add((RoutingItemModel)item);
}
ViewModel.SelectedSources = lst;
ViewModel.SelectedSources = lstRoutings.SelectedItems.Cast<RoutingItemModel>().ToList();
}

private void LstRoutings_DoubleTapped(object? sender, TappedEventArgs e)
Expand Down
7 changes: 1 addition & 6 deletions v2rayN/v2rayN.Desktop/Views/SubSettingWindow.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -82,12 +82,7 @@ private void LstSubscription_DoubleTapped(object? sender, Avalonia.Input.TappedE

private void LstSubscription_SelectionChanged(object? sender, SelectionChangedEventArgs e)
{
List<SubItem> lst = [];
foreach (var item in lstSubscription.SelectedItems)
{
lst.Add((SubItem)item);
}
ViewModel.SelectedSources = lst;
ViewModel.SelectedSources = lstSubscription.SelectedItems.Cast<SubItem>().ToList();
}

private void menuClose_Click(object? sender, RoutedEventArgs e)
Expand Down

0 comments on commit 37cba5e

Please sign in to comment.