mirror of
https://github.com/2dust/v2rayN.git
synced 2026-10-14 01:04:59 +03:00
Optimize code ,add IsGroupType extension. Adjust EConfigType
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
using System.Net;
|
||||
using System.Net.NetworkInformation;
|
||||
using ServiceLib.Common;
|
||||
|
||||
namespace ServiceLib.Services.CoreConfig;
|
||||
|
||||
@@ -29,7 +30,7 @@ public partial class CoreConfigSingboxService(Config config)
|
||||
|
||||
ret.Msg = ResUI.InitialConfiguration;
|
||||
|
||||
if (node?.ConfigType is EConfigType.PolicyGroup or EConfigType.ProxyChain)
|
||||
if (node.ConfigType.IsGroupType())
|
||||
{
|
||||
switch (node.ConfigType)
|
||||
{
|
||||
|
||||
@@ -208,7 +208,7 @@ public partial class CoreConfigSingboxService
|
||||
{
|
||||
try
|
||||
{
|
||||
if (node.ConfigType is not (EConfigType.PolicyGroup or EConfigType.ProxyChain))
|
||||
if (!node.ConfigType.IsGroupType())
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
@@ -494,7 +494,7 @@ public partial class CoreConfigSingboxService
|
||||
{
|
||||
index++;
|
||||
|
||||
if (node.ConfigType is EConfigType.PolicyGroup or EConfigType.ProxyChain)
|
||||
if (node.ConfigType.IsGroupType())
|
||||
{
|
||||
var (childProfiles, profileGroupItem) = await ProfileGroupItemManager.GetChildProfileItems(node.IndexId);
|
||||
if (childProfiles.Count <= 0)
|
||||
@@ -669,7 +669,7 @@ public partial class CoreConfigSingboxService
|
||||
var node = nodes[i];
|
||||
if (node == null)
|
||||
continue;
|
||||
if (node.ConfigType is EConfigType.PolicyGroup or EConfigType.ProxyChain)
|
||||
if (node.ConfigType.IsGroupType())
|
||||
{
|
||||
var (childProfiles, profileGroupItem) = await ProfileGroupItemManager.GetChildProfileItems(node.IndexId);
|
||||
if (childProfiles.Count <= 0)
|
||||
|
||||
@@ -379,7 +379,7 @@ public partial class CoreConfigSingboxService
|
||||
|
||||
if (node == null
|
||||
|| (!Global.SingboxSupportConfigType.Contains(node.ConfigType)
|
||||
&& node.ConfigType is not (EConfigType.PolicyGroup or EConfigType.ProxyChain)))
|
||||
&& !node.ConfigType.IsGroupType()))
|
||||
{
|
||||
return Global.ProxyTag;
|
||||
}
|
||||
@@ -391,7 +391,7 @@ public partial class CoreConfigSingboxService
|
||||
return tag;
|
||||
}
|
||||
|
||||
if (node.ConfigType is EConfigType.PolicyGroup or EConfigType.ProxyChain)
|
||||
if (node.ConfigType.IsGroupType())
|
||||
{
|
||||
var ret = await GenGroupOutbound(node, singboxConfig, tag);
|
||||
if (ret == 0)
|
||||
|
||||
@@ -30,7 +30,7 @@ public partial class CoreConfigV2rayService(Config config)
|
||||
|
||||
ret.Msg = ResUI.InitialConfiguration;
|
||||
|
||||
if (node?.ConfigType is EConfigType.PolicyGroup or EConfigType.ProxyChain)
|
||||
if (node.ConfigType.IsGroupType())
|
||||
{
|
||||
switch (node.ConfigType)
|
||||
{
|
||||
|
||||
@@ -484,7 +484,7 @@ public partial class CoreConfigV2rayService
|
||||
{
|
||||
try
|
||||
{
|
||||
if (node.ConfigType is not (EConfigType.PolicyGroup or EConfigType.ProxyChain))
|
||||
if (!node.ConfigType.IsGroupType())
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
@@ -631,7 +631,7 @@ public partial class CoreConfigV2rayService
|
||||
{
|
||||
index++;
|
||||
|
||||
if (node.ConfigType is EConfigType.PolicyGroup or EConfigType.ProxyChain)
|
||||
if (node.ConfigType.IsGroupType())
|
||||
{
|
||||
var (childProfiles, _) = await ProfileGroupItemManager.GetChildProfileItems(node.IndexId);
|
||||
if (childProfiles.Count <= 0)
|
||||
@@ -782,7 +782,7 @@ public partial class CoreConfigV2rayService
|
||||
var node = nodes[i];
|
||||
if (node == null)
|
||||
continue;
|
||||
if (node.ConfigType is EConfigType.PolicyGroup or EConfigType.ProxyChain)
|
||||
if (node.ConfigType.IsGroupType())
|
||||
{
|
||||
var (childProfiles, _) = await ProfileGroupItemManager.GetChildProfileItems(node.IndexId);
|
||||
if (childProfiles.Count <= 0)
|
||||
|
||||
@@ -135,7 +135,7 @@ public partial class CoreConfigV2rayService
|
||||
|
||||
if (node == null
|
||||
|| (!Global.XraySupportConfigType.Contains(node.ConfigType)
|
||||
&& node.ConfigType is not (EConfigType.PolicyGroup or EConfigType.ProxyChain)))
|
||||
&& !node.ConfigType.IsGroupType()))
|
||||
{
|
||||
return Global.ProxyTag;
|
||||
}
|
||||
@@ -146,7 +146,7 @@ public partial class CoreConfigV2rayService
|
||||
return tag;
|
||||
}
|
||||
|
||||
if (node.ConfigType is EConfigType.PolicyGroup or EConfigType.ProxyChain)
|
||||
if (node.ConfigType.IsGroupType())
|
||||
{
|
||||
var ret = await GenGroupOutbound(node, v2rayConfig, tag);
|
||||
if (ret == 0)
|
||||
|
||||
Reference in New Issue
Block a user