Refactor models into sub-namespaces

Move many model classes into new sub-namespaces (ServiceLib.Models.CoreConfigs, ServiceLib.Models.Configs, ServiceLib.Models.Dto, ServiceLib.Models.Entities). Update GlobalUsings in ServiceLib, v2rayN.Desktop, v2rayN and add a tests GlobalUsings file to reference the new namespaces. Adjust static using directives in ClashApiManager and ClashProxiesViewModel to use ServiceLib.Models.Dto. This is a reorganization/rename of files and namespaces with no functional changes.
This commit is contained in:
2dust
2026-05-11 11:00:19 +08:00
parent 700f98193a
commit 8090799ccc
47 changed files with 97 additions and 48 deletions
+40
View File
@@ -0,0 +1,40 @@
global using System.Collections.Concurrent;
global using System.Diagnostics;
global using System.Net;
global using System.Net.NetworkInformation;
global using System.Net.Sockets;
global using System.Reactive;
global using System.Reactive.Disposables;
global using System.Reactive.Linq;
global using System.Reflection;
global using System.Runtime.InteropServices;
global using System.Security.Cryptography;
global using System.Text;
global using System.Text.Encodings.Web;
global using System.Text.Json;
global using System.Text.Json.Nodes;
global using System.Text.Json.Serialization;
global using System.Text.RegularExpressions;
global using DynamicData;
global using DynamicData.Binding;
global using ReactiveUI;
global using ReactiveUI.Fody.Helpers;
global using ServiceLib.Base;
global using ServiceLib.Common;
global using ServiceLib.Enums;
global using ServiceLib.Events;
global using ServiceLib.Handler;
global using ServiceLib.Handler.Builder;
global using ServiceLib.Handler.Fmt;
global using ServiceLib.Handler.SysProxy;
global using ServiceLib.Helper;
global using ServiceLib.Manager;
global using ServiceLib.Models.CoreConfigs;
global using ServiceLib.Models.Configs;
global using ServiceLib.Models.Dto;
global using ServiceLib.Models.Entities;
global using ServiceLib.Resx;
global using ServiceLib.Services;
global using ServiceLib.Services.CoreConfig;
global using ServiceLib.Services.Statistics;
global using SQLite;
+4 -1
View File
@@ -29,7 +29,10 @@ global using ServiceLib.Handler.Fmt;
global using ServiceLib.Handler.SysProxy; global using ServiceLib.Handler.SysProxy;
global using ServiceLib.Helper; global using ServiceLib.Helper;
global using ServiceLib.Manager; global using ServiceLib.Manager;
global using ServiceLib.Models; global using ServiceLib.Models.CoreConfigs;
global using ServiceLib.Models.Configs;
global using ServiceLib.Models.Dto;
global using ServiceLib.Models.Entities;
global using ServiceLib.Resx; global using ServiceLib.Resx;
global using ServiceLib.Services; global using ServiceLib.Services;
global using ServiceLib.Services.CoreConfig; global using ServiceLib.Services.CoreConfig;
+1 -1
View File
@@ -1,4 +1,4 @@
using static ServiceLib.Models.ClashProxies; using static ServiceLib.Models.Dto.ClashProxies;
namespace ServiceLib.Manager; namespace ServiceLib.Manager;
@@ -1,4 +1,4 @@
namespace ServiceLib.Models; namespace ServiceLib.Models.Configs;
[Serializable] [Serializable]
public class Config public class Config
@@ -1,4 +1,4 @@
namespace ServiceLib.Models; namespace ServiceLib.Models.Configs;
[Serializable] [Serializable]
public class CoreBasicItem public class CoreBasicItem
@@ -1,4 +1,4 @@
namespace ServiceLib.Models; namespace ServiceLib.Models.CoreConfigs;
public record CoreConfigContext public record CoreConfigContext
{ {
@@ -1,4 +1,4 @@
namespace ServiceLib.Models; namespace ServiceLib.Models.CoreConfigs;
[Serializable] [Serializable]
public class CoreInfo public class CoreInfo
@@ -1,4 +1,4 @@
namespace ServiceLib.Models; namespace ServiceLib.Models.CoreConfigs;
public class SingboxConfig public class SingboxConfig
{ {
@@ -1,4 +1,4 @@
namespace ServiceLib.Models; namespace ServiceLib.Models.CoreConfigs;
public class V2rayConfig public class V2rayConfig
{ {
@@ -1,6 +1,6 @@
using System.Collections; using System.Collections;
namespace ServiceLib.Models; namespace ServiceLib.Models.CoreConfigs;
internal class V2rayMetricsVars internal class V2rayMetricsVars
{ {
@@ -1,4 +1,4 @@
namespace ServiceLib.Models; namespace ServiceLib.Models.CoreConfigs;
public class V2rayTcpRequest public class V2rayTcpRequest
{ {
@@ -1,4 +1,4 @@
namespace ServiceLib.Models; namespace ServiceLib.Models.Dto;
public class CheckUpdateModel : ReactiveObject public class CheckUpdateModel : ReactiveObject
{ {
@@ -1,4 +1,4 @@
namespace ServiceLib.Models; namespace ServiceLib.Models.Dto;
public class ClashConnectionModel public class ClashConnectionModel
{ {
@@ -1,4 +1,4 @@
namespace ServiceLib.Models; namespace ServiceLib.Models.Dto;
public class ClashConnections public class ClashConnections
{ {
@@ -1,6 +1,6 @@
using static ServiceLib.Models.ClashProxies; using static ServiceLib.Models.Dto.ClashProxies;
namespace ServiceLib.Models; namespace ServiceLib.Models.Dto;
public class ClashProviders public class ClashProviders
{ {
@@ -1,4 +1,4 @@
namespace ServiceLib.Models; namespace ServiceLib.Models.Dto;
public class ClashProxies public class ClashProxies
{ {
@@ -1,4 +1,4 @@
namespace ServiceLib.Models; namespace ServiceLib.Models.Dto;
[Serializable] [Serializable]
public class ClashProxyModel : ReactiveObject public class ClashProxyModel : ReactiveObject
@@ -1,4 +1,4 @@
namespace ServiceLib.Models; namespace ServiceLib.Models.Dto;
public class CmdItem public class CmdItem
{ {
@@ -1,4 +1,4 @@
namespace ServiceLib.Models; namespace ServiceLib.Models.Dto;
public class ComboItem public class ComboItem
{ {
@@ -1,4 +1,4 @@
namespace ServiceLib.Models; namespace ServiceLib.Models.Dto;
public class GitHubReleaseAsset public class GitHubReleaseAsset
{ {
@@ -1,4 +1,4 @@
namespace ServiceLib.Models; namespace ServiceLib.Models.Dto;
internal class IPAPIInfo internal class IPAPIInfo
{ {
@@ -1,4 +1,4 @@
namespace ServiceLib.Models; namespace ServiceLib.Models.Dto;
[Serializable] [Serializable]
public class ProfileItemModel : ReactiveObject public class ProfileItemModel : ReactiveObject
@@ -1,4 +1,4 @@
namespace ServiceLib.Models; namespace ServiceLib.Models.Dto;
public class RetResult public class RetResult
{ {
@@ -1,4 +1,4 @@
namespace ServiceLib.Models; namespace ServiceLib.Models.Dto;
[Serializable] [Serializable]
public class RoutingItemModel : RoutingItem public class RoutingItemModel : RoutingItem
@@ -1,4 +1,4 @@
namespace ServiceLib.Models; namespace ServiceLib.Models.Dto;
[Serializable] [Serializable]
public class RoutingTemplate public class RoutingTemplate
@@ -1,4 +1,4 @@
namespace ServiceLib.Models; namespace ServiceLib.Models.Dto;
[Serializable] [Serializable]
public class RulesItemModel : RulesItem public class RulesItemModel : RulesItem
@@ -1,4 +1,4 @@
namespace ServiceLib.Models; namespace ServiceLib.Models.Dto;
public class SemanticVersion public class SemanticVersion
{ {
@@ -1,4 +1,4 @@
namespace ServiceLib.Models; namespace ServiceLib.Models.Dto;
[Serializable] [Serializable]
public class ServerSpeedItem : ServerStatItem public class ServerSpeedItem : ServerStatItem
@@ -1,4 +1,4 @@
namespace ServiceLib.Models; namespace ServiceLib.Models.Dto;
[Serializable] [Serializable]
public class ServerTestItem public class ServerTestItem
@@ -1,4 +1,4 @@
namespace ServiceLib.Models; namespace ServiceLib.Models.Dto;
[Serializable] [Serializable]
public class SpeedTestResult public class SpeedTestResult
@@ -1,4 +1,4 @@
namespace ServiceLib.Models; namespace ServiceLib.Models.Dto;
public class SsSIP008 public class SsSIP008
{ {
@@ -1,4 +1,4 @@
namespace ServiceLib.Models; namespace ServiceLib.Models.Dto;
public class UpdateResult public class UpdateResult
{ {
@@ -1,4 +1,4 @@
namespace ServiceLib.Models; namespace ServiceLib.Models.Dto;
/// <summary> /// <summary>
/// https://github.com/2dust/v2rayN/wiki/ /// https://github.com/2dust/v2rayN/wiki/
@@ -1,4 +1,4 @@
namespace ServiceLib.Models; namespace ServiceLib.Models.Entities;
[Serializable] [Serializable]
public class DNSItem public class DNSItem
@@ -1,4 +1,4 @@
namespace ServiceLib.Models; namespace ServiceLib.Models.Entities;
[Serializable] [Serializable]
public class FullConfigTemplateItem public class FullConfigTemplateItem
@@ -1,4 +1,4 @@
namespace ServiceLib.Models; namespace ServiceLib.Models.Entities;
[Serializable] [Serializable]
public class ProfileExItem public class ProfileExItem
@@ -1,4 +1,4 @@
namespace ServiceLib.Models; namespace ServiceLib.Models.Entities;
[Obsolete("Use ProtocolExtraItem instead.")] [Obsolete("Use ProtocolExtraItem instead.")]
[Serializable] [Serializable]
@@ -1,4 +1,4 @@
namespace ServiceLib.Models; namespace ServiceLib.Models.Entities;
[Serializable] [Serializable]
public class ProfileItem public class ProfileItem
@@ -1,4 +1,4 @@
namespace ServiceLib.Models; namespace ServiceLib.Models.Entities;
public record ProtocolExtraItem public record ProtocolExtraItem
{ {
@@ -1,4 +1,4 @@
namespace ServiceLib.Models; namespace ServiceLib.Models.Entities;
[Serializable] [Serializable]
public class RoutingItem public class RoutingItem
@@ -1,4 +1,4 @@
namespace ServiceLib.Models; namespace ServiceLib.Models.Entities;
[Serializable] [Serializable]
public class RulesItem public class RulesItem
@@ -1,4 +1,4 @@
namespace ServiceLib.Models; namespace ServiceLib.Models.Entities;
[Serializable] [Serializable]
public class ServerStatItem public class ServerStatItem
@@ -1,4 +1,4 @@
namespace ServiceLib.Models; namespace ServiceLib.Models.Entities;
[Serializable] [Serializable]
public class SubItem public class SubItem
@@ -1,4 +1,4 @@
namespace ServiceLib.Models; namespace ServiceLib.Models.Entities;
public record TransportExtraItem public record TransportExtraItem
{ {
@@ -1,6 +1,6 @@
using System.Reactive.Concurrency; using System.Reactive.Concurrency;
using static ServiceLib.Models.ClashProviders; using static ServiceLib.Models.Dto.ClashProviders;
using static ServiceLib.Models.ClashProxies; using static ServiceLib.Models.Dto.ClashProxies;
namespace ServiceLib.ViewModels; namespace ServiceLib.ViewModels;
+4 -1
View File
@@ -30,6 +30,9 @@ global using ServiceLib.Enums;
global using ServiceLib.Events; global using ServiceLib.Events;
global using ServiceLib.Handler; global using ServiceLib.Handler;
global using ServiceLib.Manager; global using ServiceLib.Manager;
global using ServiceLib.Models; global using ServiceLib.Models.CoreConfigs;
global using ServiceLib.Models.Configs;
global using ServiceLib.Models.Dto;
global using ServiceLib.Models.Entities;
global using ServiceLib.Resx; global using ServiceLib.Resx;
global using ServiceLib.ViewModels; global using ServiceLib.ViewModels;
+4 -1
View File
@@ -29,7 +29,10 @@ global using ServiceLib.Enums;
global using ServiceLib.Events; global using ServiceLib.Events;
global using ServiceLib.Handler; global using ServiceLib.Handler;
global using ServiceLib.Manager; global using ServiceLib.Manager;
global using ServiceLib.Models; global using ServiceLib.Models.CoreConfigs;
global using ServiceLib.Models.Configs;
global using ServiceLib.Models.Dto;
global using ServiceLib.Models.Entities;
global using ServiceLib.Resx; global using ServiceLib.Resx;
global using ServiceLib.ViewModels; global using ServiceLib.ViewModels;
global using v2rayN.Common; global using v2rayN.Common;