diff --git a/v2rayN/ServiceLib/Global.cs b/v2rayN/ServiceLib/Global.cs index 73ec731b..48d39d6f 100644 --- a/v2rayN/ServiceLib/Global.cs +++ b/v2rayN/ServiceLib/Global.cs @@ -116,18 +116,16 @@ public static readonly List GeoFilesSources = new() { "", - GeoUrl, @"https://github.com/runetfreedom/russia-v2ray-rules-dat/releases/latest/download/{0}.dat", }; public static readonly List SingboxRulesetSources = new() { "", - SingboxRulesetUrl, @"https://raw.githubusercontent.com/runetfreedom/russia-v2ray-rules-dat/refs/heads/release/sing-box/rule-set-{0}/{1}.srs", }; public static readonly List RoutingRulesSources = new() { - "", //Default + "", @"https://raw.githubusercontent.com/runetfreedom/russia-v2ray-custom-routing-list/refs/heads/main/template.json", }; diff --git a/v2rayN/ServiceLib/Handler/ConfigHandler.cs b/v2rayN/ServiceLib/Handler/ConfigHandler.cs index 937061d4..71f7d47e 100644 --- a/v2rayN/ServiceLib/Handler/ConfigHandler.cs +++ b/v2rayN/ServiceLib/Handler/ConfigHandler.cs @@ -1,6 +1,4 @@ -using ServiceLib.Common; -using System.Data; -using System.Text.Json.Nodes; +using System.Data; using System.Text.RegularExpressions; namespace ServiceLib.Handler @@ -1620,24 +1618,13 @@ namespace ServiceLib.Handler public static int InitRouting(Config config, bool blImportAdvancedRules = false) { - if (!String.IsNullOrEmpty(config.constItem.routeRulesTemplateSourceUrl)) - { - InitExternalRouting(config, blImportAdvancedRules); - } - else + if (string.IsNullOrEmpty(config.constItem.routeRulesTemplateSourceUrl)) { InitBuiltinRouting(config, blImportAdvancedRules); } - - if (GetLockedRoutingItem(config) == null) + else { - var item1 = new RoutingItem() - { - remarks = "locked", - url = string.Empty, - locked = true, - }; - AddBatchRoutingRules(ref item1, Utils.GetEmbedText(Global.CustomRoutingFileName + "locked")); + InitExternalRouting(config, blImportAdvancedRules); } return 0; @@ -1645,10 +1632,10 @@ namespace ServiceLib.Handler public static int InitExternalRouting(Config config, bool blImportAdvancedRules = false) { - DownloadService downloadHandle = new DownloadService(); + var downloadHandle = new DownloadService(); var templateContent = Task.Run(() => downloadHandle.TryDownloadString(config.constItem.routeRulesTemplateSourceUrl, false, "")).Result; if (String.IsNullOrEmpty(templateContent)) - return InitBuiltinRouting(config, blImportAdvancedRules); // fallback + return InitBuiltinRouting(config, blImportAdvancedRules); // fallback var template = JsonUtils.Deserialize(templateContent); if (template == null) @@ -1656,35 +1643,35 @@ namespace ServiceLib.Handler var items = AppHandler.Instance.RoutingItems(); var maxSort = items.Count; - - if (blImportAdvancedRules || items.Where(t => t.remarks.StartsWith(template.version)).ToList().Count <= 0) + if (!blImportAdvancedRules && items.Where(t => t.remarks.StartsWith(template.version)).ToList().Count > 0) { - for (var i = 0; i < template.routingItems.Length; i++) + return 0; + } + for (var i = 0; i < template.routingItems.Length; i++) + { + var item = template.routingItems[i]; + + if (String.IsNullOrEmpty(item.url) && String.IsNullOrEmpty(item.ruleSet)) + continue; + + var ruleSetsString = !String.IsNullOrEmpty(item.ruleSet) + ? item.ruleSet + : Task.Run(() => downloadHandle.TryDownloadString(item.url, false, "")).Result; + + if (String.IsNullOrEmpty(ruleSetsString)) + continue; + + item.remarks = $"{template.version}-{item.remarks}"; + item.enabled = true; + item.sort = ++maxSort; + item.url = string.Empty; + + AddBatchRoutingRules(ref item, ruleSetsString); + + //first rule as default at first startup + if (!blImportAdvancedRules && i == 0) { - var item = template.routingItems[i]; - - if (String.IsNullOrEmpty(item.url) && String.IsNullOrEmpty(item.ruleSet)) - continue; - - var ruleSetsString = !String.IsNullOrEmpty(item.ruleSet) - ? item.ruleSet - : Task.Run(() => downloadHandle.TryDownloadString(item.url, false, "")).Result; - - if (String.IsNullOrEmpty(ruleSetsString)) - continue; - - item.remarks = $"{template.version}-{item.remarks}"; - item.enabled = true; - item.sort = ++maxSort; - item.url = string.Empty; - - AddBatchRoutingRules(ref item, ruleSetsString); - - //first rule as default at first startup - if (!blImportAdvancedRules && i == 0) - { - SetDefaultRouting(config, item); - } + SetDefaultRouting(config, item); } } @@ -1695,45 +1682,47 @@ namespace ServiceLib.Handler { var ver = "V3-"; var items = AppHandler.Instance.RoutingItems(); - if (blImportAdvancedRules || items.Where(t => t.remarks.StartsWith(ver)).ToList().Count <= 0) + if (!blImportAdvancedRules && items.Where(t => t.remarks.StartsWith(ver)).ToList().Count > 0) { - var maxSort = items.Count; - //Bypass the mainland - var item2 = new RoutingItem() - { - remarks = $"{ver}绕过大陆(Whitelist)", - url = string.Empty, - sort = maxSort + 1, - }; - AddBatchRoutingRules(ref item2, Utils.GetEmbedText(Global.CustomRoutingFileName + "white")); + return 0; + } - //Blacklist - var item3 = new RoutingItem() - { - remarks = $"{ver}黑名单(Blacklist)", - url = string.Empty, - sort = maxSort + 2, - }; - AddBatchRoutingRules(ref item3, Utils.GetEmbedText(Global.CustomRoutingFileName + "black")); + var maxSort = items.Count; + //Bypass the mainland + var item2 = new RoutingItem() + { + remarks = $"{ver}绕过大陆(Whitelist)", + url = string.Empty, + sort = maxSort + 1, + }; + AddBatchRoutingRules(ref item2, Utils.GetEmbedText(Global.CustomRoutingFileName + "white")); - //Global - var item1 = new RoutingItem() - { - remarks = $"{ver}全局(Global)", - url = string.Empty, - sort = maxSort + 3, - }; - AddBatchRoutingRules(ref item1, Utils.GetEmbedText(Global.CustomRoutingFileName + "global")); + //Blacklist + var item3 = new RoutingItem() + { + remarks = $"{ver}黑名单(Blacklist)", + url = string.Empty, + sort = maxSort + 2, + }; + AddBatchRoutingRules(ref item3, Utils.GetEmbedText(Global.CustomRoutingFileName + "black")); - if (!blImportAdvancedRules) - { - SetDefaultRouting(config, item2); - } + //Global + var item1 = new RoutingItem() + { + remarks = $"{ver}全局(Global)", + url = string.Empty, + sort = maxSort + 3, + }; + AddBatchRoutingRules(ref item1, Utils.GetEmbedText(Global.CustomRoutingFileName + "global")); + + if (!blImportAdvancedRules) + { + SetDefaultRouting(config, item2); } return 0; } - public static RoutingItem GetLockedRoutingItem(Config config) + public static RoutingItem? GetLockedRoutingItem(Config config) { return SQLiteHelper.Instance.Table().FirstOrDefault(it => it.locked == true); } @@ -1789,9 +1778,9 @@ namespace ServiceLib.Handler #endregion DNS - #region Presets + #region Regional Presets - public static bool ApplyPreset(Config config, EPresetType type) + public static bool ApplyRegionalPreset(Config config, EPresetType type) { switch (type) { @@ -1813,6 +1802,6 @@ namespace ServiceLib.Handler return false; } - #endregion + #endregion Regional Presets } } \ No newline at end of file diff --git a/v2rayN/ServiceLib/Resx/ResUI.Designer.cs b/v2rayN/ServiceLib/Resx/ResUI.Designer.cs index 0c92385c..9c3e1f69 100644 --- a/v2rayN/ServiceLib/Resx/ResUI.Designer.cs +++ b/v2rayN/ServiceLib/Resx/ResUI.Designer.cs @@ -1116,27 +1116,27 @@ namespace ServiceLib.Resx { /// /// 查找类似 Regional presets 的本地化字符串。 /// - public static string menuPresets { + public static string menuRegionalPresets { get { - return ResourceManager.GetString("menuPresets", resourceCulture); + return ResourceManager.GetString("menuRegionalPresets", resourceCulture); } } /// /// 查找类似 Default 的本地化字符串。 /// - public static string menuPresetsDefault { + public static string menuRegionalPresetsDefault { get { - return ResourceManager.GetString("menuPresetsDefault", resourceCulture); + return ResourceManager.GetString("menuRegionalPresetsDefault", resourceCulture); } } /// /// 查找类似 Russia 的本地化字符串。 /// - public static string menuPresetsRussia { + public static string menuRegionalPresetsRussia { get { - return ResourceManager.GetString("menuPresetsRussia", resourceCulture); + return ResourceManager.GetString("menuRegionalPresetsRussia", resourceCulture); } } @@ -2752,6 +2752,15 @@ namespace ServiceLib.Resx { } } + /// + /// 查找类似 Users in China region can ignore this item 的本地化字符串。 + /// + public static string TbSettingsChinaUserTip { + get { + return ResourceManager.GetString("TbSettingsChinaUserTip", resourceCulture); + } + } + /// /// 查找类似 Color 的本地化字符串。 /// @@ -3040,17 +3049,6 @@ namespace ServiceLib.Resx { } } - /// - /// 查找类似 Routing rules source (optional) 的本地化字符串。 - /// - public static string TbSettingsRoutingRulesSource - { - get - { - return ResourceManager.GetString("TbSettingsRoutingRulesSource", resourceCulture); - } - } - /// /// 查找类似 HTTP Port 的本地化字符串。 /// @@ -3204,6 +3202,15 @@ namespace ServiceLib.Resx { } } + /// + /// 查找类似 Routing rules source (optional) 的本地化字符串。 + /// + public static string TbSettingsRoutingRulesSource { + get { + return ResourceManager.GetString("TbSettingsRoutingRulesSource", resourceCulture); + } + } + /// /// 查找类似 Set Win10 UWP Loopback 的本地化字符串。 /// diff --git a/v2rayN/ServiceLib/Resx/ResUI.resx b/v2rayN/ServiceLib/Resx/ResUI.resx index cfc597e6..f8d7b39a 100644 --- a/v2rayN/ServiceLib/Resx/ResUI.resx +++ b/v2rayN/ServiceLib/Resx/ResUI.resx @@ -1339,13 +1339,16 @@ Routing rules source (optional) - - Regional presets + + Regional presets setting - + Default - + Russia + + Users in China region can ignore this item + \ No newline at end of file diff --git a/v2rayN/ServiceLib/Resx/ResUI.zh-Hans.resx b/v2rayN/ServiceLib/Resx/ResUI.zh-Hans.resx index 93b17220..2a8e1bd6 100644 --- a/v2rayN/ServiceLib/Resx/ResUI.zh-Hans.resx +++ b/v2rayN/ServiceLib/Resx/ResUI.zh-Hans.resx @@ -1333,4 +1333,19 @@ sing-box ruleset文件来源(可选) + + 路由规则集来源(可选) + + + 中国区域用户可忽略此项 + + + 区域预置设置 + + + 默认区域 + + + 俄罗斯 + \ No newline at end of file diff --git a/v2rayN/ServiceLib/Resx/ResUI.zh-Hant.resx b/v2rayN/ServiceLib/Resx/ResUI.zh-Hant.resx index 4450b74c..722b97d5 100644 --- a/v2rayN/ServiceLib/Resx/ResUI.zh-Hant.resx +++ b/v2rayN/ServiceLib/Resx/ResUI.zh-Hant.resx @@ -1213,4 +1213,19 @@ sing-box ruleset文件來源(可選) + + 路由规则集来源(可选) + + + 中国区域用户可忽略此项 + + + 区域预置设置 + + + 默认区域 + + + 俄羅斯 + \ No newline at end of file diff --git a/v2rayN/ServiceLib/ViewModels/MainWindowViewModel.cs b/v2rayN/ServiceLib/ViewModels/MainWindowViewModel.cs index efc1f15a..c4c292fb 100644 --- a/v2rayN/ServiceLib/ViewModels/MainWindowViewModel.cs +++ b/v2rayN/ServiceLib/ViewModels/MainWindowViewModel.cs @@ -45,8 +45,8 @@ namespace ServiceLib.ViewModels public ReactiveCommand OpenTheFileLocationCmd { get; } //Presets - public ReactiveCommand PresetDefaultCmd { get; } - public ReactiveCommand PresetRussiaCmd { get; } + public ReactiveCommand RegionalPresetDefaultCmd { get; } + public ReactiveCommand RegionalPresetRussiaCmd { get; } public ReactiveCommand ReloadCmd { get; } @@ -185,14 +185,14 @@ namespace ServiceLib.ViewModels await Reload(); }); - PresetDefaultCmd = ReactiveCommand.CreateFromTask(async () => + RegionalPresetDefaultCmd = ReactiveCommand.CreateFromTask(async () => { - await ApplyPreset(EPresetType.Default); + await ApplyRegionalPreset(EPresetType.Default); }); - PresetRussiaCmd = ReactiveCommand.CreateFromTask(async () => + RegionalPresetRussiaCmd = ReactiveCommand.CreateFromTask(async () => { - await ApplyPreset(EPresetType.Russia); + await ApplyRegionalPreset(EPresetType.Russia); }); #endregion WhenAnyValue && ReactiveCommand @@ -202,7 +202,7 @@ namespace ServiceLib.ViewModels private void Init() { - ConfigHandler.InitRouting(_config); + ConfigHandler.InitBuiltinRouting(_config); ConfigHandler.InitBuiltinDNS(_config); CoreHandler.Instance.Init(_config, UpdateHandler); TaskHandler.Instance.RegUpdateTask(_config, UpdateTaskHandler); @@ -445,7 +445,7 @@ namespace ServiceLib.ViewModels var ret = await _updateView?.Invoke(EViewAction.RoutingSettingWindow, null); if (ret == true) { - ConfigHandler.InitRouting(_config); + ConfigHandler.InitBuiltinRouting(_config); Locator.Current.GetService()?.RefreshRoutingsMenu(); Reload(); } @@ -560,16 +560,14 @@ namespace ServiceLib.ViewModels #region Presets - public async Task ApplyPreset(EPresetType type) + public async Task ApplyRegionalPreset(EPresetType type) { - ConfigHandler.ApplyPreset(_config, type); - - await new UpdateService().UpdateGeoFileAll(_config, UpdateHandler); - + ConfigHandler.ApplyRegionalPreset(_config, type); ConfigHandler.InitRouting(_config); Locator.Current.GetService()?.RefreshRoutingsMenu(); ConfigHandler.SaveConfig(_config, false); + await new UpdateService().UpdateGeoFileAll(_config, UpdateHandler); Reload(); } diff --git a/v2rayN/ServiceLib/ViewModels/RoutingSettingViewModel.cs b/v2rayN/ServiceLib/ViewModels/RoutingSettingViewModel.cs index 39289cc5..a4c4092b 100644 --- a/v2rayN/ServiceLib/ViewModels/RoutingSettingViewModel.cs +++ b/v2rayN/ServiceLib/ViewModels/RoutingSettingViewModel.cs @@ -71,7 +71,7 @@ namespace ServiceLib.ViewModels _updateView = updateView; SelectedSource = new(); - ConfigHandler.InitRouting(_config); + ConfigHandler.InitBuiltinRouting(_config); enableRoutingAdvanced = _config.routingBasicItem.enableRoutingAdvanced; domainStrategy = _config.routingBasicItem.domainStrategy; @@ -123,6 +123,17 @@ namespace ServiceLib.ViewModels private void BindingLockedData() { _lockedItem = ConfigHandler.GetLockedRoutingItem(_config); + if (_lockedItem == null) + { + _lockedItem = new RoutingItem() + { + remarks = "locked", + url = string.Empty, + locked = true, + }; + ConfigHandler.AddBatchRoutingRules(ref _lockedItem, Utils.GetEmbedText(Global.CustomRoutingFileName + "locked")); + } + if (_lockedItem != null) { _lockedRules = JsonUtils.Deserialize>(_lockedItem.ruleSet); diff --git a/v2rayN/ServiceLib/ViewModels/StatusBarViewModel.cs b/v2rayN/ServiceLib/ViewModels/StatusBarViewModel.cs index 315e7ebf..9e3dab2e 100644 --- a/v2rayN/ServiceLib/ViewModels/StatusBarViewModel.cs +++ b/v2rayN/ServiceLib/ViewModels/StatusBarViewModel.cs @@ -33,7 +33,6 @@ namespace ServiceLib.ViewModels public ReactiveCommand SubUpdateCmd { get; } public ReactiveCommand SubUpdateViaProxyCmd { get; } public ReactiveCommand NotifyLeftClickCmd { get; } - public ReactiveCommand ExitCmd { get; } #region System Proxy diff --git a/v2rayN/v2rayN.Desktop/Views/MainWindow.axaml b/v2rayN/v2rayN.Desktop/Views/MainWindow.axaml index 159de1d8..d490767e 100644 --- a/v2rayN/v2rayN.Desktop/Views/MainWindow.axaml +++ b/v2rayN/v2rayN.Desktop/Views/MainWindow.axaml @@ -74,15 +74,15 @@ - - - - + + + + diff --git a/v2rayN/v2rayN.Desktop/Views/MainWindow.axaml.cs b/v2rayN/v2rayN.Desktop/Views/MainWindow.axaml.cs index a417a876..2e965ab1 100644 --- a/v2rayN/v2rayN.Desktop/Views/MainWindow.axaml.cs +++ b/v2rayN/v2rayN.Desktop/Views/MainWindow.axaml.cs @@ -76,8 +76,8 @@ namespace v2rayN.Desktop.Views this.BindCommand(ViewModel, vm => vm.RebootAsAdminCmd, v => v.menuRebootAsAdmin).DisposeWith(disposables); this.BindCommand(ViewModel, vm => vm.ClearServerStatisticsCmd, v => v.menuClearServerStatistics).DisposeWith(disposables); this.BindCommand(ViewModel, vm => vm.OpenTheFileLocationCmd, v => v.menuOpenTheFileLocation).DisposeWith(disposables); - this.BindCommand(ViewModel, vm => vm.PresetDefaultCmd, v => v.menuPresetsDefault).DisposeWith(disposables); - this.BindCommand(ViewModel, vm => vm.PresetRussiaCmd, v => v.menuPresetsRussia).DisposeWith(disposables); + this.BindCommand(ViewModel, vm => vm.RegionalPresetDefaultCmd, v => v.menuRegionalPresetsDefault).DisposeWith(disposables); + this.BindCommand(ViewModel, vm => vm.RegionalPresetRussiaCmd, v => v.menuRegionalPresetsRussia).DisposeWith(disposables); this.BindCommand(ViewModel, vm => vm.ReloadCmd, v => v.menuReload).DisposeWith(disposables); this.OneWayBind(ViewModel, vm => vm.BlReloadEnabled, v => v.menuReload.IsEnabled).DisposeWith(disposables); diff --git a/v2rayN/v2rayN.Desktop/Views/OptionSettingWindow.axaml b/v2rayN/v2rayN.Desktop/Views/OptionSettingWindow.axaml index e073b02e..7d7ccbc3 100644 --- a/v2rayN/v2rayN.Desktop/Views/OptionSettingWindow.axaml +++ b/v2rayN/v2rayN.Desktop/Views/OptionSettingWindow.axaml @@ -80,7 +80,8 @@ Grid.Column="2" VerticalAlignment="Center" Classes="Margin8" - Text="{x:Static resx:ResUI.TbSettingsSocksPortTip}" /> + Text="{x:Static resx:ResUI.TbSettingsSocksPortTip}" + TextWrapping="Wrap" /> + Text="{x:Static resx:ResUI.TbSettingsEnableFragmentTips}" + TextWrapping="Wrap" /> @@ -626,6 +628,13 @@ Grid.Column="1" Width="300" Classes="Margin8" /> + + + + diff --git a/v2rayN/v2rayN.Desktop/Views/StatusBarView.axaml.cs b/v2rayN/v2rayN.Desktop/Views/StatusBarView.axaml.cs index 7e337452..da6aacce 100644 --- a/v2rayN/v2rayN.Desktop/Views/StatusBarView.axaml.cs +++ b/v2rayN/v2rayN.Desktop/Views/StatusBarView.axaml.cs @@ -38,52 +38,10 @@ namespace v2rayN.Desktop.Views this.Bind(ViewModel, vm => vm.EnableTun, v => v.togEnableTun.IsChecked).DisposeWith(disposables); this.Bind(ViewModel, vm => vm.SystemProxySelected, v => v.cmbSystemProxy.SelectedIndex).DisposeWith(disposables); - //this.OneWayBind(ViewModel, vm => vm.RoutingItems, v => v.cmbRoutings2.ItemsSource).DisposeWith(disposables); this.Bind(ViewModel, vm => vm.SelectedRouting, v => v.cmbRoutings2.SelectedItem).DisposeWith(disposables); - - ////system proxy - //this.OneWayBind(ViewModel, vm => vm.BlSystemProxyClear, v => v.menuSystemProxyClear2.Visibility, conversionHint: BooleanToVisibilityHint.UseHidden, vmToViewConverterOverride: new BooleanToVisibilityTypeConverter()).DisposeWith(disposables); - //this.OneWayBind(ViewModel, vm => vm.BlSystemProxySet, v => v.menuSystemProxySet2.Visibility, conversionHint: BooleanToVisibilityHint.UseHidden, vmToViewConverterOverride: new BooleanToVisibilityTypeConverter()).DisposeWith(disposables); - //this.OneWayBind(ViewModel, vm => vm.BlSystemProxyNothing, v => v.menuSystemProxyNothing2.Visibility, conversionHint: BooleanToVisibilityHint.UseHidden, vmToViewConverterOverride: new BooleanToVisibilityTypeConverter()).DisposeWith(disposables); - //this.OneWayBind(ViewModel, vm => vm.BlSystemProxyPac, v => v.menuSystemProxyPac2.Visibility, conversionHint: BooleanToVisibilityHint.UseHidden, vmToViewConverterOverride: new BooleanToVisibilityTypeConverter()).DisposeWith(disposables); - //this.BindCommand(ViewModel, vm => vm.SystemProxyClearCmd, v => v.menuSystemProxyClear).DisposeWith(disposables); - //this.BindCommand(ViewModel, vm => vm.SystemProxySetCmd, v => v.menuSystemProxySet).DisposeWith(disposables); - //this.BindCommand(ViewModel, vm => vm.SystemProxyPacCmd, v => v.menuSystemProxyPac).DisposeWith(disposables); - //this.BindCommand(ViewModel, vm => vm.SystemProxyNothingCmd, v => v.menuSystemProxyNothing).DisposeWith(disposables); - - ////routings and servers - //this.OneWayBind(ViewModel, vm => vm.RoutingItems, v => v.cmbRoutings.ItemsSource).DisposeWith(disposables); - //this.Bind(ViewModel, vm => vm.SelectedRouting, v => v.cmbRoutings.SelectedItem).DisposeWith(disposables); - //this.OneWayBind(ViewModel, vm => vm.BlRouting, v => v.menuRoutings.Visibility).DisposeWith(disposables); - //this.OneWayBind(ViewModel, vm => vm.BlRouting, v => v.sepRoutings.Visibility).DisposeWith(disposables); - - //this.OneWayBind(ViewModel, vm => vm.Servers, v => v.cmbServers.ItemsSource).DisposeWith(disposables); - //this.Bind(ViewModel, vm => vm.SelectedServer, v => v.cmbServers.SelectedItem).DisposeWith(disposables); - //this.OneWayBind(ViewModel, vm => vm.BlServers, v => v.cmbServers.Visibility).DisposeWith(disposables); - - ////tray menu - //this.BindCommand(ViewModel, vm => vm.AddServerViaClipboardCmd, v => v.menuAddServerViaClipboard2).DisposeWith(disposables); - //this.BindCommand(ViewModel, vm => vm.AddServerViaScanCmd, v => v.menuAddServerViaScan2).DisposeWith(disposables); - //this.BindCommand(ViewModel, vm => vm.SubUpdateCmd, v => v.menuSubUpdate2).DisposeWith(disposables); - //this.BindCommand(ViewModel, vm => vm.SubUpdateViaProxyCmd, v => v.menuSubUpdateViaProxy2).DisposeWith(disposables); - - //this.OneWayBind(ViewModel, vm => vm.RunningServerToolTipText, v => v.tbNotify.ToolTipText).DisposeWith(disposables); - //this.OneWayBind(ViewModel, vm => vm.NotifyLeftClickCmd, v => v.tbNotify.LeftClickCommand).DisposeWith(disposables); - - ////status bar - //this.OneWayBind(ViewModel, vm => vm.InboundDisplay, v => v.txtInboundDisplay.Text).DisposeWith(disposables); - //this.OneWayBind(ViewModel, vm => vm.InboundLanDisplay, v => v.txtInboundLanDisplay.Text).DisposeWith(disposables); - //this.OneWayBind(ViewModel, vm => vm.RunningServerDisplay, v => v.txtRunningServerDisplay.Text).DisposeWith(disposables); - //this.OneWayBind(ViewModel, vm => vm.RunningInfoDisplay, v => v.txtRunningInfoDisplay.Text).DisposeWith(disposables); - //this.OneWayBind(ViewModel, vm => vm.SpeedProxyDisplay, v => v.txtSpeedProxyDisplay.Text).DisposeWith(disposables); - //this.OneWayBind(ViewModel, vm => vm.SpeedDirectDisplay, v => v.txtSpeedDirectDisplay.Text).DisposeWith(disposables); - //this.Bind(ViewModel, vm => vm.EnableTun, v => v.togEnableTun.IsChecked).DisposeWith(disposables); - - //this.Bind(ViewModel, vm => vm.SystemProxySelected, v => v.cmbSystemProxy.SelectedIndex).DisposeWith(disposables); - //this.OneWayBind(ViewModel, vm => vm.RoutingItems, v => v.cmbRoutings2.ItemsSource).DisposeWith(disposables); - //this.Bind(ViewModel, vm => vm.SelectedRouting, v => v.cmbRoutings2.SelectedItem).DisposeWith(disposables); - //this.OneWayBind(ViewModel, vm => vm.BlRouting, v => v.cmbRoutings2.Visibility).DisposeWith(disposables); }); + + togEnableTun.IsVisible = (Utils.IsWindows() || AppHandler.Instance.IsAdministrator); } private async Task UpdateViewHandler(EViewAction action, object? obj) diff --git a/v2rayN/v2rayN/Views/MainWindow.xaml b/v2rayN/v2rayN/Views/MainWindow.xaml index c2143cf0..86503e46 100644 --- a/v2rayN/v2rayN/Views/MainWindow.xaml +++ b/v2rayN/v2rayN/Views/MainWindow.xaml @@ -171,16 +171,6 @@ x:Name="menuGlobalHotkeySetting" Height="{StaticResource MenuItemHeight}" Header="{x:Static resx:ResUI.menuGlobalHotkeySetting}" /> - - - - + + + + vm.RebootAsAdminCmd, v => v.menuRebootAsAdmin).DisposeWith(disposables); this.BindCommand(ViewModel, vm => vm.ClearServerStatisticsCmd, v => v.menuClearServerStatistics).DisposeWith(disposables); this.BindCommand(ViewModel, vm => vm.OpenTheFileLocationCmd, v => v.menuOpenTheFileLocation).DisposeWith(disposables); - this.BindCommand(ViewModel, vm => vm.PresetDefaultCmd, v => v.menuPresetsDefault).DisposeWith(disposables); - this.BindCommand(ViewModel, vm => vm.PresetRussiaCmd, v => v.menuPresetsRussia).DisposeWith(disposables); + this.BindCommand(ViewModel, vm => vm.RegionalPresetDefaultCmd, v => v.menuRegionalPresetsDefault).DisposeWith(disposables); + this.BindCommand(ViewModel, vm => vm.RegionalPresetRussiaCmd, v => v.menuRegionalPresetsRussia).DisposeWith(disposables); this.BindCommand(ViewModel, vm => vm.ReloadCmd, v => v.menuReload).DisposeWith(disposables); this.OneWayBind(ViewModel, vm => vm.BlReloadEnabled, v => v.menuReload.IsEnabled).DisposeWith(disposables); diff --git a/v2rayN/v2rayN/Views/OptionSettingWindow.xaml b/v2rayN/v2rayN/Views/OptionSettingWindow.xaml index d52bfe29..c42fc4c4 100644 --- a/v2rayN/v2rayN/Views/OptionSettingWindow.xaml +++ b/v2rayN/v2rayN/Views/OptionSettingWindow.xaml @@ -72,7 +72,7 @@ - + + Text="{x:Static resx:ResUI.TbSettingsSocksPortTip}" + TextWrapping="Wrap" /> + Text="{x:Static resx:ResUI.TbSettingsEnableFragmentTips}" + TextWrapping="Wrap" /> @@ -864,6 +866,14 @@ Margin="{StaticResource Margin8}" IsEditable="True" Style="{StaticResource DefComboBox}" /> + + + +