From a2413fdf235646bea02e0f1e1d3f3c86828fd2a7 Mon Sep 17 00:00:00 2001 From: 2dust <31833384+2dust@users.noreply.github.com> Date: Wed, 20 Nov 2024 12:01:04 +0800 Subject: [PATCH] Remove Routing Basic function --- v2rayN/ServiceLib/Handler/AppHandler.cs | 4 +- v2rayN/ServiceLib/Handler/ConfigHandler.cs | 22 +-- v2rayN/ServiceLib/Models/ConfigItems.cs | 1 - v2rayN/ServiceLib/Resx/ResUI.Designer.cs | 18 --- v2rayN/ServiceLib/Resx/ResUI.fa-Ir.resx | 6 - v2rayN/ServiceLib/Resx/ResUI.resx | 6 - v2rayN/ServiceLib/Resx/ResUI.ru.resx | 6 - v2rayN/ServiceLib/Resx/ResUI.zh-Hans.resx | 6 - v2rayN/ServiceLib/Resx/ResUI.zh-Hant.resx | 6 - .../CoreConfig/CoreConfigSingboxService.cs | 60 +++----- .../CoreConfig/CoreConfigV2rayService.cs | 34 ++--- .../ViewModels/RoutingSettingViewModel.cs | 105 -------------- .../ViewModels/StatusBarViewModel.cs | 7 +- .../Views/RoutingSettingWindow.axaml | 5 - v2rayN/v2rayN/Handler/WindowsHandler.cs | 5 - v2rayN/v2rayN/Views/RoutingSettingWindow.xaml | 128 ------------------ .../v2rayN/Views/RoutingSettingWindow.xaml.cs | 19 --- 17 files changed, 44 insertions(+), 394 deletions(-) diff --git a/v2rayN/ServiceLib/Handler/AppHandler.cs b/v2rayN/ServiceLib/Handler/AppHandler.cs index 5ac0e705..9615b73a 100644 --- a/v2rayN/ServiceLib/Handler/AppHandler.cs +++ b/v2rayN/ServiceLib/Handler/AppHandler.cs @@ -211,12 +211,12 @@ public async Task?> RoutingItems() { - return await SQLiteHelper.Instance.TableAsync().Where(it => it.Locked == false).OrderBy(t => t.Sort).ToListAsync(); + return await SQLiteHelper.Instance.TableAsync().OrderBy(t => t.Sort).ToListAsync(); } public async Task GetRoutingItem(string id) { - return await SQLiteHelper.Instance.TableAsync().FirstOrDefaultAsync(it => it.Locked == false && it.Id == id); + return await SQLiteHelper.Instance.TableAsync().FirstOrDefaultAsync(it => it.Id == id); } public async Task?> DNSItems() diff --git a/v2rayN/ServiceLib/Handler/ConfigHandler.cs b/v2rayN/ServiceLib/Handler/ConfigHandler.cs index 84e6b6b4..4fbffbe6 100644 --- a/v2rayN/ServiceLib/Handler/ConfigHandler.cs +++ b/v2rayN/ServiceLib/Handler/ConfigHandler.cs @@ -65,10 +65,8 @@ namespace ServiceLib.Handler config.Inbound[0].Protocol = EInboundProtocol.socks.ToString(); } } - config.RoutingBasicItem ??= new() - { - EnableRoutingAdvanced = true - }; + + config.RoutingBasicItem ??= new(); if (Utils.IsNullOrEmpty(config.RoutingBasicItem.DomainStrategy)) { @@ -1600,7 +1598,7 @@ namespace ServiceLib.Handler var item = await AppHandler.Instance.GetRoutingItem(config.RoutingBasicItem.RoutingIndexId); if (item is null) { - var item2 = await SQLiteHelper.Instance.TableAsync().FirstOrDefaultAsync(t => t.Locked == false); + var item2 = await SQLiteHelper.Instance.TableAsync().FirstOrDefaultAsync(); await SetDefaultRouting(config, item2); return item2; } @@ -1674,6 +1672,15 @@ namespace ServiceLib.Handler { var ver = "V3-"; var items = await AppHandler.Instance.RoutingItems(); + + //TODO Temporary code to be removed later + var lockItem = items?.FirstOrDefault(t => t.Locked == true); + if (lockItem != null) + { + await ConfigHandler.RemoveRoutingItem(lockItem); + items = await AppHandler.Instance.RoutingItems(); + } + if (!blImportAdvancedRules && items.Where(t => t.Remarks.StartsWith(ver)).ToList().Count > 0) { return 0; @@ -1714,11 +1721,6 @@ namespace ServiceLib.Handler return 0; } - public static async Task GetLockedRoutingItem(Config config) - { - return await SQLiteHelper.Instance.TableAsync().FirstOrDefaultAsync(it => it.Locked == true); - } - public static async Task RemoveRoutingItem(RoutingItem routingItem) { await SQLiteHelper.Instance.DeleteAsync(routingItem); diff --git a/v2rayN/ServiceLib/Models/ConfigItems.cs b/v2rayN/ServiceLib/Models/ConfigItems.cs index 7de1794c..75943e2a 100644 --- a/v2rayN/ServiceLib/Models/ConfigItems.cs +++ b/v2rayN/ServiceLib/Models/ConfigItems.cs @@ -180,7 +180,6 @@ public string DomainStrategy4Singbox { get; set; } public string DomainMatcher { get; set; } public string RoutingIndexId { get; set; } - public bool EnableRoutingAdvanced { get; set; } } [Serializable] diff --git a/v2rayN/ServiceLib/Resx/ResUI.Designer.cs b/v2rayN/ServiceLib/Resx/ResUI.Designer.cs index ea43a4ef..86355997 100644 --- a/v2rayN/ServiceLib/Resx/ResUI.Designer.cs +++ b/v2rayN/ServiceLib/Resx/ResUI.Designer.cs @@ -1365,24 +1365,6 @@ namespace ServiceLib.Resx { } } - /// - /// 查找类似 Basic Function 的本地化字符串。 - /// - public static string menuRoutingBasic { - get { - return ResourceManager.GetString("menuRoutingBasic", resourceCulture); - } - } - - /// - /// 查找类似 Import Basic Rules 的本地化字符串。 - /// - public static string menuRoutingBasicImportRules { - get { - return ResourceManager.GetString("menuRoutingBasicImportRules", resourceCulture); - } - } - /// /// 查找类似 RoutingRuleDetailsSetting 的本地化字符串。 /// diff --git a/v2rayN/ServiceLib/Resx/ResUI.fa-Ir.resx b/v2rayN/ServiceLib/Resx/ResUI.fa-Ir.resx index f940823c..3b90ede6 100644 --- a/v2rayN/ServiceLib/Resx/ResUI.fa-Ir.resx +++ b/v2rayN/ServiceLib/Resx/ResUI.fa-Ir.resx @@ -847,12 +847,6 @@ Set as active rule - - عملکرد پایه - - - واردات قوانین اساسی - تطبیق دامنه diff --git a/v2rayN/ServiceLib/Resx/ResUI.resx b/v2rayN/ServiceLib/Resx/ResUI.resx index 95a85755..50f47431 100644 --- a/v2rayN/ServiceLib/Resx/ResUI.resx +++ b/v2rayN/ServiceLib/Resx/ResUI.resx @@ -850,12 +850,6 @@ Set as active rule(Enter) - - Basic Function - - - Import Basic Rules - Domain Matcher diff --git a/v2rayN/ServiceLib/Resx/ResUI.ru.resx b/v2rayN/ServiceLib/Resx/ResUI.ru.resx index 4637717e..77d2314b 100644 --- a/v2rayN/ServiceLib/Resx/ResUI.ru.resx +++ b/v2rayN/ServiceLib/Resx/ResUI.ru.resx @@ -856,12 +856,6 @@ Установить как активное правило - - Основные функции - - - Импорт основных правил - Сопоставитель доменов diff --git a/v2rayN/ServiceLib/Resx/ResUI.zh-Hans.resx b/v2rayN/ServiceLib/Resx/ResUI.zh-Hans.resx index 61c72dc5..e6c33ce8 100644 --- a/v2rayN/ServiceLib/Resx/ResUI.zh-Hans.resx +++ b/v2rayN/ServiceLib/Resx/ResUI.zh-Hans.resx @@ -850,12 +850,6 @@ 设为活动规则 (Enter) - - 基础功能 - - - 一键导入基础规则 - 域名匹配算法 diff --git a/v2rayN/ServiceLib/Resx/ResUI.zh-Hant.resx b/v2rayN/ServiceLib/Resx/ResUI.zh-Hant.resx index 3d6e9777..05aaf56e 100644 --- a/v2rayN/ServiceLib/Resx/ResUI.zh-Hant.resx +++ b/v2rayN/ServiceLib/Resx/ResUI.zh-Hant.resx @@ -850,12 +850,6 @@ 設為活動規則 (Enter) - - 基礎功能 - - - 一鍵匯入基礎規則 - 域名匹配演算法 diff --git a/v2rayN/ServiceLib/Services/CoreConfig/CoreConfigSingboxService.cs b/v2rayN/ServiceLib/Services/CoreConfig/CoreConfigSingboxService.cs index cbdefc86..824a2a2c 100644 --- a/v2rayN/ServiceLib/Services/CoreConfig/CoreConfigSingboxService.cs +++ b/v2rayN/ServiceLib/Services/CoreConfig/CoreConfigSingboxService.cs @@ -119,7 +119,7 @@ namespace ServiceLib.Services.CoreConfig await GenLog(singboxConfig); //GenDns(new(), singboxConfig); - singboxConfig.inbounds.Clear(); + singboxConfig.inbounds.Clear(); singboxConfig.outbounds.RemoveAt(0); var httpPort = AppHandler.Instance.GetLocalPort(EInboundProtocol.speedtest); @@ -499,13 +499,10 @@ namespace ServiceLib.Services.CoreConfig inbound.sniff_override_destination = _config.Inbound[0].RouteOnly ? false : _config.Inbound[0].SniffingEnabled; inbound.domain_strategy = Utils.IsNullOrEmpty(_config.RoutingBasicItem.DomainStrategy4Singbox) ? null : _config.RoutingBasicItem.DomainStrategy4Singbox; - if (_config.RoutingBasicItem.EnableRoutingAdvanced) + var routing = await ConfigHandler.GetDefaultRouting(_config); + if (Utils.IsNotEmpty(routing.DomainStrategy4Singbox)) { - var routing = await ConfigHandler.GetDefaultRouting(_config); - if (Utils.IsNotEmpty(routing.DomainStrategy4Singbox)) - { - inbound.domain_strategy = routing.DomainStrategy4Singbox; - } + inbound.domain_strategy = routing.DomainStrategy4Singbox; } //http @@ -958,28 +955,13 @@ namespace ServiceLib.Services.CoreConfig }); } - if (_config.RoutingBasicItem.EnableRoutingAdvanced) - { - var routing = await ConfigHandler.GetDefaultRouting(_config); - if (routing != null) - { - var rules = JsonUtils.Deserialize>(routing.RuleSet); - foreach (var item in rules ?? []) - { - if (item.Enabled) - { - await GenRoutingUserRule(item, singboxConfig.route.rules); - } - } - } - } - else + var routing = await ConfigHandler.GetDefaultRouting(_config); + if (routing != null) { - var lockedItem = await ConfigHandler.GetLockedRoutingItem(_config); - if (lockedItem != null) + var rules = JsonUtils.Deserialize>(routing.RuleSet); + foreach (var item in rules ?? []) { - var rules = JsonUtils.Deserialize>(lockedItem.RuleSet); - foreach (var item in rules ?? []) + if (item.Enabled) { await GenRoutingUserRule(item, singboxConfig.route.rules); } @@ -1334,20 +1316,18 @@ namespace ServiceLib.Services.CoreConfig //load custom ruleset file List customRulesets = []; - if (_config.RoutingBasicItem.EnableRoutingAdvanced) + + var routing = await ConfigHandler.GetDefaultRouting(_config); + if (Utils.IsNotEmpty(routing.CustomRulesetPath4Singbox)) { - var routing = await ConfigHandler.GetDefaultRouting(_config); - if (Utils.IsNotEmpty(routing.CustomRulesetPath4Singbox)) - { - var result = Utils.LoadResource(routing.CustomRulesetPath4Singbox); - if (Utils.IsNotEmpty(result)) - { - customRulesets = (JsonUtils.Deserialize>(result) ?? []) - .Where(t => t.tag != null) - .Where(t => t.type != null) - .Where(t => t.format != null) - .ToList(); - } + var result = Utils.LoadResource(routing.CustomRulesetPath4Singbox); + if (Utils.IsNotEmpty(result)) + { + customRulesets = (JsonUtils.Deserialize>(result) ?? []) + .Where(t => t.tag != null) + .Where(t => t.type != null) + .Where(t => t.format != null) + .ToList(); } } diff --git a/v2rayN/ServiceLib/Services/CoreConfig/CoreConfigV2rayService.cs b/v2rayN/ServiceLib/Services/CoreConfig/CoreConfigV2rayService.cs index 35ed0a5d..dd89df58 100644 --- a/v2rayN/ServiceLib/Services/CoreConfig/CoreConfigV2rayService.cs +++ b/v2rayN/ServiceLib/Services/CoreConfig/CoreConfigV2rayService.cs @@ -244,7 +244,7 @@ namespace ServiceLib.Services.CoreConfig } await GenLog(v2rayConfig); - v2rayConfig.inbounds.Clear(); + v2rayConfig.inbounds.Clear(); v2rayConfig.outbounds.Clear(); v2rayConfig.routing.rules.Clear(); @@ -316,7 +316,7 @@ namespace ServiceLib.Services.CoreConfig { continue; } - + //inbound Inbounds4Ray inbound = new() { @@ -467,33 +467,17 @@ namespace ServiceLib.Services.CoreConfig v2rayConfig.routing.domainStrategy = _config.RoutingBasicItem.DomainStrategy; v2rayConfig.routing.domainMatcher = Utils.IsNullOrEmpty(_config.RoutingBasicItem.DomainMatcher) ? null : _config.RoutingBasicItem.DomainMatcher; - if (_config.RoutingBasicItem.EnableRoutingAdvanced) + var routing = await ConfigHandler.GetDefaultRouting(_config); + if (routing != null) { - var routing = await ConfigHandler.GetDefaultRouting(_config); - if (routing != null) + if (Utils.IsNotEmpty(routing.DomainStrategy)) { - if (Utils.IsNotEmpty(routing.DomainStrategy)) - { - v2rayConfig.routing.domainStrategy = routing.DomainStrategy; - } - var rules = JsonUtils.Deserialize>(routing.RuleSet); - foreach (var item in rules) - { - if (item.Enabled) - { - var item2 = JsonUtils.Deserialize(JsonUtils.Serialize(item)); - await GenRoutingUserRule(item2, v2rayConfig); - } - } + v2rayConfig.routing.domainStrategy = routing.DomainStrategy; } - } - else - { - var lockedItem = await ConfigHandler.GetLockedRoutingItem(_config); - if (lockedItem != null) + var rules = JsonUtils.Deserialize>(routing.RuleSet); + foreach (var item in rules) { - var rules = JsonUtils.Deserialize>(lockedItem.RuleSet); - foreach (var item in rules) + if (item.Enabled) { var item2 = JsonUtils.Deserialize(JsonUtils.Serialize(item)); await GenRoutingUserRule(item2, v2rayConfig); diff --git a/v2rayN/ServiceLib/ViewModels/RoutingSettingViewModel.cs b/v2rayN/ServiceLib/ViewModels/RoutingSettingViewModel.cs index d04bf34e..f06b414d 100644 --- a/v2rayN/ServiceLib/ViewModels/RoutingSettingViewModel.cs +++ b/v2rayN/ServiceLib/ViewModels/RoutingSettingViewModel.cs @@ -7,9 +7,6 @@ namespace ServiceLib.ViewModels { public class RoutingSettingViewModel : MyReactiveObject { - private RoutingItem _lockedItem; - private List _lockedRules; - #region Reactive private IObservableCollection _routingItems = new ObservableCollectionExtended(); @@ -20,12 +17,6 @@ namespace ServiceLib.ViewModels public IList SelectedSources { get; set; } - [Reactive] - public bool enableRoutingAdvanced { get; set; } - - [Reactive] - public bool enableRoutingBasic { get; set; } - [Reactive] public string domainStrategy { get; set; } @@ -35,25 +26,6 @@ namespace ServiceLib.ViewModels [Reactive] public string domainStrategy4Singbox { get; set; } - [Reactive] - public string ProxyDomain { get; set; } - - [Reactive] - public string ProxyIP { get; set; } - - [Reactive] - public string DirectDomain { get; set; } - - [Reactive] - public string DirectIP { get; set; } - - [Reactive] - public string BlockDomain { get; set; } - - [Reactive] - public string BlockIP { get; set; } - - public ReactiveCommand RoutingBasicImportRulesCmd { get; } public ReactiveCommand RoutingAdvancedAddCmd { get; } public ReactiveCommand RoutingAdvancedRemoveCmd { get; } public ReactiveCommand RoutingAdvancedSetDefaultCmd { get; } @@ -73,15 +45,6 @@ namespace ServiceLib.ViewModels x => x.SelectedSource, selectedSource => selectedSource != null && !selectedSource.Remarks.IsNullOrEmpty()); - this.WhenAnyValue( - x => x.enableRoutingAdvanced) - .Subscribe(c => enableRoutingBasic = !enableRoutingAdvanced); - - RoutingBasicImportRulesCmd = ReactiveCommand.CreateFromTask(async () => - { - await RoutingBasicImportRules(); - }); - RoutingAdvancedAddCmd = ReactiveCommand.CreateFromTask(async () => { await RoutingAdvancedEditAsync(true); @@ -111,67 +74,14 @@ namespace ServiceLib.ViewModels { SelectedSource = new(); - enableRoutingAdvanced = true;//TODO _config.RoutingBasicItem.EnableRoutingAdvanced; domainStrategy = _config.RoutingBasicItem.DomainStrategy; domainMatcher = _config.RoutingBasicItem.DomainMatcher; domainStrategy4Singbox = _config.RoutingBasicItem.DomainStrategy4Singbox; await ConfigHandler.InitBuiltinRouting(_config); await RefreshRoutingItems(); - await BindingLockedData(); } - #region locked - - private async Task BindingLockedData() - { - _lockedItem = await ConfigHandler.GetLockedRoutingItem(_config); - if (_lockedItem == null) - { - _lockedItem = new RoutingItem() - { - Remarks = "locked", - Url = string.Empty, - Locked = true, - }; - await ConfigHandler.AddBatchRoutingRules(_lockedItem, Utils.GetEmbedText(Global.CustomRoutingFileName + "locked")); - } - - if (_lockedItem != null) - { - _lockedRules = JsonUtils.Deserialize>(_lockedItem.RuleSet); - ProxyDomain = Utils.List2String(_lockedRules[0].Domain, true); - ProxyIP = Utils.List2String(_lockedRules[0].Ip, true); - - DirectDomain = Utils.List2String(_lockedRules[1].Domain, true); - DirectIP = Utils.List2String(_lockedRules[1].Ip, true); - - BlockDomain = Utils.List2String(_lockedRules[2].Domain, true); - BlockIP = Utils.List2String(_lockedRules[2].Ip, true); - } - } - - private async Task EndBindingLockedData() - { - if (_lockedItem != null) - { - _lockedRules[0].Domain = Utils.String2List(Utils.Convert2Comma(ProxyDomain.TrimEx())); - _lockedRules[0].Ip = Utils.String2List(Utils.Convert2Comma(ProxyIP.TrimEx())); - - _lockedRules[1].Domain = Utils.String2List(Utils.Convert2Comma(DirectDomain.TrimEx())); - _lockedRules[1].Ip = Utils.String2List(Utils.Convert2Comma(DirectIP.TrimEx())); - - _lockedRules[2].Domain = Utils.String2List(Utils.Convert2Comma(BlockDomain.TrimEx())); - _lockedRules[2].Ip = Utils.String2List(Utils.Convert2Comma(BlockIP.TrimEx())); - - _lockedItem.RuleSet = JsonUtils.Serialize(_lockedRules, false); - - await ConfigHandler.SaveRoutingItem(_config, _lockedItem); - } - } - - #endregion locked - #region Refresh Save public async Task RefreshRoutingItems() @@ -205,12 +115,9 @@ namespace ServiceLib.ViewModels private async Task SaveRoutingAsync() { _config.RoutingBasicItem.DomainStrategy = domainStrategy; - _config.RoutingBasicItem.EnableRoutingAdvanced = enableRoutingAdvanced; _config.RoutingBasicItem.DomainMatcher = domainMatcher; _config.RoutingBasicItem.DomainStrategy4Singbox = domainStrategy4Singbox; - await EndBindingLockedData(); - if (await ConfigHandler.SaveConfig(_config) == 0) { NoticeHandler.Instance.Enqueue(ResUI.OperationSuccess); @@ -224,18 +131,6 @@ namespace ServiceLib.ViewModels #endregion Refresh Save - private async Task RoutingBasicImportRules() - { - //Extra to bypass the mainland - ProxyDomain = "geosite:google"; - DirectDomain = "geosite:cn"; - DirectIP = "geoip:private,geoip:cn"; - BlockDomain = "geosite:category-ads-all"; - - //NoticeHandler.Instance.Enqueue(ResUI.OperationSuccess); - NoticeHandler.Instance.Enqueue(ResUI.OperationSuccess); - } - public async Task RoutingAdvancedEditAsync(bool blNew) { RoutingItem item; diff --git a/v2rayN/ServiceLib/ViewModels/StatusBarViewModel.cs b/v2rayN/ServiceLib/ViewModels/StatusBarViewModel.cs index 89fbefc5..73ee0866 100644 --- a/v2rayN/ServiceLib/ViewModels/StatusBarViewModel.cs +++ b/v2rayN/ServiceLib/ViewModels/StatusBarViewModel.cs @@ -347,11 +347,6 @@ namespace ServiceLib.ViewModels public async Task RefreshRoutingsMenu() { _routingItems.Clear(); - if (!_config.RoutingBasicItem.EnableRoutingAdvanced) - { - BlRouting = false; - return; - } BlRouting = true; var routings = await AppHandler.Instance.RoutingItems(); @@ -474,7 +469,7 @@ namespace ServiceLib.ViewModels } else { - InboundLanDisplay = $"{ResUI.LabLAN}:None"; + InboundLanDisplay = $"{ResUI.LabLAN}:{Global.None}"; } } diff --git a/v2rayN/v2rayN.Desktop/Views/RoutingSettingWindow.axaml b/v2rayN/v2rayN.Desktop/Views/RoutingSettingWindow.axaml index b8f59c0b..00589a60 100644 --- a/v2rayN/v2rayN.Desktop/Views/RoutingSettingWindow.axaml +++ b/v2rayN/v2rayN.Desktop/Views/RoutingSettingWindow.axaml @@ -15,7 +15,6 @@ mc:Ignorable="d"> - - - - - \ No newline at end of file diff --git a/v2rayN/v2rayN/Handler/WindowsHandler.cs b/v2rayN/v2rayN/Handler/WindowsHandler.cs index 6fe94cf4..ddc7d2f3 100644 --- a/v2rayN/v2rayN/Handler/WindowsHandler.cs +++ b/v2rayN/v2rayN/Handler/WindowsHandler.cs @@ -54,11 +54,6 @@ namespace v2rayN.Handler { try { - if (!config.RoutingBasicItem.EnableRoutingAdvanced) - { - return null; - } - var item = await ConfigHandler.GetDefaultRouting(config); if (item == null || Utils.IsNullOrEmpty(item.CustomIcon) || !File.Exists(item.CustomIcon)) { diff --git a/v2rayN/v2rayN/Views/RoutingSettingWindow.xaml b/v2rayN/v2rayN/Views/RoutingSettingWindow.xaml index 70621361..0793adee 100644 --- a/v2rayN/v2rayN/Views/RoutingSettingWindow.xaml +++ b/v2rayN/v2rayN/Views/RoutingSettingWindow.xaml @@ -28,23 +28,6 @@ VerticalAlignment="Center" ClipToBounds="True" Style="{StaticResource MaterialDesignToolBar}"> - - - - - - - - - - - @@ -66,16 +49,6 @@ Header="{x:Static resx:ResUI.menuRoutingAdvancedImportRules}" /> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/v2rayN/v2rayN/Views/RoutingSettingWindow.xaml.cs b/v2rayN/v2rayN/Views/RoutingSettingWindow.xaml.cs index f2b51e79..6ce5c66e 100644 --- a/v2rayN/v2rayN/Views/RoutingSettingWindow.xaml.cs +++ b/v2rayN/v2rayN/Views/RoutingSettingWindow.xaml.cs @@ -39,24 +39,10 @@ namespace v2rayN.Views this.OneWayBind(ViewModel, vm => vm.RoutingItems, v => v.lstRoutings.ItemsSource).DisposeWith(disposables); this.Bind(ViewModel, vm => vm.SelectedSource, v => v.lstRoutings.SelectedItem).DisposeWith(disposables); - //this.Bind(ViewModel, vm => vm.enableRoutingAdvanced, v => v.togenableRoutingAdvanced.IsChecked).DisposeWith(disposables); this.Bind(ViewModel, vm => vm.domainStrategy, v => v.cmbdomainStrategy.Text).DisposeWith(disposables); this.Bind(ViewModel, vm => vm.domainMatcher, v => v.cmbdomainMatcher.Text).DisposeWith(disposables); this.Bind(ViewModel, vm => vm.domainStrategy4Singbox, v => v.cmbdomainStrategy4Singbox.Text).DisposeWith(disposables); - this.Bind(ViewModel, vm => vm.ProxyDomain, v => v.txtProxyDomain.Text).DisposeWith(disposables); - this.Bind(ViewModel, vm => vm.ProxyIP, v => v.txtProxyIP.Text).DisposeWith(disposables); - this.Bind(ViewModel, vm => vm.DirectDomain, v => v.txtDirectDomain.Text).DisposeWith(disposables); - this.Bind(ViewModel, vm => vm.DirectIP, v => v.txtDirectIP.Text).DisposeWith(disposables); - this.Bind(ViewModel, vm => vm.BlockDomain, v => v.txtBlockDomain.Text).DisposeWith(disposables); - this.Bind(ViewModel, vm => vm.BlockIP, v => v.txtBlockIP.Text).DisposeWith(disposables); - - this.OneWayBind(ViewModel, vm => vm.enableRoutingBasic, v => v.menuRoutingBasic.Visibility).DisposeWith(disposables); - this.OneWayBind(ViewModel, vm => vm.enableRoutingAdvanced, v => v.menuRoutingAdvanced.Visibility).DisposeWith(disposables); - this.OneWayBind(ViewModel, vm => vm.enableRoutingBasic, v => v.tabBasic.Visibility).DisposeWith(disposables); - this.OneWayBind(ViewModel, vm => vm.enableRoutingAdvanced, v => v.tabAdvanced.Visibility).DisposeWith(disposables); - - this.BindCommand(ViewModel, vm => vm.RoutingBasicImportRulesCmd, v => v.menuRoutingBasicImportRules).DisposeWith(disposables); this.BindCommand(ViewModel, vm => vm.RoutingAdvancedAddCmd, v => v.menuRoutingAdvancedAdd).DisposeWith(disposables); this.BindCommand(ViewModel, vm => vm.RoutingAdvancedAddCmd, v => v.menuRoutingAdvancedAdd2).DisposeWith(disposables); this.BindCommand(ViewModel, vm => vm.RoutingAdvancedRemoveCmd, v => v.menuRoutingAdvancedRemove).DisposeWith(disposables); @@ -102,11 +88,6 @@ namespace v2rayN.Views private void RoutingSettingWindow_PreviewKeyDown(object sender, KeyEventArgs e) { - if (ViewModel?.enableRoutingBasic ?? false) - { - return; - } - if (Keyboard.IsKeyDown(Key.LeftCtrl) || Keyboard.IsKeyDown(Key.RightCtrl)) { if (e.Key == Key.A)