From 285f91e9e810934c9072c0d6d5b33b22ce8ca5c1 Mon Sep 17 00:00:00 2001 From: 2dust <31833384+2dust@users.noreply.github.com> Date: Fri, 3 Mar 2023 10:16:04 +0800 Subject: [PATCH] bug fixes --- v2rayN/v2rayN/Handler/ConfigHandler.cs | 2 +- .../ViewModels/RoutingRuleSettingViewModel.cs | 21 ++++++++----------- 2 files changed, 10 insertions(+), 13 deletions(-) diff --git a/v2rayN/v2rayN/Handler/ConfigHandler.cs b/v2rayN/v2rayN/Handler/ConfigHandler.cs index 8d3776de..55ffed3f 100644 --- a/v2rayN/v2rayN/Handler/ConfigHandler.cs +++ b/v2rayN/v2rayN/Handler/ConfigHandler.cs @@ -959,7 +959,7 @@ namespace v2rayN.Handler var existItem = lstOriSub?.FirstOrDefault(t => CompareProfileItem(t, profileItem, true)); if (existItem != null) { - profileItem = existItem; + profileItem.indexId = existItem.indexId; } //filter if (!Utils.IsNullOrEmpty(subFilter)) diff --git a/v2rayN/v2rayN/ViewModels/RoutingRuleSettingViewModel.cs b/v2rayN/v2rayN/ViewModels/RoutingRuleSettingViewModel.cs index 9766b3cd..f1bc5ebf 100644 --- a/v2rayN/v2rayN/ViewModels/RoutingRuleSettingViewModel.cs +++ b/v2rayN/v2rayN/ViewModels/RoutingRuleSettingViewModel.cs @@ -299,7 +299,7 @@ namespace v2rayN.ViewModels UI.Show(ResUI.OperationSuccess); } } - private void ImportRulesFromUrl() + private async Task ImportRulesFromUrl() { var url = SelectedRouting.url; if (Utils.IsNullOrEmpty(url)) @@ -308,19 +308,16 @@ namespace v2rayN.ViewModels return; } - Task.Run(async () => + DownloadHandle downloadHandle = new DownloadHandle(); + string result = await downloadHandle.TryDownloadString(url, true, ""); + if (AddBatchRoutingRules(SelectedRouting, result) == 0) { - DownloadHandle downloadHandle = new DownloadHandle(); - string result = await downloadHandle.DownloadStringAsync(url, false, ""); - if (AddBatchRoutingRules(SelectedRouting, result) == 0) + Application.Current.Dispatcher.Invoke((Action)(() => { - Application.Current.Dispatcher.Invoke((Action)(() => - { - RefreshRulesItems(); - })); - UI.Show(ResUI.OperationSuccess); - } - }); + RefreshRulesItems(); + })); + UI.Show(ResUI.OperationSuccess); + } } private int AddBatchRoutingRules(RoutingItem routingItem, string clipboardData) {