From a559586e71461b39f52eb85bb397a94ea2f6e8b3 Mon Sep 17 00:00:00 2001 From: 2dust <31833384+2dust@users.noreply.github.com> Date: Wed, 8 Oct 2025 15:48:51 +0800 Subject: [PATCH] Code clean --- v2rayN/ServiceLib/Manager/ActionPrecheckManager.cs | 5 ++--- .../Services/CoreConfig/Singbox/CoreConfigSingboxService.cs | 3 ++- .../Services/CoreConfig/Singbox/SingboxOutboundService.cs | 2 ++ .../Services/CoreConfig/V2ray/CoreConfigV2rayService.cs | 1 + .../Services/CoreConfig/V2ray/V2rayOutboundService.cs | 2 ++ v2rayN/v2rayN.Desktop/Views/AddGroupServerWindow.axaml.cs | 6 +++++- 6 files changed, 14 insertions(+), 5 deletions(-) diff --git a/v2rayN/ServiceLib/Manager/ActionPrecheckManager.cs b/v2rayN/ServiceLib/Manager/ActionPrecheckManager.cs index 69c0b915..2ae20c0b 100644 --- a/v2rayN/ServiceLib/Manager/ActionPrecheckManager.cs +++ b/v2rayN/ServiceLib/Manager/ActionPrecheckManager.cs @@ -54,7 +54,7 @@ public class ActionPrecheckManager(Config config) private async Task> ValidateNodeAndCoreSupport(ProfileItem item, ECoreType? coreType = null) { var errors = new List(); - + coreType ??= AppManager.Instance.GetCoreType(item, item.ConfigType); if (item.ConfigType is EConfigType.Custom) @@ -77,7 +77,6 @@ public class ActionPrecheckManager(Config config) return errors; } - switch (item.ConfigType) { case EConfigType.VMess: @@ -136,7 +135,7 @@ public class ActionPrecheckManager(Config config) { continue; } - + var childItem = await AppManager.Instance.GetProfileItem(child); if (childItem is null) { diff --git a/v2rayN/ServiceLib/Services/CoreConfig/Singbox/CoreConfigSingboxService.cs b/v2rayN/ServiceLib/Services/CoreConfig/Singbox/CoreConfigSingboxService.cs index fd77480a..8a46059d 100644 --- a/v2rayN/ServiceLib/Services/CoreConfig/Singbox/CoreConfigSingboxService.cs +++ b/v2rayN/ServiceLib/Services/CoreConfig/Singbox/CoreConfigSingboxService.cs @@ -28,13 +28,14 @@ public partial class CoreConfigSingboxService(Config config) } ret.Msg = ResUI.InitialConfiguration; - + if (node?.ConfigType is EConfigType.PolicyGroup or EConfigType.ProxyChain) { switch (node.ConfigType) { case EConfigType.PolicyGroup: return await GenerateClientMultipleLoadConfig(node); + case EConfigType.ProxyChain: return await GenerateClientChainConfig(node); } diff --git a/v2rayN/ServiceLib/Services/CoreConfig/Singbox/SingboxOutboundService.cs b/v2rayN/ServiceLib/Services/CoreConfig/Singbox/SingboxOutboundService.cs index 46c90b23..997e1281 100644 --- a/v2rayN/ServiceLib/Services/CoreConfig/Singbox/SingboxOutboundService.cs +++ b/v2rayN/ServiceLib/Services/CoreConfig/Singbox/SingboxOutboundService.cs @@ -236,9 +236,11 @@ public partial class CoreConfigSingboxService } break; + case EConfigType.ProxyChain: await GenChainOutboundsList(childProfiles, singboxConfig, baseTagName); break; + default: break; } diff --git a/v2rayN/ServiceLib/Services/CoreConfig/V2ray/CoreConfigV2rayService.cs b/v2rayN/ServiceLib/Services/CoreConfig/V2ray/CoreConfigV2rayService.cs index 37c55bca..d8768b3b 100644 --- a/v2rayN/ServiceLib/Services/CoreConfig/V2ray/CoreConfigV2rayService.cs +++ b/v2rayN/ServiceLib/Services/CoreConfig/V2ray/CoreConfigV2rayService.cs @@ -36,6 +36,7 @@ public partial class CoreConfigV2rayService(Config config) { case EConfigType.PolicyGroup: return await GenerateClientMultipleLoadConfig(node); + case EConfigType.ProxyChain: return await GenerateClientChainConfig(node); } diff --git a/v2rayN/ServiceLib/Services/CoreConfig/V2ray/V2rayOutboundService.cs b/v2rayN/ServiceLib/Services/CoreConfig/V2ray/V2rayOutboundService.cs index 58e4a840..bed2f28a 100644 --- a/v2rayN/ServiceLib/Services/CoreConfig/V2ray/V2rayOutboundService.cs +++ b/v2rayN/ServiceLib/Services/CoreConfig/V2ray/V2rayOutboundService.cs @@ -511,9 +511,11 @@ public partial class CoreConfigV2rayService await GenOutboundsListWithChain(childProfiles, v2rayConfig, baseTagName); } break; + case EConfigType.ProxyChain: await GenChainOutboundsList(childProfiles, v2rayConfig, baseTagName); break; + default: break; } diff --git a/v2rayN/v2rayN.Desktop/Views/AddGroupServerWindow.axaml.cs b/v2rayN/v2rayN.Desktop/Views/AddGroupServerWindow.axaml.cs index 720e5c29..2acaee55 100644 --- a/v2rayN/v2rayN.Desktop/Views/AddGroupServerWindow.axaml.cs +++ b/v2rayN/v2rayN.Desktop/Views/AddGroupServerWindow.axaml.cs @@ -40,6 +40,7 @@ public partial class AddGroupServerWindow : WindowBase case EConfigType.PolicyGroup: this.Title = ResUI.TbConfigTypePolicyGroup; break; + case EConfigType.ProxyChain: this.Title = ResUI.TbConfigTypeProxyChain; gridPolicyGroup.IsVisible = false; @@ -115,18 +116,22 @@ public partial class AddGroupServerWindow : WindowBase ViewModel?.MoveServer(EMove.Top); e.Handled = true; break; + case Key.U: ViewModel?.MoveServer(EMove.Up); e.Handled = true; break; + case Key.D: ViewModel?.MoveServer(EMove.Down); e.Handled = true; break; + case Key.B: ViewModel?.MoveServer(EMove.Bottom); e.Handled = true; break; + case Key.Delete: ViewModel?.ChildRemoveAsync(); e.Handled = true; @@ -162,5 +167,4 @@ public partial class AddGroupServerWindow : WindowBase ViewModel.SelectedChildren = lstChild.SelectedItems.Cast().ToList(); } } - }