Improve and optimize

pull/7649/head
2dust 2025-07-15 20:17:01 +08:00
parent 42c4f9a6c6
commit 1360051f0c
5 changed files with 16 additions and 6 deletions

View File

@ -528,5 +528,12 @@ public class Global
@"" @""
]; ];
public static readonly List<string> OutboundTags =
[
ProxyTag,
DirectTag,
BlockTag
];
#endregion const #endregion const
} }

View File

@ -1369,7 +1369,7 @@ public class CoreConfigSingboxService
private async Task<string?> GenRoutingUserRuleOutbound(string outboundTag, SingboxConfig singboxConfig) private async Task<string?> GenRoutingUserRuleOutbound(string outboundTag, SingboxConfig singboxConfig)
{ {
if (outboundTag is Global.ProxyTag or Global.DirectTag or Global.BlockTag) if (Global.OutboundTags.Contains(outboundTag))
{ {
return outboundTag; return outboundTag;
} }

View File

@ -631,7 +631,7 @@ public class CoreConfigV2rayService
private async Task<string?> GenRoutingUserRuleOutbound(string outboundTag, V2rayConfig v2rayConfig) private async Task<string?> GenRoutingUserRuleOutbound(string outboundTag, V2rayConfig v2rayConfig)
{ {
if (outboundTag is Global.ProxyTag or Global.DirectTag or Global.BlockTag) if (Global.OutboundTags.Contains(outboundTag))
{ {
return outboundTag; return outboundTag;
} }

View File

@ -23,7 +23,8 @@ public partial class RoutingRuleDetailsWindow : WindowBase<RoutingRuleDetailsVie
clbInboundTag.SelectionChanged += ClbInboundTag_SelectionChanged; clbInboundTag.SelectionChanged += ClbInboundTag_SelectionChanged;
ViewModel = new RoutingRuleDetailsViewModel(rulesItem, UpdateViewHandler); ViewModel = new RoutingRuleDetailsViewModel(rulesItem, UpdateViewHandler);
cmbOutboundTag.ItemsSource = new List<string> { Global.ProxyTag, Global.DirectTag, Global.BlockTag };
cmbOutboundTag.ItemsSource = Global.OutboundTags;
Global.RuleProtocols.ForEach(it => Global.RuleProtocols.ForEach(it =>
{ {
clbProtocol.Items.Add(it); clbProtocol.Items.Add(it);

View File

@ -16,9 +16,11 @@ public partial class RoutingRuleDetailsWindow
clbInboundTag.SelectionChanged += ClbInboundTag_SelectionChanged; clbInboundTag.SelectionChanged += ClbInboundTag_SelectionChanged;
ViewModel = new RoutingRuleDetailsViewModel(rulesItem, UpdateViewHandler); ViewModel = new RoutingRuleDetailsViewModel(rulesItem, UpdateViewHandler);
cmbOutboundTag.Items.Add(Global.ProxyTag);
cmbOutboundTag.Items.Add(Global.DirectTag); Global.OutboundTags.ForEach(it =>
cmbOutboundTag.Items.Add(Global.BlockTag); {
cmbOutboundTag.Items.Add(it);
});
Global.RuleProtocols.ForEach(it => Global.RuleProtocols.ForEach(it =>
{ {
clbProtocol.Items.Add(it); clbProtocol.Items.Add(it);