From 3555d861ae5271cc578d48fb6c51394e28e9e9b7 Mon Sep 17 00:00:00 2001 From: 2dust <31833384+2dust@users.noreply.github.com> Date: Sun, 19 Oct 2025 11:05:28 +0800 Subject: [PATCH 01/21] Optimization and improvement --- v2rayN/ServiceLib/Manager/TaskManager.cs | 30 ++++++++++++++++++++---- 1 file changed, 25 insertions(+), 5 deletions(-) diff --git a/v2rayN/ServiceLib/Manager/TaskManager.cs b/v2rayN/ServiceLib/Manager/TaskManager.cs index dfbd242d..40da7ac7 100644 --- a/v2rayN/ServiceLib/Manager/TaskManager.cs +++ b/v2rayN/ServiceLib/Manager/TaskManager.cs @@ -26,15 +26,29 @@ public class TaskManager await Task.Delay(1000 * 60); //Execute once 1 minute - await UpdateTaskRunSubscription(); + try + { + await UpdateTaskRunSubscription(); + } + catch (Exception ex) + { + Logging.SaveLog("ScheduledTasks - UpdateTaskRunSubscription", ex); + } //Execute once 20 minute if (numOfExecuted % 20 == 0) { //Logging.SaveLog("Execute save config"); - await ConfigHandler.SaveConfig(_config); - await ProfileExManager.Instance.SaveTo(); + try + { + await ConfigHandler.SaveConfig(_config); + await ProfileExManager.Instance.SaveTo(); + } + catch (Exception ex) + { + Logging.SaveLog("ScheduledTasks - SaveConfig", ex); + } } //Execute once 1 hour @@ -46,8 +60,14 @@ public class TaskManager FileManager.DeleteExpiredFiles(Utils.GetLogPath(), DateTime.Now.AddMonths(-1)); FileManager.DeleteExpiredFiles(Utils.GetTempPath(), DateTime.Now.AddMonths(-1)); - //Check once 1 hour - await UpdateTaskRunGeo(numOfExecuted / 60); + try + { + await UpdateTaskRunGeo(numOfExecuted / 60); + } + catch (Exception ex) + { + Logging.SaveLog("ScheduledTasks - UpdateTaskRunGeo", ex); + } } numOfExecuted++; From b66bfabd21fe69a64e5b725c7046cc3986891da3 Mon Sep 17 00:00:00 2001 From: 2dust <31833384+2dust@users.noreply.github.com> Date: Sun, 19 Oct 2025 11:42:32 +0800 Subject: [PATCH 02/21] Optimize and improve GlobalUsings --- v2rayN/ServiceLib/Base/MyReactiveObject.cs | 2 -- v2rayN/ServiceLib/Common/EmbedUtils.cs | 3 -- v2rayN/ServiceLib/Common/FileManager.cs | 1 - v2rayN/ServiceLib/Common/JsonUtils.cs | 5 --- v2rayN/ServiceLib/Common/ProcUtils.cs | 2 -- v2rayN/ServiceLib/Common/Utils.cs | 8 ----- v2rayN/ServiceLib/Common/WindowsUtils.cs | 2 -- v2rayN/ServiceLib/Events/AppEvents.cs | 2 -- v2rayN/ServiceLib/Events/EventChannel.cs | 2 -- v2rayN/ServiceLib/Global.cs | 2 +- v2rayN/ServiceLib/GlobalUsings.cs | 32 ++++++++++++++++--- .../ServiceLib/Handler/AutoStartupHandler.cs | 1 - v2rayN/ServiceLib/Handler/ConfigHandler.cs | 3 +- .../ServiceLib/Handler/ConnectionHandler.cs | 2 -- .../ServiceLib/Handler/Fmt/ShadowsocksFmt.cs | 2 -- .../Handler/SysProxy/ProxySettingWindows.cs | 1 - v2rayN/ServiceLib/Helper/DownloaderHelper.cs | 1 - v2rayN/ServiceLib/Helper/HttpClientHelper.cs | 3 -- v2rayN/ServiceLib/Helper/SqliteHelper.cs | 1 - v2rayN/ServiceLib/Manager/CoreAdminManager.cs | 1 - v2rayN/ServiceLib/Manager/PacManager.cs | 3 -- v2rayN/ServiceLib/Manager/ProfileExManager.cs | 2 -- .../Manager/ProfileGroupItemManager.cs | 2 -- v2rayN/ServiceLib/Manager/WebDavManager.cs | 1 - v2rayN/ServiceLib/Models/CheckUpdateModel.cs | 3 -- v2rayN/ServiceLib/Models/ClashProxyModel.cs | 3 -- v2rayN/ServiceLib/Models/DNSItem.cs | 2 -- .../Models/FullConfigTemplateItem.cs | 2 -- v2rayN/ServiceLib/Models/GitHubRelease.cs | 2 -- v2rayN/ServiceLib/Models/ProfileExItem.cs | 2 -- v2rayN/ServiceLib/Models/ProfileGroupItem.cs | 2 -- v2rayN/ServiceLib/Models/ProfileItem.cs | 3 -- v2rayN/ServiceLib/Models/ProfileItemModel.cs | 2 -- v2rayN/ServiceLib/Models/RoutingItem.cs | 2 -- v2rayN/ServiceLib/Models/ServerStatItem.cs | 2 -- v2rayN/ServiceLib/Models/SingboxConfig.cs | 2 -- v2rayN/ServiceLib/Models/SubItem.cs | 2 -- v2rayN/ServiceLib/Models/V2rayConfig.cs | 2 -- v2rayN/ServiceLib/Models/VmessQRCode.cs | 2 -- .../Singbox/CoreConfigSingboxService.cs | 4 --- .../Singbox/SingboxConfigTemplateService.cs | 2 -- .../V2ray/CoreConfigV2rayService.cs | 3 -- .../V2ray/V2rayConfigTemplateService.cs | 2 -- .../CoreConfig/V2ray/V2rayDnsService.cs | 4 --- v2rayN/ServiceLib/Services/DownloadService.cs | 2 -- v2rayN/ServiceLib/Services/ProcessService.cs | 3 -- .../ServiceLib/Services/SpeedtestService.cs | 5 --- .../Statistics/StatisticsSingboxService.cs | 1 - v2rayN/ServiceLib/Services/UpdateService.cs | 3 -- .../ViewModels/AddGroupServerViewModel.cs | 5 --- .../ViewModels/AddServer2ViewModel.cs | 4 --- .../ViewModels/AddServerViewModel.cs | 4 --- .../ViewModels/BackupAndRestoreViewModel.cs | 4 --- .../ViewModels/CheckUpdateViewModel.cs | 8 ----- .../ViewModels/ClashConnectionsViewModel.cs | 8 ----- .../ViewModels/ClashProxiesViewModel.cs | 7 ---- .../ViewModels/DNSSettingViewModel.cs | 5 --- .../ViewModels/FullConfigTemplateViewModel.cs | 4 --- .../GlobalHotkeySettingViewModel.cs | 3 -- .../ViewModels/MainWindowViewModel.cs | 4 --- v2rayN/ServiceLib/ViewModels/MsgViewModel.cs | 7 ---- .../ViewModels/OptionSettingViewModel.cs | 4 --- .../ViewModels/ProfilesSelectViewModel.cs | 6 ---- .../ViewModels/ProfilesViewModel.cs | 9 ------ .../ViewModels/RoutingRuleDetailsViewModel.cs | 4 --- .../ViewModels/RoutingRuleSettingViewModel.cs | 7 ---- .../ViewModels/RoutingSettingViewModel.cs | 5 --- .../ViewModels/StatusBarViewModel.cs | 8 ----- .../ServiceLib/ViewModels/SubEditViewModel.cs | 4 --- .../ViewModels/SubSettingViewModel.cs | 6 ---- 70 files changed, 29 insertions(+), 233 deletions(-) diff --git a/v2rayN/ServiceLib/Base/MyReactiveObject.cs b/v2rayN/ServiceLib/Base/MyReactiveObject.cs index 0172faad..50563151 100644 --- a/v2rayN/ServiceLib/Base/MyReactiveObject.cs +++ b/v2rayN/ServiceLib/Base/MyReactiveObject.cs @@ -1,5 +1,3 @@ -using ReactiveUI; - namespace ServiceLib.Base; public class MyReactiveObject : ReactiveObject diff --git a/v2rayN/ServiceLib/Common/EmbedUtils.cs b/v2rayN/ServiceLib/Common/EmbedUtils.cs index b647d154..d3b323f7 100644 --- a/v2rayN/ServiceLib/Common/EmbedUtils.cs +++ b/v2rayN/ServiceLib/Common/EmbedUtils.cs @@ -1,6 +1,3 @@ -using System.Collections.Concurrent; -using System.Reflection; - namespace ServiceLib.Common; public static class EmbedUtils diff --git a/v2rayN/ServiceLib/Common/FileManager.cs b/v2rayN/ServiceLib/Common/FileManager.cs index 6d4d28ca..44a9fe82 100644 --- a/v2rayN/ServiceLib/Common/FileManager.cs +++ b/v2rayN/ServiceLib/Common/FileManager.cs @@ -1,6 +1,5 @@ using System.Formats.Tar; using System.IO.Compression; -using System.Text; namespace ServiceLib.Common; diff --git a/v2rayN/ServiceLib/Common/JsonUtils.cs b/v2rayN/ServiceLib/Common/JsonUtils.cs index 4fbaa0e1..b5bcc7fe 100644 --- a/v2rayN/ServiceLib/Common/JsonUtils.cs +++ b/v2rayN/ServiceLib/Common/JsonUtils.cs @@ -1,8 +1,3 @@ -using System.Text.Encodings.Web; -using System.Text.Json; -using System.Text.Json.Nodes; -using System.Text.Json.Serialization; - namespace ServiceLib.Common; public class JsonUtils diff --git a/v2rayN/ServiceLib/Common/ProcUtils.cs b/v2rayN/ServiceLib/Common/ProcUtils.cs index 2819f2fb..ce487c7a 100644 --- a/v2rayN/ServiceLib/Common/ProcUtils.cs +++ b/v2rayN/ServiceLib/Common/ProcUtils.cs @@ -1,5 +1,3 @@ -using System.Diagnostics; - namespace ServiceLib.Common; public static class ProcUtils diff --git a/v2rayN/ServiceLib/Common/Utils.cs b/v2rayN/ServiceLib/Common/Utils.cs index 85182a60..8adf9d83 100644 --- a/v2rayN/ServiceLib/Common/Utils.cs +++ b/v2rayN/ServiceLib/Common/Utils.cs @@ -1,13 +1,5 @@ using System.Collections.Specialized; -using System.Diagnostics; -using System.Net; -using System.Net.NetworkInformation; -using System.Net.Sockets; -using System.Reflection; -using System.Runtime.InteropServices; -using System.Security.Cryptography; using System.Security.Principal; -using System.Text; using CliWrap; using CliWrap.Buffered; diff --git a/v2rayN/ServiceLib/Common/WindowsUtils.cs b/v2rayN/ServiceLib/Common/WindowsUtils.cs index 6c6f7be1..2215a3e3 100644 --- a/v2rayN/ServiceLib/Common/WindowsUtils.cs +++ b/v2rayN/ServiceLib/Common/WindowsUtils.cs @@ -1,5 +1,3 @@ -using System.Security.Cryptography; -using System.Text; using Microsoft.Win32; namespace ServiceLib.Common; diff --git a/v2rayN/ServiceLib/Events/AppEvents.cs b/v2rayN/ServiceLib/Events/AppEvents.cs index 45de4de1..5824bfc0 100644 --- a/v2rayN/ServiceLib/Events/AppEvents.cs +++ b/v2rayN/ServiceLib/Events/AppEvents.cs @@ -1,5 +1,3 @@ -using System.Reactive; - namespace ServiceLib.Events; public static class AppEvents diff --git a/v2rayN/ServiceLib/Events/EventChannel.cs b/v2rayN/ServiceLib/Events/EventChannel.cs index c3c58f3e..4ca040c6 100644 --- a/v2rayN/ServiceLib/Events/EventChannel.cs +++ b/v2rayN/ServiceLib/Events/EventChannel.cs @@ -1,5 +1,3 @@ -using System.Reactive; -using System.Reactive.Linq; using System.Reactive.Subjects; namespace ServiceLib.Events; diff --git a/v2rayN/ServiceLib/Global.cs b/v2rayN/ServiceLib/Global.cs index 6e3c541c..2327de48 100644 --- a/v2rayN/ServiceLib/Global.cs +++ b/v2rayN/ServiceLib/Global.cs @@ -316,7 +316,7 @@ public class Global ]; public static readonly HashSet SingboxOnlyConfigType = SingboxSupportConfigType.Except(XraySupportConfigType).ToHashSet(); - + public static readonly List DomainStrategies = [ AsIs, diff --git a/v2rayN/ServiceLib/GlobalUsings.cs b/v2rayN/ServiceLib/GlobalUsings.cs index a952f4a8..d38ccc06 100644 --- a/v2rayN/ServiceLib/GlobalUsings.cs +++ b/v2rayN/ServiceLib/GlobalUsings.cs @@ -1,14 +1,36 @@ +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.Fmt; +global using ServiceLib.Handler.SysProxy; global using ServiceLib.Helper; global using ServiceLib.Manager; -global using ServiceLib.Handler.Fmt; -global using ServiceLib.Services; -global using ServiceLib.Services.Statistics; -global using ServiceLib.Services.CoreConfig; global using ServiceLib.Models; global using ServiceLib.Resx; -global using ServiceLib.Handler.SysProxy; +global using ServiceLib.Services; +global using ServiceLib.Services.CoreConfig; +global using ServiceLib.Services.Statistics; +global using SQLite; diff --git a/v2rayN/ServiceLib/Handler/AutoStartupHandler.cs b/v2rayN/ServiceLib/Handler/AutoStartupHandler.cs index 015271d9..82e94517 100644 --- a/v2rayN/ServiceLib/Handler/AutoStartupHandler.cs +++ b/v2rayN/ServiceLib/Handler/AutoStartupHandler.cs @@ -1,5 +1,4 @@ using System.Security.Principal; -using System.Text.RegularExpressions; namespace ServiceLib.Handler; diff --git a/v2rayN/ServiceLib/Handler/ConfigHandler.cs b/v2rayN/ServiceLib/Handler/ConfigHandler.cs index c3dc716b..fd93d8be 100644 --- a/v2rayN/ServiceLib/Handler/ConfigHandler.cs +++ b/v2rayN/ServiceLib/Handler/ConfigHandler.cs @@ -1,5 +1,4 @@ using System.Data; -using System.Text.RegularExpressions; namespace ServiceLib.Handler; @@ -1484,7 +1483,7 @@ public static class ConfigHandler if (profileItem is null) { profileItem = Hysteria2Fmt.ResolveFull2(strData, subRemarks); - } + } if (profileItem is null || profileItem.Address.IsNullOrEmpty()) { return -1; diff --git a/v2rayN/ServiceLib/Handler/ConnectionHandler.cs b/v2rayN/ServiceLib/Handler/ConnectionHandler.cs index 38f3ae51..ae3268ea 100644 --- a/v2rayN/ServiceLib/Handler/ConnectionHandler.cs +++ b/v2rayN/ServiceLib/Handler/ConnectionHandler.cs @@ -1,5 +1,3 @@ -using System.Net; - namespace ServiceLib.Handler; public static class ConnectionHandler diff --git a/v2rayN/ServiceLib/Handler/Fmt/ShadowsocksFmt.cs b/v2rayN/ServiceLib/Handler/Fmt/ShadowsocksFmt.cs index 2ec9769f..adaeb954 100644 --- a/v2rayN/ServiceLib/Handler/Fmt/ShadowsocksFmt.cs +++ b/v2rayN/ServiceLib/Handler/Fmt/ShadowsocksFmt.cs @@ -1,5 +1,3 @@ -using System.Text.RegularExpressions; - namespace ServiceLib.Handler.Fmt; public class ShadowsocksFmt : BaseFmt diff --git a/v2rayN/ServiceLib/Handler/SysProxy/ProxySettingWindows.cs b/v2rayN/ServiceLib/Handler/SysProxy/ProxySettingWindows.cs index 44b7e046..8dc2f335 100644 --- a/v2rayN/ServiceLib/Handler/SysProxy/ProxySettingWindows.cs +++ b/v2rayN/ServiceLib/Handler/SysProxy/ProxySettingWindows.cs @@ -1,4 +1,3 @@ -using System.Runtime.InteropServices; using static ServiceLib.Handler.SysProxy.ProxySettingWindows.InternetConnectionOption; namespace ServiceLib.Handler.SysProxy; diff --git a/v2rayN/ServiceLib/Helper/DownloaderHelper.cs b/v2rayN/ServiceLib/Helper/DownloaderHelper.cs index 3764499c..000685a0 100644 --- a/v2rayN/ServiceLib/Helper/DownloaderHelper.cs +++ b/v2rayN/ServiceLib/Helper/DownloaderHelper.cs @@ -1,4 +1,3 @@ -using System.Net; using Downloader; namespace ServiceLib.Helper; diff --git a/v2rayN/ServiceLib/Helper/HttpClientHelper.cs b/v2rayN/ServiceLib/Helper/HttpClientHelper.cs index a559800f..cd971a89 100644 --- a/v2rayN/ServiceLib/Helper/HttpClientHelper.cs +++ b/v2rayN/ServiceLib/Helper/HttpClientHelper.cs @@ -1,8 +1,5 @@ -using System.Diagnostics; -using System.Net; using System.Net.Http.Headers; using System.Net.Mime; -using System.Text; namespace ServiceLib.Helper; diff --git a/v2rayN/ServiceLib/Helper/SqliteHelper.cs b/v2rayN/ServiceLib/Helper/SqliteHelper.cs index 959d5ff6..83c9bf90 100644 --- a/v2rayN/ServiceLib/Helper/SqliteHelper.cs +++ b/v2rayN/ServiceLib/Helper/SqliteHelper.cs @@ -1,5 +1,4 @@ using System.Collections; -using SQLite; namespace ServiceLib.Helper; diff --git a/v2rayN/ServiceLib/Manager/CoreAdminManager.cs b/v2rayN/ServiceLib/Manager/CoreAdminManager.cs index 4143e78a..0d52f1c7 100644 --- a/v2rayN/ServiceLib/Manager/CoreAdminManager.cs +++ b/v2rayN/ServiceLib/Manager/CoreAdminManager.cs @@ -1,4 +1,3 @@ -using System.Text; using CliWrap; using CliWrap.Buffered; diff --git a/v2rayN/ServiceLib/Manager/PacManager.cs b/v2rayN/ServiceLib/Manager/PacManager.cs index 10bedc29..cba89830 100644 --- a/v2rayN/ServiceLib/Manager/PacManager.cs +++ b/v2rayN/ServiceLib/Manager/PacManager.cs @@ -1,6 +1,3 @@ -using System.Net.Sockets; -using System.Text; - namespace ServiceLib.Manager; public class PacManager diff --git a/v2rayN/ServiceLib/Manager/ProfileExManager.cs b/v2rayN/ServiceLib/Manager/ProfileExManager.cs index 0a3b7399..739bd550 100644 --- a/v2rayN/ServiceLib/Manager/ProfileExManager.cs +++ b/v2rayN/ServiceLib/Manager/ProfileExManager.cs @@ -1,5 +1,3 @@ -using System.Collections.Concurrent; - //using System.Reactive.Linq; namespace ServiceLib.Manager; diff --git a/v2rayN/ServiceLib/Manager/ProfileGroupItemManager.cs b/v2rayN/ServiceLib/Manager/ProfileGroupItemManager.cs index 72c55870..bf52dcb2 100644 --- a/v2rayN/ServiceLib/Manager/ProfileGroupItemManager.cs +++ b/v2rayN/ServiceLib/Manager/ProfileGroupItemManager.cs @@ -1,5 +1,3 @@ -using System.Collections.Concurrent; - namespace ServiceLib.Manager; public class ProfileGroupItemManager diff --git a/v2rayN/ServiceLib/Manager/WebDavManager.cs b/v2rayN/ServiceLib/Manager/WebDavManager.cs index 3f5c9ea3..83ae24ce 100644 --- a/v2rayN/ServiceLib/Manager/WebDavManager.cs +++ b/v2rayN/ServiceLib/Manager/WebDavManager.cs @@ -1,4 +1,3 @@ -using System.Net; using WebDav; namespace ServiceLib.Manager; diff --git a/v2rayN/ServiceLib/Models/CheckUpdateModel.cs b/v2rayN/ServiceLib/Models/CheckUpdateModel.cs index f06eedc9..2707cc6e 100644 --- a/v2rayN/ServiceLib/Models/CheckUpdateModel.cs +++ b/v2rayN/ServiceLib/Models/CheckUpdateModel.cs @@ -1,6 +1,3 @@ -using ReactiveUI; -using ReactiveUI.Fody.Helpers; - namespace ServiceLib.Models; public class CheckUpdateModel : ReactiveObject diff --git a/v2rayN/ServiceLib/Models/ClashProxyModel.cs b/v2rayN/ServiceLib/Models/ClashProxyModel.cs index 014b0f12..10d68e14 100644 --- a/v2rayN/ServiceLib/Models/ClashProxyModel.cs +++ b/v2rayN/ServiceLib/Models/ClashProxyModel.cs @@ -1,6 +1,3 @@ -using ReactiveUI; -using ReactiveUI.Fody.Helpers; - namespace ServiceLib.Models; [Serializable] diff --git a/v2rayN/ServiceLib/Models/DNSItem.cs b/v2rayN/ServiceLib/Models/DNSItem.cs index 9474d906..2dea42d0 100644 --- a/v2rayN/ServiceLib/Models/DNSItem.cs +++ b/v2rayN/ServiceLib/Models/DNSItem.cs @@ -1,5 +1,3 @@ -using SQLite; - namespace ServiceLib.Models; [Serializable] diff --git a/v2rayN/ServiceLib/Models/FullConfigTemplateItem.cs b/v2rayN/ServiceLib/Models/FullConfigTemplateItem.cs index f3881325..b3e3b14e 100644 --- a/v2rayN/ServiceLib/Models/FullConfigTemplateItem.cs +++ b/v2rayN/ServiceLib/Models/FullConfigTemplateItem.cs @@ -1,5 +1,3 @@ -using SQLite; - namespace ServiceLib.Models; [Serializable] diff --git a/v2rayN/ServiceLib/Models/GitHubRelease.cs b/v2rayN/ServiceLib/Models/GitHubRelease.cs index 9875c0a0..f6549467 100644 --- a/v2rayN/ServiceLib/Models/GitHubRelease.cs +++ b/v2rayN/ServiceLib/Models/GitHubRelease.cs @@ -1,5 +1,3 @@ -using System.Text.Json.Serialization; - namespace ServiceLib.Models; public class GitHubReleaseAsset diff --git a/v2rayN/ServiceLib/Models/ProfileExItem.cs b/v2rayN/ServiceLib/Models/ProfileExItem.cs index 49a85749..33b20c57 100644 --- a/v2rayN/ServiceLib/Models/ProfileExItem.cs +++ b/v2rayN/ServiceLib/Models/ProfileExItem.cs @@ -1,5 +1,3 @@ -using SQLite; - namespace ServiceLib.Models; [Serializable] diff --git a/v2rayN/ServiceLib/Models/ProfileGroupItem.cs b/v2rayN/ServiceLib/Models/ProfileGroupItem.cs index 1030d6de..c6131275 100644 --- a/v2rayN/ServiceLib/Models/ProfileGroupItem.cs +++ b/v2rayN/ServiceLib/Models/ProfileGroupItem.cs @@ -1,5 +1,3 @@ -using SQLite; - namespace ServiceLib.Models; [Serializable] diff --git a/v2rayN/ServiceLib/Models/ProfileItem.cs b/v2rayN/ServiceLib/Models/ProfileItem.cs index 55f658e9..729fa7b2 100644 --- a/v2rayN/ServiceLib/Models/ProfileItem.cs +++ b/v2rayN/ServiceLib/Models/ProfileItem.cs @@ -1,6 +1,3 @@ -using ReactiveUI; -using SQLite; - namespace ServiceLib.Models; [Serializable] diff --git a/v2rayN/ServiceLib/Models/ProfileItemModel.cs b/v2rayN/ServiceLib/Models/ProfileItemModel.cs index 40ba3f1d..b4d72119 100644 --- a/v2rayN/ServiceLib/Models/ProfileItemModel.cs +++ b/v2rayN/ServiceLib/Models/ProfileItemModel.cs @@ -1,5 +1,3 @@ -using ReactiveUI.Fody.Helpers; - namespace ServiceLib.Models; [Serializable] diff --git a/v2rayN/ServiceLib/Models/RoutingItem.cs b/v2rayN/ServiceLib/Models/RoutingItem.cs index 78d93445..ddd27a9b 100644 --- a/v2rayN/ServiceLib/Models/RoutingItem.cs +++ b/v2rayN/ServiceLib/Models/RoutingItem.cs @@ -1,5 +1,3 @@ -using SQLite; - namespace ServiceLib.Models; [Serializable] diff --git a/v2rayN/ServiceLib/Models/ServerStatItem.cs b/v2rayN/ServiceLib/Models/ServerStatItem.cs index b5008465..05cd1ee6 100644 --- a/v2rayN/ServiceLib/Models/ServerStatItem.cs +++ b/v2rayN/ServiceLib/Models/ServerStatItem.cs @@ -1,5 +1,3 @@ -using SQLite; - namespace ServiceLib.Models; [Serializable] diff --git a/v2rayN/ServiceLib/Models/SingboxConfig.cs b/v2rayN/ServiceLib/Models/SingboxConfig.cs index 8263924a..9474631b 100644 --- a/v2rayN/ServiceLib/Models/SingboxConfig.cs +++ b/v2rayN/ServiceLib/Models/SingboxConfig.cs @@ -1,5 +1,3 @@ -using System.Text.Json.Serialization; - namespace ServiceLib.Models; public class SingboxConfig diff --git a/v2rayN/ServiceLib/Models/SubItem.cs b/v2rayN/ServiceLib/Models/SubItem.cs index cc1fb518..612ec15b 100644 --- a/v2rayN/ServiceLib/Models/SubItem.cs +++ b/v2rayN/ServiceLib/Models/SubItem.cs @@ -1,5 +1,3 @@ -using SQLite; - namespace ServiceLib.Models; [Serializable] diff --git a/v2rayN/ServiceLib/Models/V2rayConfig.cs b/v2rayN/ServiceLib/Models/V2rayConfig.cs index cff3cf8b..0f4fd348 100644 --- a/v2rayN/ServiceLib/Models/V2rayConfig.cs +++ b/v2rayN/ServiceLib/Models/V2rayConfig.cs @@ -1,5 +1,3 @@ -using System.Text.Json.Serialization; - namespace ServiceLib.Models; public class V2rayConfig diff --git a/v2rayN/ServiceLib/Models/VmessQRCode.cs b/v2rayN/ServiceLib/Models/VmessQRCode.cs index c51d9986..a555aae0 100644 --- a/v2rayN/ServiceLib/Models/VmessQRCode.cs +++ b/v2rayN/ServiceLib/Models/VmessQRCode.cs @@ -1,5 +1,3 @@ -using System.Text.Json.Serialization; - namespace ServiceLib.Models; /// diff --git a/v2rayN/ServiceLib/Services/CoreConfig/Singbox/CoreConfigSingboxService.cs b/v2rayN/ServiceLib/Services/CoreConfig/Singbox/CoreConfigSingboxService.cs index 191c7efa..71f25acd 100644 --- a/v2rayN/ServiceLib/Services/CoreConfig/Singbox/CoreConfigSingboxService.cs +++ b/v2rayN/ServiceLib/Services/CoreConfig/Singbox/CoreConfigSingboxService.cs @@ -1,7 +1,3 @@ -using System.Net; -using System.Net.NetworkInformation; -using ServiceLib.Common; - namespace ServiceLib.Services.CoreConfig; public partial class CoreConfigSingboxService(Config config) diff --git a/v2rayN/ServiceLib/Services/CoreConfig/Singbox/SingboxConfigTemplateService.cs b/v2rayN/ServiceLib/Services/CoreConfig/Singbox/SingboxConfigTemplateService.cs index c6bec22b..6fe9b35a 100644 --- a/v2rayN/ServiceLib/Services/CoreConfig/Singbox/SingboxConfigTemplateService.cs +++ b/v2rayN/ServiceLib/Services/CoreConfig/Singbox/SingboxConfigTemplateService.cs @@ -1,5 +1,3 @@ -using System.Text.Json.Nodes; - namespace ServiceLib.Services.CoreConfig; public partial class CoreConfigSingboxService diff --git a/v2rayN/ServiceLib/Services/CoreConfig/V2ray/CoreConfigV2rayService.cs b/v2rayN/ServiceLib/Services/CoreConfig/V2ray/CoreConfigV2rayService.cs index 8c31ddae..f7fb384a 100644 --- a/v2rayN/ServiceLib/Services/CoreConfig/V2ray/CoreConfigV2rayService.cs +++ b/v2rayN/ServiceLib/Services/CoreConfig/V2ray/CoreConfigV2rayService.cs @@ -1,6 +1,3 @@ -using System.Net; -using System.Net.NetworkInformation; - namespace ServiceLib.Services.CoreConfig; public partial class CoreConfigV2rayService(Config config) diff --git a/v2rayN/ServiceLib/Services/CoreConfig/V2ray/V2rayConfigTemplateService.cs b/v2rayN/ServiceLib/Services/CoreConfig/V2ray/V2rayConfigTemplateService.cs index 459e77de..f53308d1 100644 --- a/v2rayN/ServiceLib/Services/CoreConfig/V2ray/V2rayConfigTemplateService.cs +++ b/v2rayN/ServiceLib/Services/CoreConfig/V2ray/V2rayConfigTemplateService.cs @@ -1,5 +1,3 @@ -using System.Text.Json.Nodes; - namespace ServiceLib.Services.CoreConfig; public partial class CoreConfigV2rayService diff --git a/v2rayN/ServiceLib/Services/CoreConfig/V2ray/V2rayDnsService.cs b/v2rayN/ServiceLib/Services/CoreConfig/V2ray/V2rayDnsService.cs index 99cda5b7..cb731612 100644 --- a/v2rayN/ServiceLib/Services/CoreConfig/V2ray/V2rayDnsService.cs +++ b/v2rayN/ServiceLib/Services/CoreConfig/V2ray/V2rayDnsService.cs @@ -1,7 +1,3 @@ -using System.Text.Json; -using System.Text.Json.Nodes; -using System.Text.Json.Serialization; - namespace ServiceLib.Services.CoreConfig; public partial class CoreConfigV2rayService diff --git a/v2rayN/ServiceLib/Services/DownloadService.cs b/v2rayN/ServiceLib/Services/DownloadService.cs index 99170646..4b2a7881 100644 --- a/v2rayN/ServiceLib/Services/DownloadService.cs +++ b/v2rayN/ServiceLib/Services/DownloadService.cs @@ -1,6 +1,4 @@ -using System.Net; using System.Net.Http.Headers; -using System.Net.Sockets; namespace ServiceLib.Services; diff --git a/v2rayN/ServiceLib/Services/ProcessService.cs b/v2rayN/ServiceLib/Services/ProcessService.cs index 06e27d52..0f7161e3 100644 --- a/v2rayN/ServiceLib/Services/ProcessService.cs +++ b/v2rayN/ServiceLib/Services/ProcessService.cs @@ -1,6 +1,3 @@ -using System.Diagnostics; -using System.Text; - namespace ServiceLib.Services; public class ProcessService : IDisposable diff --git a/v2rayN/ServiceLib/Services/SpeedtestService.cs b/v2rayN/ServiceLib/Services/SpeedtestService.cs index b2cd6a2b..bb4e9386 100644 --- a/v2rayN/ServiceLib/Services/SpeedtestService.cs +++ b/v2rayN/ServiceLib/Services/SpeedtestService.cs @@ -1,8 +1,3 @@ -using System.Collections.Concurrent; -using System.Diagnostics; -using System.Net; -using System.Net.Sockets; - namespace ServiceLib.Services; public class SpeedtestService(Config config, Func updateFunc) diff --git a/v2rayN/ServiceLib/Services/Statistics/StatisticsSingboxService.cs b/v2rayN/ServiceLib/Services/Statistics/StatisticsSingboxService.cs index d3de6a18..2b0f53f1 100644 --- a/v2rayN/ServiceLib/Services/Statistics/StatisticsSingboxService.cs +++ b/v2rayN/ServiceLib/Services/Statistics/StatisticsSingboxService.cs @@ -1,5 +1,4 @@ using System.Net.WebSockets; -using System.Text; namespace ServiceLib.Services.Statistics; diff --git a/v2rayN/ServiceLib/Services/UpdateService.cs b/v2rayN/ServiceLib/Services/UpdateService.cs index 429c0a62..16a69464 100644 --- a/v2rayN/ServiceLib/Services/UpdateService.cs +++ b/v2rayN/ServiceLib/Services/UpdateService.cs @@ -1,6 +1,3 @@ -using System.Runtime.InteropServices; -using System.Text.RegularExpressions; - namespace ServiceLib.Services; public class UpdateService diff --git a/v2rayN/ServiceLib/ViewModels/AddGroupServerViewModel.cs b/v2rayN/ServiceLib/ViewModels/AddGroupServerViewModel.cs index 130f447d..b5bfe80d 100644 --- a/v2rayN/ServiceLib/ViewModels/AddGroupServerViewModel.cs +++ b/v2rayN/ServiceLib/ViewModels/AddGroupServerViewModel.cs @@ -1,8 +1,3 @@ -using System.Reactive; -using DynamicData.Binding; -using ReactiveUI; -using ReactiveUI.Fody.Helpers; - namespace ServiceLib.ViewModels; public class AddGroupServerViewModel : MyReactiveObject diff --git a/v2rayN/ServiceLib/ViewModels/AddServer2ViewModel.cs b/v2rayN/ServiceLib/ViewModels/AddServer2ViewModel.cs index a94ecf74..cbc97642 100644 --- a/v2rayN/ServiceLib/ViewModels/AddServer2ViewModel.cs +++ b/v2rayN/ServiceLib/ViewModels/AddServer2ViewModel.cs @@ -1,7 +1,3 @@ -using System.Reactive; -using ReactiveUI; -using ReactiveUI.Fody.Helpers; - namespace ServiceLib.ViewModels; public class AddServer2ViewModel : MyReactiveObject diff --git a/v2rayN/ServiceLib/ViewModels/AddServerViewModel.cs b/v2rayN/ServiceLib/ViewModels/AddServerViewModel.cs index cd2399bc..addd5bcc 100644 --- a/v2rayN/ServiceLib/ViewModels/AddServerViewModel.cs +++ b/v2rayN/ServiceLib/ViewModels/AddServerViewModel.cs @@ -1,7 +1,3 @@ -using System.Reactive; -using ReactiveUI; -using ReactiveUI.Fody.Helpers; - namespace ServiceLib.ViewModels; public class AddServerViewModel : MyReactiveObject diff --git a/v2rayN/ServiceLib/ViewModels/BackupAndRestoreViewModel.cs b/v2rayN/ServiceLib/ViewModels/BackupAndRestoreViewModel.cs index 5a96a04d..c0eae75f 100644 --- a/v2rayN/ServiceLib/ViewModels/BackupAndRestoreViewModel.cs +++ b/v2rayN/ServiceLib/ViewModels/BackupAndRestoreViewModel.cs @@ -1,7 +1,3 @@ -using System.Reactive; -using ReactiveUI; -using ReactiveUI.Fody.Helpers; - namespace ServiceLib.ViewModels; public class BackupAndRestoreViewModel : MyReactiveObject diff --git a/v2rayN/ServiceLib/ViewModels/CheckUpdateViewModel.cs b/v2rayN/ServiceLib/ViewModels/CheckUpdateViewModel.cs index 4c072712..5267979b 100644 --- a/v2rayN/ServiceLib/ViewModels/CheckUpdateViewModel.cs +++ b/v2rayN/ServiceLib/ViewModels/CheckUpdateViewModel.cs @@ -1,11 +1,3 @@ -using System.Reactive; -using System.Reactive.Disposables; -using System.Reactive.Linq; -using System.Runtime.InteropServices; -using DynamicData.Binding; -using ReactiveUI; -using ReactiveUI.Fody.Helpers; - namespace ServiceLib.ViewModels; public class CheckUpdateViewModel : MyReactiveObject diff --git a/v2rayN/ServiceLib/ViewModels/ClashConnectionsViewModel.cs b/v2rayN/ServiceLib/ViewModels/ClashConnectionsViewModel.cs index d45b8e7d..dbcc9a79 100644 --- a/v2rayN/ServiceLib/ViewModels/ClashConnectionsViewModel.cs +++ b/v2rayN/ServiceLib/ViewModels/ClashConnectionsViewModel.cs @@ -1,11 +1,3 @@ -using System.Reactive; -using System.Reactive.Disposables; -using System.Reactive.Linq; -using DynamicData; -using DynamicData.Binding; -using ReactiveUI; -using ReactiveUI.Fody.Helpers; - namespace ServiceLib.ViewModels; public class ClashConnectionsViewModel : MyReactiveObject diff --git a/v2rayN/ServiceLib/ViewModels/ClashProxiesViewModel.cs b/v2rayN/ServiceLib/ViewModels/ClashProxiesViewModel.cs index bf999d12..eb67a9d4 100644 --- a/v2rayN/ServiceLib/ViewModels/ClashProxiesViewModel.cs +++ b/v2rayN/ServiceLib/ViewModels/ClashProxiesViewModel.cs @@ -1,11 +1,4 @@ -using System.Reactive; using System.Reactive.Concurrency; -using System.Reactive.Disposables; -using System.Reactive.Linq; -using DynamicData; -using DynamicData.Binding; -using ReactiveUI; -using ReactiveUI.Fody.Helpers; using static ServiceLib.Models.ClashProviders; using static ServiceLib.Models.ClashProxies; diff --git a/v2rayN/ServiceLib/ViewModels/DNSSettingViewModel.cs b/v2rayN/ServiceLib/ViewModels/DNSSettingViewModel.cs index da21ab35..9c559a23 100644 --- a/v2rayN/ServiceLib/ViewModels/DNSSettingViewModel.cs +++ b/v2rayN/ServiceLib/ViewModels/DNSSettingViewModel.cs @@ -1,8 +1,3 @@ -using System.Reactive; -using System.Reactive.Linq; -using ReactiveUI; -using ReactiveUI.Fody.Helpers; - namespace ServiceLib.ViewModels; public class DNSSettingViewModel : MyReactiveObject diff --git a/v2rayN/ServiceLib/ViewModels/FullConfigTemplateViewModel.cs b/v2rayN/ServiceLib/ViewModels/FullConfigTemplateViewModel.cs index 3619ddef..a3907fc5 100644 --- a/v2rayN/ServiceLib/ViewModels/FullConfigTemplateViewModel.cs +++ b/v2rayN/ServiceLib/ViewModels/FullConfigTemplateViewModel.cs @@ -1,7 +1,3 @@ -using System.Reactive; -using ReactiveUI; -using ReactiveUI.Fody.Helpers; - namespace ServiceLib.ViewModels; public class FullConfigTemplateViewModel : MyReactiveObject diff --git a/v2rayN/ServiceLib/ViewModels/GlobalHotkeySettingViewModel.cs b/v2rayN/ServiceLib/ViewModels/GlobalHotkeySettingViewModel.cs index 0acb8726..581007f1 100644 --- a/v2rayN/ServiceLib/ViewModels/GlobalHotkeySettingViewModel.cs +++ b/v2rayN/ServiceLib/ViewModels/GlobalHotkeySettingViewModel.cs @@ -1,6 +1,3 @@ -using System.Reactive; -using ReactiveUI; - namespace ServiceLib.ViewModels; public class GlobalHotkeySettingViewModel : MyReactiveObject diff --git a/v2rayN/ServiceLib/ViewModels/MainWindowViewModel.cs b/v2rayN/ServiceLib/ViewModels/MainWindowViewModel.cs index 2ad35e32..0b721184 100644 --- a/v2rayN/ServiceLib/ViewModels/MainWindowViewModel.cs +++ b/v2rayN/ServiceLib/ViewModels/MainWindowViewModel.cs @@ -1,8 +1,4 @@ -using System.Reactive; using System.Reactive.Concurrency; -using System.Reactive.Linq; -using ReactiveUI; -using ReactiveUI.Fody.Helpers; namespace ServiceLib.ViewModels; diff --git a/v2rayN/ServiceLib/ViewModels/MsgViewModel.cs b/v2rayN/ServiceLib/ViewModels/MsgViewModel.cs index e9d89b94..08a77d33 100644 --- a/v2rayN/ServiceLib/ViewModels/MsgViewModel.cs +++ b/v2rayN/ServiceLib/ViewModels/MsgViewModel.cs @@ -1,10 +1,3 @@ -using System.Collections.Concurrent; -using System.Reactive.Linq; -using System.Text; -using System.Text.RegularExpressions; -using ReactiveUI; -using ReactiveUI.Fody.Helpers; - namespace ServiceLib.ViewModels; public class MsgViewModel : MyReactiveObject diff --git a/v2rayN/ServiceLib/ViewModels/OptionSettingViewModel.cs b/v2rayN/ServiceLib/ViewModels/OptionSettingViewModel.cs index 7f446cf2..d2f334af 100644 --- a/v2rayN/ServiceLib/ViewModels/OptionSettingViewModel.cs +++ b/v2rayN/ServiceLib/ViewModels/OptionSettingViewModel.cs @@ -1,7 +1,3 @@ -using System.Reactive; -using ReactiveUI; -using ReactiveUI.Fody.Helpers; - namespace ServiceLib.ViewModels; public class OptionSettingViewModel : MyReactiveObject diff --git a/v2rayN/ServiceLib/ViewModels/ProfilesSelectViewModel.cs b/v2rayN/ServiceLib/ViewModels/ProfilesSelectViewModel.cs index 8742755e..7301882c 100644 --- a/v2rayN/ServiceLib/ViewModels/ProfilesSelectViewModel.cs +++ b/v2rayN/ServiceLib/ViewModels/ProfilesSelectViewModel.cs @@ -1,9 +1,3 @@ -using System.Reactive.Linq; -using DynamicData; -using DynamicData.Binding; -using ReactiveUI; -using ReactiveUI.Fody.Helpers; - namespace ServiceLib.ViewModels; public class ProfilesSelectViewModel : MyReactiveObject diff --git a/v2rayN/ServiceLib/ViewModels/ProfilesViewModel.cs b/v2rayN/ServiceLib/ViewModels/ProfilesViewModel.cs index bf9c4dbf..1b7b82c7 100644 --- a/v2rayN/ServiceLib/ViewModels/ProfilesViewModel.cs +++ b/v2rayN/ServiceLib/ViewModels/ProfilesViewModel.cs @@ -1,12 +1,3 @@ -using System.Reactive; -using System.Reactive.Disposables; -using System.Reactive.Linq; -using System.Text; -using DynamicData; -using DynamicData.Binding; -using ReactiveUI; -using ReactiveUI.Fody.Helpers; - namespace ServiceLib.ViewModels; public class ProfilesViewModel : MyReactiveObject diff --git a/v2rayN/ServiceLib/ViewModels/RoutingRuleDetailsViewModel.cs b/v2rayN/ServiceLib/ViewModels/RoutingRuleDetailsViewModel.cs index 36b1babf..e984ab64 100644 --- a/v2rayN/ServiceLib/ViewModels/RoutingRuleDetailsViewModel.cs +++ b/v2rayN/ServiceLib/ViewModels/RoutingRuleDetailsViewModel.cs @@ -1,7 +1,3 @@ -using System.Reactive; -using ReactiveUI; -using ReactiveUI.Fody.Helpers; - namespace ServiceLib.ViewModels; public class RoutingRuleDetailsViewModel : MyReactiveObject diff --git a/v2rayN/ServiceLib/ViewModels/RoutingRuleSettingViewModel.cs b/v2rayN/ServiceLib/ViewModels/RoutingRuleSettingViewModel.cs index 979d3dc4..445e61bc 100644 --- a/v2rayN/ServiceLib/ViewModels/RoutingRuleSettingViewModel.cs +++ b/v2rayN/ServiceLib/ViewModels/RoutingRuleSettingViewModel.cs @@ -1,10 +1,3 @@ -using System.Reactive; -using System.Text.Json; -using System.Text.Json.Serialization; -using DynamicData.Binding; -using ReactiveUI; -using ReactiveUI.Fody.Helpers; - namespace ServiceLib.ViewModels; public class RoutingRuleSettingViewModel : MyReactiveObject diff --git a/v2rayN/ServiceLib/ViewModels/RoutingSettingViewModel.cs b/v2rayN/ServiceLib/ViewModels/RoutingSettingViewModel.cs index 5237a8d2..8f62f2d0 100644 --- a/v2rayN/ServiceLib/ViewModels/RoutingSettingViewModel.cs +++ b/v2rayN/ServiceLib/ViewModels/RoutingSettingViewModel.cs @@ -1,8 +1,3 @@ -using System.Reactive; -using DynamicData.Binding; -using ReactiveUI; -using ReactiveUI.Fody.Helpers; - namespace ServiceLib.ViewModels; public class RoutingSettingViewModel : MyReactiveObject diff --git a/v2rayN/ServiceLib/ViewModels/StatusBarViewModel.cs b/v2rayN/ServiceLib/ViewModels/StatusBarViewModel.cs index 9742cfe6..707722ad 100644 --- a/v2rayN/ServiceLib/ViewModels/StatusBarViewModel.cs +++ b/v2rayN/ServiceLib/ViewModels/StatusBarViewModel.cs @@ -1,11 +1,3 @@ -using System.Reactive; -using System.Reactive.Disposables; -using System.Reactive.Linq; -using System.Text; -using DynamicData.Binding; -using ReactiveUI; -using ReactiveUI.Fody.Helpers; - namespace ServiceLib.ViewModels; public class StatusBarViewModel : MyReactiveObject diff --git a/v2rayN/ServiceLib/ViewModels/SubEditViewModel.cs b/v2rayN/ServiceLib/ViewModels/SubEditViewModel.cs index bfbfbbe7..344f4ac8 100644 --- a/v2rayN/ServiceLib/ViewModels/SubEditViewModel.cs +++ b/v2rayN/ServiceLib/ViewModels/SubEditViewModel.cs @@ -1,7 +1,3 @@ -using System.Reactive; -using ReactiveUI; -using ReactiveUI.Fody.Helpers; - namespace ServiceLib.ViewModels; public class SubEditViewModel : MyReactiveObject diff --git a/v2rayN/ServiceLib/ViewModels/SubSettingViewModel.cs b/v2rayN/ServiceLib/ViewModels/SubSettingViewModel.cs index 88f33619..ce0f6fa7 100644 --- a/v2rayN/ServiceLib/ViewModels/SubSettingViewModel.cs +++ b/v2rayN/ServiceLib/ViewModels/SubSettingViewModel.cs @@ -1,9 +1,3 @@ -using System.Reactive; -using DynamicData; -using DynamicData.Binding; -using ReactiveUI; -using ReactiveUI.Fody.Helpers; - namespace ServiceLib.ViewModels; public class SubSettingViewModel : MyReactiveObject From eb1339f2f53e92abade5ac7635e48b3ff491e849 Mon Sep 17 00:00:00 2001 From: 2dust <31833384+2dust@users.noreply.github.com> Date: Sun, 19 Oct 2025 13:54:40 +0800 Subject: [PATCH 03/21] Optimize and improve GlobalUsings --- v2rayN/v2rayN/App.xaml.cs | 4 ---- v2rayN/v2rayN/AssemblyInfo.cs | 4 +--- v2rayN/v2rayN/Base/WindowBase.cs | 3 --- v2rayN/v2rayN/Common/QRCodeUtils.cs | 3 --- v2rayN/v2rayN/Common/UI.cs | 1 - v2rayN/v2rayN/Common/WindowsUtils.cs | 3 --- .../v2rayN/Converters/DelayColorConverter.cs | 1 - .../Converters/InverseBooleanConverter.cs | 3 --- v2rayN/v2rayN/GlobalUsings.cs | 23 +++++++++++++++++++ v2rayN/v2rayN/Manager/HotkeyManager.cs | 7 ------ v2rayN/v2rayN/Manager/WindowsManager.cs | 1 - .../ViewModels/ThemeSettingViewModel.cs | 8 ------- .../v2rayN/Views/AddGroupServerWindow.xaml.cs | 6 ----- v2rayN/v2rayN/Views/AddServer2Window.xaml.cs | 4 ---- v2rayN/v2rayN/Views/AddServerWindow.xaml.cs | 3 --- .../v2rayN/Views/BackupAndRestoreView.xaml.cs | 4 ---- v2rayN/v2rayN/Views/CheckUpdateView.xaml.cs | 3 --- .../v2rayN/Views/ClashConnectionsView.xaml.cs | 3 --- v2rayN/v2rayN/Views/ClashProxiesView.xaml.cs | 4 ---- v2rayN/v2rayN/Views/DNSSettingWindow.xaml.cs | 5 ---- .../Views/FullConfigTemplateWindow.xaml.cs | 4 ---- .../Views/GlobalHotkeySettingWindow.xaml.cs | 5 ---- v2rayN/v2rayN/Views/MainWindow.xaml.cs | 7 ------ v2rayN/v2rayN/Views/MsgView.xaml.cs | 5 ---- .../v2rayN/Views/OptionSettingWindow.xaml.cs | 5 ---- .../v2rayN/Views/ProfilesSelectWindow.xaml.cs | 4 ---- v2rayN/v2rayN/Views/ProfilesView.xaml.cs | 6 ----- .../Views/RoutingRuleDetailsWindow.xaml.cs | 4 ---- .../Views/RoutingRuleSettingWindow.xaml.cs | 5 ---- .../v2rayN/Views/RoutingSettingWindow.xaml.cs | 5 ---- v2rayN/v2rayN/Views/StatusBarView.xaml.cs | 5 ---- v2rayN/v2rayN/Views/SubEditWindow.xaml.cs | 4 ---- v2rayN/v2rayN/Views/SubSettingWindow.xaml.cs | 5 ---- v2rayN/v2rayN/Views/ThemeSettingView.xaml.cs | 2 -- 34 files changed, 24 insertions(+), 135 deletions(-) diff --git a/v2rayN/v2rayN/App.xaml.cs b/v2rayN/v2rayN/App.xaml.cs index b37b6986..de9a5370 100644 --- a/v2rayN/v2rayN/App.xaml.cs +++ b/v2rayN/v2rayN/App.xaml.cs @@ -1,7 +1,3 @@ -using System.Diagnostics; -using System.Windows; -using System.Windows.Threading; - namespace v2rayN; /// diff --git a/v2rayN/v2rayN/AssemblyInfo.cs b/v2rayN/v2rayN/AssemblyInfo.cs index 4f943deb..cb66e3c1 100644 --- a/v2rayN/v2rayN/AssemblyInfo.cs +++ b/v2rayN/v2rayN/AssemblyInfo.cs @@ -1,5 +1,3 @@ -using System.Windows; - [assembly: ThemeInfo( ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located //(used if a resource is not found in the page, @@ -7,4 +5,4 @@ using System.Windows; ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located //(used if a resource is not found in the page, // app, or any theme specific resource dictionaries) -)] \ No newline at end of file +)] diff --git a/v2rayN/v2rayN/Base/WindowBase.cs b/v2rayN/v2rayN/Base/WindowBase.cs index 1c5b8cda..aa6401e5 100644 --- a/v2rayN/v2rayN/Base/WindowBase.cs +++ b/v2rayN/v2rayN/Base/WindowBase.cs @@ -1,6 +1,3 @@ -using System.Windows; -using ReactiveUI; - namespace v2rayN.Base; public class WindowBase : ReactiveWindow where TViewModel : class diff --git a/v2rayN/v2rayN/Common/QRCodeUtils.cs b/v2rayN/v2rayN/Common/QRCodeUtils.cs index ce8eec5e..6b0bc38d 100644 --- a/v2rayN/v2rayN/Common/QRCodeUtils.cs +++ b/v2rayN/v2rayN/Common/QRCodeUtils.cs @@ -1,7 +1,4 @@ -using System.Collections; using System.Drawing; -using System.Windows; -using System.Windows.Interop; using System.Windows.Media; using System.Windows.Media.Imaging; diff --git a/v2rayN/v2rayN/Common/UI.cs b/v2rayN/v2rayN/Common/UI.cs index 60d81a4d..1d5e860c 100644 --- a/v2rayN/v2rayN/Common/UI.cs +++ b/v2rayN/v2rayN/Common/UI.cs @@ -1,4 +1,3 @@ -using System.Windows; using Microsoft.Win32; namespace v2rayN; diff --git a/v2rayN/v2rayN/Common/WindowsUtils.cs b/v2rayN/v2rayN/Common/WindowsUtils.cs index 346c7763..80778268 100644 --- a/v2rayN/v2rayN/Common/WindowsUtils.cs +++ b/v2rayN/v2rayN/Common/WindowsUtils.cs @@ -1,7 +1,4 @@ using System.Drawing; -using System.Runtime.InteropServices; -using System.Windows; -using System.Windows.Interop; using System.Windows.Media; using System.Windows.Media.Imaging; using Microsoft.Win32; diff --git a/v2rayN/v2rayN/Converters/DelayColorConverter.cs b/v2rayN/v2rayN/Converters/DelayColorConverter.cs index cab9828e..8fb8e239 100644 --- a/v2rayN/v2rayN/Converters/DelayColorConverter.cs +++ b/v2rayN/v2rayN/Converters/DelayColorConverter.cs @@ -1,4 +1,3 @@ -using System.Windows.Data; using System.Windows.Media; namespace v2rayN.Converters; diff --git a/v2rayN/v2rayN/Converters/InverseBooleanConverter.cs b/v2rayN/v2rayN/Converters/InverseBooleanConverter.cs index 29b212d7..a83b4ebc 100644 --- a/v2rayN/v2rayN/Converters/InverseBooleanConverter.cs +++ b/v2rayN/v2rayN/Converters/InverseBooleanConverter.cs @@ -1,6 +1,3 @@ -using System.Globalization; -using System.Windows.Data; - namespace v2rayN.Converters; [ValueConversion(typeof(bool), typeof(bool))] diff --git a/v2rayN/v2rayN/GlobalUsings.cs b/v2rayN/v2rayN/GlobalUsings.cs index aede90cc..21d8dbab 100644 --- a/v2rayN/v2rayN/GlobalUsings.cs +++ b/v2rayN/v2rayN/GlobalUsings.cs @@ -1,3 +1,26 @@ +global using System; +global using System.Collections; +global using System.Collections.Generic; +global using System.ComponentModel; +global using System.Diagnostics; +global using System.Globalization; +global using System.IO; +global using System.Linq; +global using System.Reactive.Disposables; +global using System.Reactive.Linq; +global using System.Runtime.InteropServices; +global using System.Text; +global using System.Threading; +global using System.Threading.Tasks; +global using System.Windows; +global using System.Windows.Data; +global using System.Windows.Input; +global using System.Windows.Interop; +global using System.Windows.Threading; +global using DynamicData; +global using DynamicData.Binding; +global using ReactiveUI; +global using ReactiveUI.Fody.Helpers; global using ServiceLib; global using ServiceLib.Base; global using ServiceLib.Common; diff --git a/v2rayN/v2rayN/Manager/HotkeyManager.cs b/v2rayN/v2rayN/Manager/HotkeyManager.cs index 538ce605..dc9eec8e 100644 --- a/v2rayN/v2rayN/Manager/HotkeyManager.cs +++ b/v2rayN/v2rayN/Manager/HotkeyManager.cs @@ -1,10 +1,3 @@ -using System.ComponentModel; -using System.Runtime.InteropServices; -using System.Text; -using System.Windows; -using System.Windows.Input; -using System.Windows.Interop; - namespace v2rayN.Manager; public sealed class HotkeyManager diff --git a/v2rayN/v2rayN/Manager/WindowsManager.cs b/v2rayN/v2rayN/Manager/WindowsManager.cs index db5818f9..c3bb98d7 100644 --- a/v2rayN/v2rayN/Manager/WindowsManager.cs +++ b/v2rayN/v2rayN/Manager/WindowsManager.cs @@ -1,5 +1,4 @@ using System.Drawing; -using System.IO; using System.Windows.Media.Imaging; namespace v2rayN.Manager; diff --git a/v2rayN/v2rayN/ViewModels/ThemeSettingViewModel.cs b/v2rayN/v2rayN/ViewModels/ThemeSettingViewModel.cs index 38204778..b92f2ff2 100644 --- a/v2rayN/v2rayN/ViewModels/ThemeSettingViewModel.cs +++ b/v2rayN/v2rayN/ViewModels/ThemeSettingViewModel.cs @@ -1,14 +1,6 @@ -using System.Reactive.Linq; -using System.Runtime.InteropServices; -using System.Windows; -using System.Windows.Interop; -using DynamicData; -using DynamicData.Binding; using MaterialDesignColors; using MaterialDesignColors.ColorManipulation; using MaterialDesignThemes.Wpf; -using ReactiveUI; -using ReactiveUI.Fody.Helpers; namespace v2rayN.ViewModels; diff --git a/v2rayN/v2rayN/Views/AddGroupServerWindow.xaml.cs b/v2rayN/v2rayN/Views/AddGroupServerWindow.xaml.cs index 84cdec42..a08d7962 100644 --- a/v2rayN/v2rayN/Views/AddGroupServerWindow.xaml.cs +++ b/v2rayN/v2rayN/Views/AddGroupServerWindow.xaml.cs @@ -1,9 +1,3 @@ -using System.Reactive.Disposables; -using System.Windows; -using System.Windows.Input; -using DynamicData; -using ReactiveUI; - namespace v2rayN.Views; public partial class AddGroupServerWindow diff --git a/v2rayN/v2rayN/Views/AddServer2Window.xaml.cs b/v2rayN/v2rayN/Views/AddServer2Window.xaml.cs index b9c62dcd..0f429a49 100644 --- a/v2rayN/v2rayN/Views/AddServer2Window.xaml.cs +++ b/v2rayN/v2rayN/Views/AddServer2Window.xaml.cs @@ -1,7 +1,3 @@ -using System.Reactive.Disposables; -using System.Windows; -using ReactiveUI; - namespace v2rayN.Views; public partial class AddServer2Window diff --git a/v2rayN/v2rayN/Views/AddServerWindow.xaml.cs b/v2rayN/v2rayN/Views/AddServerWindow.xaml.cs index 2c0406d5..65383c32 100644 --- a/v2rayN/v2rayN/Views/AddServerWindow.xaml.cs +++ b/v2rayN/v2rayN/Views/AddServerWindow.xaml.cs @@ -1,7 +1,4 @@ -using System.Reactive.Disposables; -using System.Windows; using System.Windows.Controls; -using ReactiveUI; namespace v2rayN.Views; diff --git a/v2rayN/v2rayN/Views/BackupAndRestoreView.xaml.cs b/v2rayN/v2rayN/Views/BackupAndRestoreView.xaml.cs index c69fbe14..cc5a3610 100644 --- a/v2rayN/v2rayN/Views/BackupAndRestoreView.xaml.cs +++ b/v2rayN/v2rayN/Views/BackupAndRestoreView.xaml.cs @@ -1,7 +1,3 @@ -using System.Reactive.Disposables; -using System.Windows; -using ReactiveUI; - namespace v2rayN.Views; public partial class BackupAndRestoreView diff --git a/v2rayN/v2rayN/Views/CheckUpdateView.xaml.cs b/v2rayN/v2rayN/Views/CheckUpdateView.xaml.cs index cf53fc1a..b6adb2f5 100644 --- a/v2rayN/v2rayN/Views/CheckUpdateView.xaml.cs +++ b/v2rayN/v2rayN/Views/CheckUpdateView.xaml.cs @@ -1,6 +1,3 @@ -using System.Reactive.Disposables; -using ReactiveUI; - namespace v2rayN.Views; public partial class CheckUpdateView diff --git a/v2rayN/v2rayN/Views/ClashConnectionsView.xaml.cs b/v2rayN/v2rayN/Views/ClashConnectionsView.xaml.cs index da1795bd..0a6245a9 100644 --- a/v2rayN/v2rayN/Views/ClashConnectionsView.xaml.cs +++ b/v2rayN/v2rayN/Views/ClashConnectionsView.xaml.cs @@ -1,7 +1,4 @@ -using System.Reactive.Disposables; -using System.Windows; using System.Windows.Controls; -using ReactiveUI; namespace v2rayN.Views; diff --git a/v2rayN/v2rayN/Views/ClashProxiesView.xaml.cs b/v2rayN/v2rayN/Views/ClashProxiesView.xaml.cs index 23943da1..f475c84a 100644 --- a/v2rayN/v2rayN/Views/ClashProxiesView.xaml.cs +++ b/v2rayN/v2rayN/Views/ClashProxiesView.xaml.cs @@ -1,7 +1,3 @@ -using System.Reactive.Disposables; -using System.Windows.Input; -using ReactiveUI; - namespace v2rayN.Views; /// diff --git a/v2rayN/v2rayN/Views/DNSSettingWindow.xaml.cs b/v2rayN/v2rayN/Views/DNSSettingWindow.xaml.cs index 00c7d0fb..ad99b357 100644 --- a/v2rayN/v2rayN/Views/DNSSettingWindow.xaml.cs +++ b/v2rayN/v2rayN/Views/DNSSettingWindow.xaml.cs @@ -1,8 +1,3 @@ -using System.Reactive.Disposables; -using System.Reactive.Linq; -using System.Windows; -using ReactiveUI; - namespace v2rayN.Views; public partial class DNSSettingWindow diff --git a/v2rayN/v2rayN/Views/FullConfigTemplateWindow.xaml.cs b/v2rayN/v2rayN/Views/FullConfigTemplateWindow.xaml.cs index 7f3c3341..e0cd8b14 100644 --- a/v2rayN/v2rayN/Views/FullConfigTemplateWindow.xaml.cs +++ b/v2rayN/v2rayN/Views/FullConfigTemplateWindow.xaml.cs @@ -1,7 +1,3 @@ -using System.Reactive.Disposables; -using System.Windows; -using ReactiveUI; - namespace v2rayN.Views; public partial class FullConfigTemplateWindow diff --git a/v2rayN/v2rayN/Views/GlobalHotkeySettingWindow.xaml.cs b/v2rayN/v2rayN/Views/GlobalHotkeySettingWindow.xaml.cs index b23b2860..f71fe7cc 100644 --- a/v2rayN/v2rayN/Views/GlobalHotkeySettingWindow.xaml.cs +++ b/v2rayN/v2rayN/Views/GlobalHotkeySettingWindow.xaml.cs @@ -1,9 +1,4 @@ -using System.Reactive.Disposables; -using System.Text; -using System.Windows; using System.Windows.Controls; -using System.Windows.Input; -using ReactiveUI; using v2rayN.Manager; namespace v2rayN.Views; diff --git a/v2rayN/v2rayN/Views/MainWindow.xaml.cs b/v2rayN/v2rayN/Views/MainWindow.xaml.cs index 3fccddf0..9dc818ee 100644 --- a/v2rayN/v2rayN/Views/MainWindow.xaml.cs +++ b/v2rayN/v2rayN/Views/MainWindow.xaml.cs @@ -1,13 +1,6 @@ -using System.ComponentModel; -using System.Reactive.Disposables; -using System.Reactive.Linq; -using System.Windows; using System.Windows.Controls; -using System.Windows.Input; -using System.Windows.Interop; using System.Windows.Media; using MaterialDesignThemes.Wpf; -using ReactiveUI; using v2rayN.Manager; namespace v2rayN.Views; diff --git a/v2rayN/v2rayN/Views/MsgView.xaml.cs b/v2rayN/v2rayN/Views/MsgView.xaml.cs index 449597cc..61fbe469 100644 --- a/v2rayN/v2rayN/Views/MsgView.xaml.cs +++ b/v2rayN/v2rayN/Views/MsgView.xaml.cs @@ -1,8 +1,3 @@ -using System.Reactive.Disposables; -using System.Windows; -using System.Windows.Threading; -using ReactiveUI; - namespace v2rayN.Views; public partial class MsgView diff --git a/v2rayN/v2rayN/Views/OptionSettingWindow.xaml.cs b/v2rayN/v2rayN/Views/OptionSettingWindow.xaml.cs index 31b43d9a..1824e2a5 100644 --- a/v2rayN/v2rayN/Views/OptionSettingWindow.xaml.cs +++ b/v2rayN/v2rayN/Views/OptionSettingWindow.xaml.cs @@ -1,9 +1,4 @@ -using System.Globalization; -using System.IO; -using System.Reactive.Disposables; -using System.Windows; using System.Windows.Media; -using ReactiveUI; namespace v2rayN.Views; diff --git a/v2rayN/v2rayN/Views/ProfilesSelectWindow.xaml.cs b/v2rayN/v2rayN/Views/ProfilesSelectWindow.xaml.cs index 6e3369df..1b8419a0 100644 --- a/v2rayN/v2rayN/Views/ProfilesSelectWindow.xaml.cs +++ b/v2rayN/v2rayN/Views/ProfilesSelectWindow.xaml.cs @@ -1,9 +1,5 @@ -using System.Reactive.Disposables; -using System.Windows; using System.Windows.Controls; using System.Windows.Controls.Primitives; -using System.Windows.Input; -using ReactiveUI; using v2rayN.Base; namespace v2rayN.Views; diff --git a/v2rayN/v2rayN/Views/ProfilesView.xaml.cs b/v2rayN/v2rayN/Views/ProfilesView.xaml.cs index fc8d027f..76d73a26 100644 --- a/v2rayN/v2rayN/Views/ProfilesView.xaml.cs +++ b/v2rayN/v2rayN/Views/ProfilesView.xaml.cs @@ -1,13 +1,7 @@ -using System.Reactive.Disposables; -using System.Reactive.Linq; -using System.Windows; using System.Windows.Controls; using System.Windows.Controls.Primitives; -using System.Windows.Input; using System.Windows.Media; -using System.Windows.Threading; using MaterialDesignThemes.Wpf; -using ReactiveUI; using v2rayN.Base; using Point = System.Windows.Point; diff --git a/v2rayN/v2rayN/Views/RoutingRuleDetailsWindow.xaml.cs b/v2rayN/v2rayN/Views/RoutingRuleDetailsWindow.xaml.cs index 220f58b2..0586067a 100644 --- a/v2rayN/v2rayN/Views/RoutingRuleDetailsWindow.xaml.cs +++ b/v2rayN/v2rayN/Views/RoutingRuleDetailsWindow.xaml.cs @@ -1,7 +1,3 @@ -using System.Reactive.Disposables; -using System.Windows; -using ReactiveUI; - namespace v2rayN.Views; public partial class RoutingRuleDetailsWindow diff --git a/v2rayN/v2rayN/Views/RoutingRuleSettingWindow.xaml.cs b/v2rayN/v2rayN/Views/RoutingRuleSettingWindow.xaml.cs index d69146d9..153aaedc 100644 --- a/v2rayN/v2rayN/Views/RoutingRuleSettingWindow.xaml.cs +++ b/v2rayN/v2rayN/Views/RoutingRuleSettingWindow.xaml.cs @@ -1,8 +1,3 @@ -using System.Reactive.Disposables; -using System.Windows; -using System.Windows.Input; -using ReactiveUI; - namespace v2rayN.Views; public partial class RoutingRuleSettingWindow diff --git a/v2rayN/v2rayN/Views/RoutingSettingWindow.xaml.cs b/v2rayN/v2rayN/Views/RoutingSettingWindow.xaml.cs index e597715b..565897b0 100644 --- a/v2rayN/v2rayN/Views/RoutingSettingWindow.xaml.cs +++ b/v2rayN/v2rayN/Views/RoutingSettingWindow.xaml.cs @@ -1,8 +1,3 @@ -using System.Reactive.Disposables; -using System.Windows; -using System.Windows.Input; -using ReactiveUI; - namespace v2rayN.Views; public partial class RoutingSettingWindow diff --git a/v2rayN/v2rayN/Views/StatusBarView.xaml.cs b/v2rayN/v2rayN/Views/StatusBarView.xaml.cs index 1d80a694..906308ab 100644 --- a/v2rayN/v2rayN/Views/StatusBarView.xaml.cs +++ b/v2rayN/v2rayN/Views/StatusBarView.xaml.cs @@ -1,8 +1,3 @@ -using System.Reactive.Disposables; -using System.Windows; -using System.Windows.Input; -using System.Windows.Threading; -using ReactiveUI; using v2rayN.Manager; namespace v2rayN.Views; diff --git a/v2rayN/v2rayN/Views/SubEditWindow.xaml.cs b/v2rayN/v2rayN/Views/SubEditWindow.xaml.cs index 8bd7d6c5..488420fa 100644 --- a/v2rayN/v2rayN/Views/SubEditWindow.xaml.cs +++ b/v2rayN/v2rayN/Views/SubEditWindow.xaml.cs @@ -1,7 +1,3 @@ -using System.Reactive.Disposables; -using System.Windows; -using ReactiveUI; - namespace v2rayN.Views; public partial class SubEditWindow diff --git a/v2rayN/v2rayN/Views/SubSettingWindow.xaml.cs b/v2rayN/v2rayN/Views/SubSettingWindow.xaml.cs index 9e8d0c76..f44739d3 100644 --- a/v2rayN/v2rayN/Views/SubSettingWindow.xaml.cs +++ b/v2rayN/v2rayN/Views/SubSettingWindow.xaml.cs @@ -1,9 +1,4 @@ -using System.ComponentModel; -using System.Reactive.Disposables; -using System.Windows; -using System.Windows.Input; using MaterialDesignThemes.Wpf; -using ReactiveUI; namespace v2rayN.Views; diff --git a/v2rayN/v2rayN/Views/ThemeSettingView.xaml.cs b/v2rayN/v2rayN/Views/ThemeSettingView.xaml.cs index 93d634de..0aacbdbb 100644 --- a/v2rayN/v2rayN/Views/ThemeSettingView.xaml.cs +++ b/v2rayN/v2rayN/Views/ThemeSettingView.xaml.cs @@ -1,5 +1,3 @@ -using System.Reactive.Disposables; -using ReactiveUI; using v2rayN.ViewModels; namespace v2rayN.Views; From cb5069bcfc34c8a832a587f230b829745f241f60 Mon Sep 17 00:00:00 2001 From: 2dust <31833384+2dust@users.noreply.github.com> Date: Sun, 19 Oct 2025 14:13:26 +0800 Subject: [PATCH 04/21] Optimize and improve GlobalUsings --- v2rayN/v2rayN.Desktop/App.axaml.cs | 3 --- v2rayN/v2rayN.Desktop/Base/WindowBase.cs | 4 --- .../Common/AppBuilderExtension.cs | 3 --- v2rayN/v2rayN.Desktop/Common/AvaUtils.cs | 5 ---- .../Common/TextEditorKeywordHighlighter.cs | 1 - v2rayN/v2rayN.Desktop/Common/UI.cs | 2 -- .../Converters/DelayColorConverter.cs | 2 -- v2rayN/v2rayN.Desktop/GlobalUsings.cs | 26 +++++++++++++++++++ .../v2rayN.Desktop/Manager/HotkeyManager.cs | 5 +--- v2rayN/v2rayN.Desktop/Program.cs | 2 -- .../ViewModels/ThemeSettingViewModel.cs | 7 ----- .../Views/AddGroupServerWindow.axaml.cs | 6 ----- .../Views/AddServer2Window.axaml.cs | 3 --- .../Views/AddServerWindow.axaml.cs | 4 --- .../Views/BackupAndRestoreView.axaml.cs | 5 ---- .../Views/CheckUpdateView.axaml.cs | 4 --- .../Views/ClashConnectionsView.axaml.cs | 6 ----- .../Views/ClashProxiesView.axaml.cs | 6 ----- .../Views/DNSSettingWindow.axaml.cs | 5 ---- .../Views/FullConfigTemplateWindow.axaml.cs | 3 --- .../Views/GlobalHotkeySettingWindow.axaml.cs | 6 ----- .../v2rayN.Desktop/Views/MainWindow.axaml.cs | 10 ------- v2rayN/v2rayN.Desktop/Views/MsgView.axaml.cs | 6 ----- .../Views/OptionSettingWindow.axaml.cs | 4 --- .../Views/ProfilesSelectWindow.axaml.cs | 6 ----- .../Views/ProfilesView.axaml.cs | 9 ------- .../v2rayN.Desktop/Views/QrcodeView.axaml.cs | 4 --- .../Views/RoutingRuleDetailsWindow.axaml.cs | 4 --- .../Views/RoutingRuleSettingWindow.axaml.cs | 6 ----- .../Views/RoutingSettingWindow.axaml.cs | 6 ----- .../Views/StatusBarView.axaml.cs | 7 ----- .../Views/SubEditWindow.axaml.cs | 4 --- .../Views/SubSettingWindow.axaml.cs | 7 ----- .../Views/SudoPasswordInputView.axaml.cs | 2 -- .../Views/ThemeSettingView.axaml.cs | 4 --- 35 files changed, 27 insertions(+), 160 deletions(-) diff --git a/v2rayN/v2rayN.Desktop/App.axaml.cs b/v2rayN/v2rayN.Desktop/App.axaml.cs index 9f4d605f..5da86c6e 100644 --- a/v2rayN/v2rayN.Desktop/App.axaml.cs +++ b/v2rayN/v2rayN.Desktop/App.axaml.cs @@ -1,6 +1,3 @@ -using Avalonia; -using Avalonia.Controls.ApplicationLifetimes; -using Avalonia.Markup.Xaml; using v2rayN.Desktop.Views; namespace v2rayN.Desktop; diff --git a/v2rayN/v2rayN.Desktop/Base/WindowBase.cs b/v2rayN/v2rayN.Desktop/Base/WindowBase.cs index 10105d2e..63b00036 100644 --- a/v2rayN/v2rayN.Desktop/Base/WindowBase.cs +++ b/v2rayN/v2rayN.Desktop/Base/WindowBase.cs @@ -1,7 +1,3 @@ -using Avalonia; -using Avalonia.Interactivity; -using Avalonia.ReactiveUI; - namespace v2rayN.Desktop.Base; public class WindowBase : ReactiveWindow where TViewModel : class diff --git a/v2rayN/v2rayN.Desktop/Common/AppBuilderExtension.cs b/v2rayN/v2rayN.Desktop/Common/AppBuilderExtension.cs index 3c5169cc..c0702938 100644 --- a/v2rayN/v2rayN.Desktop/Common/AppBuilderExtension.cs +++ b/v2rayN/v2rayN.Desktop/Common/AppBuilderExtension.cs @@ -1,6 +1,3 @@ -using Avalonia; -using Avalonia.Media; - namespace v2rayN.Desktop.Common; public static class AppBuilderExtension diff --git a/v2rayN/v2rayN.Desktop/Common/AvaUtils.cs b/v2rayN/v2rayN.Desktop/Common/AvaUtils.cs index f7f03ab3..1ef294f6 100644 --- a/v2rayN/v2rayN.Desktop/Common/AvaUtils.cs +++ b/v2rayN/v2rayN.Desktop/Common/AvaUtils.cs @@ -1,9 +1,4 @@ -using Avalonia; -using Avalonia.Controls; -using Avalonia.Input; using Avalonia.Input.Platform; -using Avalonia.Media.Imaging; -using Avalonia.Platform; namespace v2rayN.Desktop.Common; diff --git a/v2rayN/v2rayN.Desktop/Common/TextEditorKeywordHighlighter.cs b/v2rayN/v2rayN.Desktop/Common/TextEditorKeywordHighlighter.cs index af1de3d0..f5e4dc6a 100644 --- a/v2rayN/v2rayN.Desktop/Common/TextEditorKeywordHighlighter.cs +++ b/v2rayN/v2rayN.Desktop/Common/TextEditorKeywordHighlighter.cs @@ -1,4 +1,3 @@ -using Avalonia.Media; using AvaloniaEdit; using AvaloniaEdit.Document; using AvaloniaEdit.Rendering; diff --git a/v2rayN/v2rayN.Desktop/Common/UI.cs b/v2rayN/v2rayN.Desktop/Common/UI.cs index e9ddc36f..c17d8947 100644 --- a/v2rayN/v2rayN.Desktop/Common/UI.cs +++ b/v2rayN/v2rayN.Desktop/Common/UI.cs @@ -1,7 +1,5 @@ -using Avalonia.Controls; using Avalonia.Platform.Storage; using MsBox.Avalonia; -using MsBox.Avalonia.Enums; namespace v2rayN.Desktop.Common; diff --git a/v2rayN/v2rayN.Desktop/Converters/DelayColorConverter.cs b/v2rayN/v2rayN.Desktop/Converters/DelayColorConverter.cs index 05364578..82cd0cf1 100644 --- a/v2rayN/v2rayN.Desktop/Converters/DelayColorConverter.cs +++ b/v2rayN/v2rayN.Desktop/Converters/DelayColorConverter.cs @@ -1,6 +1,4 @@ -using System.Globalization; using Avalonia.Data.Converters; -using Avalonia.Media; namespace v2rayN.Desktop.Converters; diff --git a/v2rayN/v2rayN.Desktop/GlobalUsings.cs b/v2rayN/v2rayN.Desktop/GlobalUsings.cs index aede90cc..c9a2bc45 100644 --- a/v2rayN/v2rayN.Desktop/GlobalUsings.cs +++ b/v2rayN/v2rayN.Desktop/GlobalUsings.cs @@ -1,3 +1,29 @@ +global using System; +global using System.Collections.Generic; +global using System.Globalization; +global using System.IO; +global using System.Linq; +global using System.Reactive.Disposables; +global using System.Reactive.Linq; +global using System.Text; +global using System.Threading; +global using System.Threading.Tasks; +global using Avalonia; +global using Avalonia.Controls; +global using Avalonia.Controls.ApplicationLifetimes; +global using Avalonia.Input; +global using Avalonia.Interactivity; +global using Avalonia.Markup.Xaml; +global using Avalonia.Media; +global using Avalonia.Media.Imaging; +global using Avalonia.Platform; +global using Avalonia.ReactiveUI; +global using Avalonia.Styling; +global using Avalonia.Threading; +global using ReactiveUI; +global using ReactiveUI.Fody.Helpers; +global using DynamicData; +global using MsBox.Avalonia.Enums; global using ServiceLib; global using ServiceLib.Base; global using ServiceLib.Common; diff --git a/v2rayN/v2rayN.Desktop/Manager/HotkeyManager.cs b/v2rayN/v2rayN.Desktop/Manager/HotkeyManager.cs index 5ce6ff60..f803c538 100644 --- a/v2rayN/v2rayN.Desktop/Manager/HotkeyManager.cs +++ b/v2rayN/v2rayN.Desktop/Manager/HotkeyManager.cs @@ -1,6 +1,3 @@ -using System.Reactive.Linq; -using Avalonia.Input; -using Avalonia.ReactiveUI; using Avalonia.Win32.Input; using GlobalHotKeys; @@ -11,7 +8,7 @@ public sealed class HotkeyManager private static readonly Lazy _instance = new(() => new()); public static HotkeyManager Instance = _instance.Value; private readonly Dictionary _hotkeyTriggerDic = new(); - private HotKeyManager? _hotKeyManager; + private GlobalHotKeys.HotKeyManager? _hotKeyManager; private Config? _config; diff --git a/v2rayN/v2rayN.Desktop/Program.cs b/v2rayN/v2rayN.Desktop/Program.cs index 4b534324..1a0ce38e 100644 --- a/v2rayN/v2rayN.Desktop/Program.cs +++ b/v2rayN/v2rayN.Desktop/Program.cs @@ -1,5 +1,3 @@ -using Avalonia; -using Avalonia.ReactiveUI; using v2rayN.Desktop.Common; namespace v2rayN.Desktop; diff --git a/v2rayN/v2rayN.Desktop/ViewModels/ThemeSettingViewModel.cs b/v2rayN/v2rayN.Desktop/ViewModels/ThemeSettingViewModel.cs index ae12fa07..2bfa5eaf 100644 --- a/v2rayN/v2rayN.Desktop/ViewModels/ThemeSettingViewModel.cs +++ b/v2rayN/v2rayN.Desktop/ViewModels/ThemeSettingViewModel.cs @@ -1,13 +1,6 @@ -using System.Reactive.Linq; -using Avalonia; -using Avalonia.Controls; using Avalonia.Controls.Notifications; using Avalonia.Controls.Primitives; -using Avalonia.Media; -using Avalonia.Styling; using AvaloniaEdit; -using ReactiveUI; -using ReactiveUI.Fody.Helpers; using Semi.Avalonia; namespace v2rayN.Desktop.ViewModels; diff --git a/v2rayN/v2rayN.Desktop/Views/AddGroupServerWindow.axaml.cs b/v2rayN/v2rayN.Desktop/Views/AddGroupServerWindow.axaml.cs index 2acaee55..0430a57c 100644 --- a/v2rayN/v2rayN.Desktop/Views/AddGroupServerWindow.axaml.cs +++ b/v2rayN/v2rayN.Desktop/Views/AddGroupServerWindow.axaml.cs @@ -1,9 +1,3 @@ -using System.Reactive.Disposables; -using Avalonia.Controls; -using Avalonia.Input; -using Avalonia.Interactivity; -using DynamicData; -using ReactiveUI; using v2rayN.Desktop.Base; namespace v2rayN.Desktop.Views; diff --git a/v2rayN/v2rayN.Desktop/Views/AddServer2Window.axaml.cs b/v2rayN/v2rayN.Desktop/Views/AddServer2Window.axaml.cs index 4d378bf9..2e6731b7 100644 --- a/v2rayN/v2rayN.Desktop/Views/AddServer2Window.axaml.cs +++ b/v2rayN/v2rayN.Desktop/Views/AddServer2Window.axaml.cs @@ -1,6 +1,3 @@ -using System.Reactive.Disposables; -using Avalonia.Interactivity; -using ReactiveUI; using v2rayN.Desktop.Base; using v2rayN.Desktop.Common; diff --git a/v2rayN/v2rayN.Desktop/Views/AddServerWindow.axaml.cs b/v2rayN/v2rayN.Desktop/Views/AddServerWindow.axaml.cs index a42ab387..255ace75 100644 --- a/v2rayN/v2rayN.Desktop/Views/AddServerWindow.axaml.cs +++ b/v2rayN/v2rayN.Desktop/Views/AddServerWindow.axaml.cs @@ -1,7 +1,3 @@ -using System.Reactive.Disposables; -using Avalonia.Controls; -using Avalonia.Interactivity; -using ReactiveUI; using v2rayN.Desktop.Base; namespace v2rayN.Desktop.Views; diff --git a/v2rayN/v2rayN.Desktop/Views/BackupAndRestoreView.axaml.cs b/v2rayN/v2rayN.Desktop/Views/BackupAndRestoreView.axaml.cs index 60a777ad..391f2892 100644 --- a/v2rayN/v2rayN.Desktop/Views/BackupAndRestoreView.axaml.cs +++ b/v2rayN/v2rayN.Desktop/Views/BackupAndRestoreView.axaml.cs @@ -1,8 +1,3 @@ -using System.Reactive.Disposables; -using Avalonia.Controls; -using Avalonia.Interactivity; -using Avalonia.ReactiveUI; -using ReactiveUI; using v2rayN.Desktop.Common; namespace v2rayN.Desktop.Views; diff --git a/v2rayN/v2rayN.Desktop/Views/CheckUpdateView.axaml.cs b/v2rayN/v2rayN.Desktop/Views/CheckUpdateView.axaml.cs index 9567c1fd..a994235c 100644 --- a/v2rayN/v2rayN.Desktop/Views/CheckUpdateView.axaml.cs +++ b/v2rayN/v2rayN.Desktop/Views/CheckUpdateView.axaml.cs @@ -1,7 +1,3 @@ -using System.Reactive.Disposables; -using Avalonia.ReactiveUI; -using ReactiveUI; - namespace v2rayN.Desktop.Views; public partial class CheckUpdateView : ReactiveUserControl diff --git a/v2rayN/v2rayN.Desktop/Views/ClashConnectionsView.axaml.cs b/v2rayN/v2rayN.Desktop/Views/ClashConnectionsView.axaml.cs index 76a0fd1d..1c39df72 100644 --- a/v2rayN/v2rayN.Desktop/Views/ClashConnectionsView.axaml.cs +++ b/v2rayN/v2rayN.Desktop/Views/ClashConnectionsView.axaml.cs @@ -1,9 +1,3 @@ -using System.Reactive.Disposables; -using Avalonia.Controls; -using Avalonia.Interactivity; -using Avalonia.ReactiveUI; -using ReactiveUI; - namespace v2rayN.Desktop.Views; public partial class ClashConnectionsView : ReactiveUserControl diff --git a/v2rayN/v2rayN.Desktop/Views/ClashProxiesView.axaml.cs b/v2rayN/v2rayN.Desktop/Views/ClashProxiesView.axaml.cs index c8e7aeba..9a86846b 100644 --- a/v2rayN/v2rayN.Desktop/Views/ClashProxiesView.axaml.cs +++ b/v2rayN/v2rayN.Desktop/Views/ClashProxiesView.axaml.cs @@ -1,9 +1,3 @@ -using System.Reactive.Disposables; -using Avalonia.Input; -using Avalonia.ReactiveUI; -using DynamicData; -using ReactiveUI; - namespace v2rayN.Desktop.Views; public partial class ClashProxiesView : ReactiveUserControl diff --git a/v2rayN/v2rayN.Desktop/Views/DNSSettingWindow.axaml.cs b/v2rayN/v2rayN.Desktop/Views/DNSSettingWindow.axaml.cs index 2a472e30..71c3999c 100644 --- a/v2rayN/v2rayN.Desktop/Views/DNSSettingWindow.axaml.cs +++ b/v2rayN/v2rayN.Desktop/Views/DNSSettingWindow.axaml.cs @@ -1,8 +1,3 @@ -using System.Reactive.Disposables; -using System.Reactive.Linq; -using Avalonia.Controls; -using Avalonia.Interactivity; -using ReactiveUI; using v2rayN.Desktop.Base; namespace v2rayN.Desktop.Views; diff --git a/v2rayN/v2rayN.Desktop/Views/FullConfigTemplateWindow.axaml.cs b/v2rayN/v2rayN.Desktop/Views/FullConfigTemplateWindow.axaml.cs index 97bc4afb..1a8d5061 100644 --- a/v2rayN/v2rayN.Desktop/Views/FullConfigTemplateWindow.axaml.cs +++ b/v2rayN/v2rayN.Desktop/Views/FullConfigTemplateWindow.axaml.cs @@ -1,6 +1,3 @@ -using System.Reactive.Disposables; -using Avalonia.Interactivity; -using ReactiveUI; using v2rayN.Desktop.Base; namespace v2rayN.Desktop.Views; diff --git a/v2rayN/v2rayN.Desktop/Views/GlobalHotkeySettingWindow.axaml.cs b/v2rayN/v2rayN.Desktop/Views/GlobalHotkeySettingWindow.axaml.cs index 18ee0f1b..9b332695 100644 --- a/v2rayN/v2rayN.Desktop/Views/GlobalHotkeySettingWindow.axaml.cs +++ b/v2rayN/v2rayN.Desktop/Views/GlobalHotkeySettingWindow.axaml.cs @@ -1,9 +1,3 @@ -using System.Reactive.Disposables; -using System.Text; -using Avalonia.Controls; -using Avalonia.Input; -using Avalonia.Interactivity; -using ReactiveUI; using v2rayN.Desktop.Base; using v2rayN.Desktop.Manager; diff --git a/v2rayN/v2rayN.Desktop/Views/MainWindow.axaml.cs b/v2rayN/v2rayN.Desktop/Views/MainWindow.axaml.cs index 0fa30a52..c3bba363 100644 --- a/v2rayN/v2rayN.Desktop/Views/MainWindow.axaml.cs +++ b/v2rayN/v2rayN.Desktop/Views/MainWindow.axaml.cs @@ -1,15 +1,5 @@ -using System.Reactive.Disposables; -using System.Reactive.Linq; -using Avalonia; -using Avalonia.Controls; -using Avalonia.Controls.ApplicationLifetimes; using Avalonia.Controls.Notifications; -using Avalonia.Input; -using Avalonia.Interactivity; -using Avalonia.Threading; using DialogHostAvalonia; -using MsBox.Avalonia.Enums; -using ReactiveUI; using v2rayN.Desktop.Base; using v2rayN.Desktop.Common; using v2rayN.Desktop.Manager; diff --git a/v2rayN/v2rayN.Desktop/Views/MsgView.axaml.cs b/v2rayN/v2rayN.Desktop/Views/MsgView.axaml.cs index 1f7665ca..cc9bf464 100644 --- a/v2rayN/v2rayN.Desktop/Views/MsgView.axaml.cs +++ b/v2rayN/v2rayN.Desktop/Views/MsgView.axaml.cs @@ -1,9 +1,3 @@ -using System.Reactive.Disposables; -using Avalonia.Interactivity; -using Avalonia.Media; -using Avalonia.ReactiveUI; -using Avalonia.Threading; -using ReactiveUI; using v2rayN.Desktop.Common; namespace v2rayN.Desktop.Views; diff --git a/v2rayN/v2rayN.Desktop/Views/OptionSettingWindow.axaml.cs b/v2rayN/v2rayN.Desktop/Views/OptionSettingWindow.axaml.cs index edcbef0b..3913b54c 100644 --- a/v2rayN/v2rayN.Desktop/Views/OptionSettingWindow.axaml.cs +++ b/v2rayN/v2rayN.Desktop/Views/OptionSettingWindow.axaml.cs @@ -1,7 +1,3 @@ -using System.Reactive.Disposables; -using Avalonia.Controls; -using Avalonia.Interactivity; -using ReactiveUI; using v2rayN.Desktop.Base; namespace v2rayN.Desktop.Views; diff --git a/v2rayN/v2rayN.Desktop/Views/ProfilesSelectWindow.axaml.cs b/v2rayN/v2rayN.Desktop/Views/ProfilesSelectWindow.axaml.cs index ac562758..b71b61b0 100644 --- a/v2rayN/v2rayN.Desktop/Views/ProfilesSelectWindow.axaml.cs +++ b/v2rayN/v2rayN.Desktop/Views/ProfilesSelectWindow.axaml.cs @@ -1,10 +1,4 @@ -using System.Reactive.Disposables; -using Avalonia; -using Avalonia.Controls; -using Avalonia.Input; -using Avalonia.Interactivity; using Avalonia.VisualTree; -using ReactiveUI; using v2rayN.Desktop.Base; namespace v2rayN.Desktop.Views; diff --git a/v2rayN/v2rayN.Desktop/Views/ProfilesView.axaml.cs b/v2rayN/v2rayN.Desktop/Views/ProfilesView.axaml.cs index c6c16c86..09d0952c 100644 --- a/v2rayN/v2rayN.Desktop/Views/ProfilesView.axaml.cs +++ b/v2rayN/v2rayN.Desktop/Views/ProfilesView.axaml.cs @@ -1,13 +1,4 @@ -using System.Reactive.Disposables; -using System.Reactive.Linq; -using Avalonia.Controls; -using Avalonia.Input; -using Avalonia.Interactivity; -using Avalonia.ReactiveUI; -using Avalonia.Threading; using DialogHostAvalonia; -using MsBox.Avalonia.Enums; -using ReactiveUI; using v2rayN.Desktop.Common; namespace v2rayN.Desktop.Views; diff --git a/v2rayN/v2rayN.Desktop/Views/QrcodeView.axaml.cs b/v2rayN/v2rayN.Desktop/Views/QrcodeView.axaml.cs index 05d2dd83..3f1e7149 100644 --- a/v2rayN/v2rayN.Desktop/Views/QrcodeView.axaml.cs +++ b/v2rayN/v2rayN.Desktop/Views/QrcodeView.axaml.cs @@ -1,7 +1,3 @@ -using Avalonia.Controls; -using Avalonia.Media.Imaging; -using Avalonia.Threading; - namespace v2rayN.Desktop.Views; public partial class QrcodeView : UserControl diff --git a/v2rayN/v2rayN.Desktop/Views/RoutingRuleDetailsWindow.axaml.cs b/v2rayN/v2rayN.Desktop/Views/RoutingRuleDetailsWindow.axaml.cs index eb947b11..6c3f663d 100644 --- a/v2rayN/v2rayN.Desktop/Views/RoutingRuleDetailsWindow.axaml.cs +++ b/v2rayN/v2rayN.Desktop/Views/RoutingRuleDetailsWindow.axaml.cs @@ -1,7 +1,3 @@ -using System.Reactive.Disposables; -using Avalonia.Controls; -using Avalonia.Interactivity; -using ReactiveUI; using v2rayN.Desktop.Base; namespace v2rayN.Desktop.Views; diff --git a/v2rayN/v2rayN.Desktop/Views/RoutingRuleSettingWindow.axaml.cs b/v2rayN/v2rayN.Desktop/Views/RoutingRuleSettingWindow.axaml.cs index 78ec8833..80a13d5a 100644 --- a/v2rayN/v2rayN.Desktop/Views/RoutingRuleSettingWindow.axaml.cs +++ b/v2rayN/v2rayN.Desktop/Views/RoutingRuleSettingWindow.axaml.cs @@ -1,9 +1,3 @@ -using System.Reactive.Disposables; -using Avalonia.Controls; -using Avalonia.Input; -using Avalonia.Interactivity; -using MsBox.Avalonia.Enums; -using ReactiveUI; using v2rayN.Desktop.Base; using v2rayN.Desktop.Common; diff --git a/v2rayN/v2rayN.Desktop/Views/RoutingSettingWindow.axaml.cs b/v2rayN/v2rayN.Desktop/Views/RoutingSettingWindow.axaml.cs index 50a79d18..582bdeee 100644 --- a/v2rayN/v2rayN.Desktop/Views/RoutingSettingWindow.axaml.cs +++ b/v2rayN/v2rayN.Desktop/Views/RoutingSettingWindow.axaml.cs @@ -1,9 +1,3 @@ -using System.Reactive.Disposables; -using Avalonia.Controls; -using Avalonia.Input; -using Avalonia.Interactivity; -using MsBox.Avalonia.Enums; -using ReactiveUI; using v2rayN.Desktop.Base; using v2rayN.Desktop.Common; diff --git a/v2rayN/v2rayN.Desktop/Views/StatusBarView.axaml.cs b/v2rayN/v2rayN.Desktop/Views/StatusBarView.axaml.cs index f59eccb1..e5ab59c9 100644 --- a/v2rayN/v2rayN.Desktop/Views/StatusBarView.axaml.cs +++ b/v2rayN/v2rayN.Desktop/Views/StatusBarView.axaml.cs @@ -1,11 +1,4 @@ -using System.Reactive.Disposables; -using Avalonia; -using Avalonia.Controls; -using Avalonia.Controls.ApplicationLifetimes; -using Avalonia.ReactiveUI; -using Avalonia.Threading; using DialogHostAvalonia; -using ReactiveUI; using v2rayN.Desktop.Common; namespace v2rayN.Desktop.Views; diff --git a/v2rayN/v2rayN.Desktop/Views/SubEditWindow.axaml.cs b/v2rayN/v2rayN.Desktop/Views/SubEditWindow.axaml.cs index e07540b2..a25dcd28 100644 --- a/v2rayN/v2rayN.Desktop/Views/SubEditWindow.axaml.cs +++ b/v2rayN/v2rayN.Desktop/Views/SubEditWindow.axaml.cs @@ -1,7 +1,3 @@ -using System.Reactive.Disposables; -using Avalonia; -using Avalonia.Interactivity; -using ReactiveUI; using v2rayN.Desktop.Base; namespace v2rayN.Desktop.Views; diff --git a/v2rayN/v2rayN.Desktop/Views/SubSettingWindow.axaml.cs b/v2rayN/v2rayN.Desktop/Views/SubSettingWindow.axaml.cs index d563aeb1..cf0f5d75 100644 --- a/v2rayN/v2rayN.Desktop/Views/SubSettingWindow.axaml.cs +++ b/v2rayN/v2rayN.Desktop/Views/SubSettingWindow.axaml.cs @@ -1,11 +1,4 @@ -using System.Reactive.Disposables; -using Avalonia.Controls; -using Avalonia.Input; -using Avalonia.Interactivity; using DialogHostAvalonia; -using DynamicData; -using MsBox.Avalonia.Enums; -using ReactiveUI; using v2rayN.Desktop.Base; using v2rayN.Desktop.Common; diff --git a/v2rayN/v2rayN.Desktop/Views/SudoPasswordInputView.axaml.cs b/v2rayN/v2rayN.Desktop/Views/SudoPasswordInputView.axaml.cs index a87d0deb..cb5182eb 100644 --- a/v2rayN/v2rayN.Desktop/Views/SudoPasswordInputView.axaml.cs +++ b/v2rayN/v2rayN.Desktop/Views/SudoPasswordInputView.axaml.cs @@ -1,5 +1,3 @@ -using Avalonia.Controls; -using Avalonia.Threading; using CliWrap.Buffered; using DialogHostAvalonia; diff --git a/v2rayN/v2rayN.Desktop/Views/ThemeSettingView.axaml.cs b/v2rayN/v2rayN.Desktop/Views/ThemeSettingView.axaml.cs index b1f16b7e..68bde409 100644 --- a/v2rayN/v2rayN.Desktop/Views/ThemeSettingView.axaml.cs +++ b/v2rayN/v2rayN.Desktop/Views/ThemeSettingView.axaml.cs @@ -1,7 +1,3 @@ -using System.Reactive.Disposables; -using Avalonia; -using Avalonia.ReactiveUI; -using ReactiveUI; using v2rayN.Desktop.ViewModels; namespace v2rayN.Desktop.Views; From 479bf8e0373be575ffe50b16f968f10c0a59c761 Mon Sep 17 00:00:00 2001 From: 2dust <31833384+2dust@users.noreply.github.com> Date: Sun, 19 Oct 2025 16:55:21 +0800 Subject: [PATCH 05/21] Adjusted the items in the configuration right-click menu --- v2rayN/v2rayN.Desktop/Views/MainWindow.axaml | 38 ++-------- .../v2rayN.Desktop/Views/ProfilesView.axaml | 25 +++--- v2rayN/v2rayN/Views/MainWindow.xaml | 16 ++-- v2rayN/v2rayN/Views/ProfilesView.xaml | 76 +++++++++---------- 4 files changed, 65 insertions(+), 90 deletions(-) diff --git a/v2rayN/v2rayN.Desktop/Views/MainWindow.axaml b/v2rayN/v2rayN.Desktop/Views/MainWindow.axaml index b66a98a4..e02d0ba5 100644 --- a/v2rayN/v2rayN.Desktop/Views/MainWindow.axaml +++ b/v2rayN/v2rayN.Desktop/Views/MainWindow.axaml @@ -25,7 +25,7 @@ - + @@ -51,7 +51,7 @@ - + @@ -65,7 +65,7 @@ - + @@ -90,39 +90,15 @@ - - - - - - - + - - - - - - - + - - - - - - - + - - - - - - - + diff --git a/v2rayN/v2rayN.Desktop/Views/ProfilesView.axaml b/v2rayN/v2rayN.Desktop/Views/ProfilesView.axaml index 89bcbb28..a0f5af1b 100644 --- a/v2rayN/v2rayN.Desktop/Views/ProfilesView.axaml +++ b/v2rayN/v2rayN.Desktop/Views/ProfilesView.axaml @@ -92,22 +92,11 @@ - + + - - - - - - - - - - - - @@ -140,12 +129,22 @@ + + + + + + + + + + diff --git a/v2rayN/v2rayN/Views/MainWindow.xaml b/v2rayN/v2rayN/Views/MainWindow.xaml index 83d267e7..908eb710 100644 --- a/v2rayN/v2rayN/Views/MainWindow.xaml +++ b/v2rayN/v2rayN/Views/MainWindow.xaml @@ -45,7 +45,7 @@ KeyboardNavigation.TabNavigation="Continue" Style="{StaticResource MaterialDesignToolBar}"> - + - + - + @@ -249,7 +249,7 @@ @@ -266,7 +266,7 @@ @@ -283,7 +283,7 @@ @@ -300,7 +300,7 @@ diff --git a/v2rayN/v2rayN/Views/ProfilesView.xaml b/v2rayN/v2rayN/Views/ProfilesView.xaml index e81ee068..495dfb1b 100644 --- a/v2rayN/v2rayN/Views/ProfilesView.xaml +++ b/v2rayN/v2rayN/Views/ProfilesView.xaml @@ -100,14 +100,18 @@ + + Header="{x:Static resx:ResUI.menuCopyServer}" /> - - - - - - - - - - - - + + + + + + + + + + + From bca030002f9f12acab46da79051e5930f6e68d0a Mon Sep 17 00:00:00 2001 From: 2dust <31833384+2dust@users.noreply.github.com> Date: Sun, 19 Oct 2025 19:43:31 +0800 Subject: [PATCH 06/21] Adjust some texts in Simplified Chinese. Please wait for other languages. --- v2rayN/ServiceLib/Resx/ResUI.zh-Hans.resx | 128 +++++++++++----------- 1 file changed, 64 insertions(+), 64 deletions(-) diff --git a/v2rayN/ServiceLib/Resx/ResUI.zh-Hans.resx b/v2rayN/ServiceLib/Resx/ResUI.zh-Hans.resx index f1f49548..5666a55a 100644 --- a/v2rayN/ServiceLib/Resx/ResUI.zh-Hans.resx +++ b/v2rayN/ServiceLib/Resx/ResUI.zh-Hans.resx @@ -121,7 +121,7 @@ 导出分享链接至剪贴板成功 - 请先检查配置文件设置 + 请先检查设置 配置格式不正确 @@ -133,7 +133,7 @@ 下载开始... - 转换配置文件失败 + 转换配置失败 生成默认配置文件失败 @@ -142,10 +142,10 @@ 获取默认配置失败 - 导入自定义配置文件失败 + 导入自定义配置失败 - 读取配置文件失败 + 读取配置失败 请填写正确格式的端口 @@ -265,13 +265,13 @@ 请选择协议 - 请先选择配置文件 + 请先选择配置 - 配置文件去重完成。原数量: {0},现数量: {1}。 + 配置去重完成。原数量: {0},现数量: {1}。 - 是否确定移除配置文件? + 是否确定移除? 客户端配置文件保存在:{0} @@ -283,10 +283,10 @@ 配置成功。 {0} - 成功导入自定义配置文件 + 成功导入自定义配置 - 成功从剪贴板导入 {0} 个配置文件 + 成功从剪贴板导入 {0} 个配置 扫描导入分享链接成功 @@ -385,7 +385,7 @@ 所有 - 请浏览导入配置文件配置 + 请浏览导入配置 测试中... @@ -397,7 +397,7 @@ 本地 - 配置文件过滤器,按回车执行 + 过滤器,按回车执行 检查更新 @@ -478,55 +478,55 @@ 扫描屏幕上的二维码 (Ctrl+S) - 克隆所选配置文件 + 克隆所选 - 移除重复的配置文件 + 移除重复 - 移除所选配置文件 (多选) (Delete) + 移除所选 (多选) (Delete) - 设为活动配置文件 (Enter) + 设为活动 (Enter) 清除所有服务统计数据 - 测试配置文件真连接延迟 (多选) (Ctrl+R) + 测试真连接延迟 (多选) (Ctrl+R) 按测试结果排序 - 测试配置文件速度 (多选) (Ctrl+T) + 测试速度 (多选) (Ctrl+T) - 测试配置文件延迟 Tcping (多选) (Ctrl+O) + 测试延迟 Tcping (多选) (Ctrl+O) - 导出所选配置文件完整配置 + 导出所选完整配置 导出分享链接至剪贴板 (多选) (Ctrl+C) - 添加自定义配置文件 + 添加自定义配置 - 添加 [Shadowsocks] 配置文件 + 添加 [Shadowsocks] - 添加 [SOCKS] 配置文件 + 添加 [SOCKS] - 添加 [Trojan] 配置文件 + 添加 [Trojan] - 添加 [VLESS] 配置文件 + 添加 [VLESS] - 添加 [VMess] 配置文件 + 添加 [VMess] 全选 (Ctrl+A) @@ -691,7 +691,7 @@ Outbound Freedom domainStrategy - 自动调整配置文件列宽在更新订阅后 + 自动调整配置列宽在更新订阅后 检查 Pre-Release 更新 (请谨慎启用) @@ -700,7 +700,7 @@ 例外 - 例外:对于下列字符开头的地址,不使用代理配置文件。使用分号 (;) 分隔。 + 例外:对于下列字符开头的地址,不使用代理配置。使用分号 (;) 分隔。 显示实时速度 (需重启) @@ -751,7 +751,7 @@ 启用安全协议 TLS v1.3 (订阅/检查更新) - 托盘右键菜单配置文件展示数量限制 + 托盘右键菜单配置展示数量限制 开启 UDP @@ -784,7 +784,7 @@ Pac 模式 - 分享配置文件 (Ctrl+F) + 分享 (Ctrl+F) 路由 @@ -916,7 +916,7 @@ 移至订阅分组 - 启用配置文件拖放排序 (需重启) + 启用配置拖放排序 (需重启) 自动刷新 @@ -925,10 +925,10 @@ 跳过测试 - 编辑配置文件 (Ctrl+D) + 编辑 (Ctrl+D) - 主界面双击设为活动配置文件 + 主界面双击设为活动 测试完成 @@ -1033,7 +1033,7 @@ Domain - 添加 [Hysteria2] 配置文件 + 添加 [Hysteria2] Hysteria 最大带宽 (Up/Dw) @@ -1042,19 +1042,19 @@ 使用系统 hosts - 添加 [TUIC] 配置文件 + 添加 [TUIC] 拥塞控制算法 - 前置代理配置文件别名 + 前置代理配置别名 - 落地代理配置文件別名 + 落地代理配置別名 - 请确保配置文件别名存在并唯一 + 请确保配置别名存在并唯一 自动路由 @@ -1075,7 +1075,7 @@ 启用 IPv6 - 添加 [WireGuard] 配置文件 + 添加 [WireGuard] PrivateKey @@ -1108,7 +1108,7 @@ *grpc Authority - 添加 [HTTP] 配置文件 + 添加 [HTTP] 和分组前置代理冲突 @@ -1198,13 +1198,13 @@ 延迟测试 - 当前部分节点延迟测试 + 当前部分延迟测试 刷新 - 设为活动节点 (Enter) + 设为活动 (Enter) Outbound 默认解析策略 @@ -1222,7 +1222,7 @@ 导出分享链接至剪贴板 (多选) Base64 编码 - 导出所选配置文件完整配置至剪贴板 + 导出所选完整配置至剪贴板 显示或隐藏主界面 @@ -1339,7 +1339,7 @@ 多线程测试时的并发数量 - 例外:对于下列地址不使用代理配置文件。使用逗号 (,) 分隔。 + 例外:对于下列地址不使用代理配置。使用逗号 (,) 分隔。 流量探测类型 @@ -1375,31 +1375,31 @@ 会覆盖端口,多组时用逗号 (,) 隔开 - 多配置文件生成策略组 + 多选生成策略组 - 多配置文件随机 Xray + 多选随机 Xray - 多配置文件负载均衡 Xray + 多选负载均衡 Xray - 多配置文件最低延迟 Xray + 多选最低延迟 Xray - 多配置文件最稳定 Xray + 多选最稳定 Xray - 多配置文件最低延迟 sing-box + 多选最低延迟 sing-box - 导出配置文件 + 导出 当前连接信息测试地址 - 可以填写配置文件别名,请确保存在并唯一 + 可以填写配置别名,请确保存在并唯一 密码错误,请重试。 @@ -1408,7 +1408,7 @@ Mldsa65Verify - 添加 [Anytls] 配置文件 + 添加 [Anytls] 远程 DNS @@ -1495,13 +1495,13 @@ 开始解析和处理订阅内容 - 选择配置文件 + 选择配置 默认全局生效,内置 FakeIP 过滤,仅在 sing-box 中生效 - 请至少添加一个配置文件 + 请至少添加一个配置 策略组 @@ -1525,28 +1525,28 @@ 策略组类型 - 添加策略组配置文件 + 添加策略组 - 添加链式代理配置文件 + 添加链式代理 - 添加子配置文件 + 添加子项 - 删除子配置文件 + 删除子项 - 服务器列表 + 子项列表 故障转移 - 多配置文件故障转移 sing-box + 多选故障转移 sing-box - 多配置文件故障转移 Xray + 多选故障转移 Xray 核心 '{0}' 不支持网络类型 '{1}'。 @@ -1567,10 +1567,10 @@ 策略组: - 节点别名 '{0}' 不存在。 + 别名 '{0}' 不存在。 - 组“{0}”为空。请至少添加一个节点。 + 组“{0}”为空。请至少添加一个配置。 {0}属性无效,请检查 @@ -1590,4 +1590,4 @@ 可对 Routing 和 DNS 单独设定规则,ALL 则都生效 - \ No newline at end of file + From 20260412a7b258b15d540e045595e77acd279b39 Mon Sep 17 00:00:00 2001 From: 2dust <31833384+2dust@users.noreply.github.com> Date: Mon, 20 Oct 2025 20:17:13 +0800 Subject: [PATCH 07/21] Remove Enable Security Protocol TLS v1.3 (subscription/update) The TLS version is automatically negotiated by the operating system stack; by default it selects the highest version supported by both endpoints. --- v2rayN/ServiceLib/Models/ConfigItems.cs | 1 - v2rayN/ServiceLib/Resx/ResUI.Designer.cs | 9 --------- v2rayN/ServiceLib/Resx/ResUI.fa-Ir.resx | 3 --- v2rayN/ServiceLib/Resx/ResUI.hu.resx | 3 --- v2rayN/ServiceLib/Resx/ResUI.resx | 3 --- v2rayN/ServiceLib/Resx/ResUI.ru.resx | 3 --- v2rayN/ServiceLib/Resx/ResUI.zh-Hans.resx | 5 +---- v2rayN/ServiceLib/Resx/ResUI.zh-Hant.resx | 3 --- v2rayN/ServiceLib/Services/DownloadService.cs | 20 ------------------- .../ViewModels/OptionSettingViewModel.cs | 3 --- .../Views/OptionSettingWindow.axaml | 13 ------------ .../Views/OptionSettingWindow.axaml.cs | 1 - v2rayN/v2rayN/Views/OptionSettingWindow.xaml | 14 ------------- .../v2rayN/Views/OptionSettingWindow.xaml.cs | 1 - 14 files changed, 1 insertion(+), 81 deletions(-) diff --git a/v2rayN/ServiceLib/Models/ConfigItems.cs b/v2rayN/ServiceLib/Models/ConfigItems.cs index 3a7a7b97..985c3a88 100644 --- a/v2rayN/ServiceLib/Models/ConfigItems.cs +++ b/v2rayN/ServiceLib/Models/ConfigItems.cs @@ -71,7 +71,6 @@ public class GUIItem public bool DisplayRealTimeSpeed { get; set; } public bool KeepOlderDedupl { get; set; } public int AutoUpdateInterval { get; set; } - public bool EnableSecurityProtocolTls13 { get; set; } public int TrayMenuServersLimit { get; set; } = 20; public bool EnableHWA { get; set; } = false; public bool EnableLog { get; set; } = true; diff --git a/v2rayN/ServiceLib/Resx/ResUI.Designer.cs b/v2rayN/ServiceLib/Resx/ResUI.Designer.cs index eb7dd406..5bf7eb6e 100644 --- a/v2rayN/ServiceLib/Resx/ResUI.Designer.cs +++ b/v2rayN/ServiceLib/Resx/ResUI.Designer.cs @@ -3966,15 +3966,6 @@ namespace ServiceLib.Resx { } } - /// - /// 查找类似 Enable Security Protocol TLS v1.3 (subscription/update) 的本地化字符串。 - /// - public static string TbSettingsTLS13 { - get { - return ResourceManager.GetString("TbSettingsTLS13", resourceCulture); - } - } - /// /// 查找类似 Tray right-click menu Configurations display limit 的本地化字符串。 /// diff --git a/v2rayN/ServiceLib/Resx/ResUI.fa-Ir.resx b/v2rayN/ServiceLib/Resx/ResUI.fa-Ir.resx index 9a864836..7bcf40f5 100644 --- a/v2rayN/ServiceLib/Resx/ResUI.fa-Ir.resx +++ b/v2rayN/ServiceLib/Resx/ResUI.fa-Ir.resx @@ -747,9 +747,6 @@ تنظیمات پراکسی سیستم - - فعال کردن پروتکل امنیتی TLS نسخه 1.3 (اشتراک/به‌روزرسانی) - محدودیت نمایش سرورهای منوی سینی کلیک راست diff --git a/v2rayN/ServiceLib/Resx/ResUI.hu.resx b/v2rayN/ServiceLib/Resx/ResUI.hu.resx index 0e920aa8..3ffa2e12 100644 --- a/v2rayN/ServiceLib/Resx/ResUI.hu.resx +++ b/v2rayN/ServiceLib/Resx/ResUI.hu.resx @@ -747,9 +747,6 @@ Rendszerproxy beállítások - - Biztonsági protokoll TLS v1.3 engedélyezése (előfizetés/frissítés) - Tálca jobb egérgombos menü konfigurációk megjelenítési limitje diff --git a/v2rayN/ServiceLib/Resx/ResUI.resx b/v2rayN/ServiceLib/Resx/ResUI.resx index 9fd73a15..5447e569 100644 --- a/v2rayN/ServiceLib/Resx/ResUI.resx +++ b/v2rayN/ServiceLib/Resx/ResUI.resx @@ -747,9 +747,6 @@ System proxy settings - - Enable Security Protocol TLS v1.3 (subscription/update) - Tray right-click menu Configurations display limit diff --git a/v2rayN/ServiceLib/Resx/ResUI.ru.resx b/v2rayN/ServiceLib/Resx/ResUI.ru.resx index 197afb51..72a63936 100644 --- a/v2rayN/ServiceLib/Resx/ResUI.ru.resx +++ b/v2rayN/ServiceLib/Resx/ResUI.ru.resx @@ -747,9 +747,6 @@ Настройки системного прокси - - Включить протокол безопасности TLS v1.3 (обновление подписки) - Лимит серверов в меню трея diff --git a/v2rayN/ServiceLib/Resx/ResUI.zh-Hans.resx b/v2rayN/ServiceLib/Resx/ResUI.zh-Hans.resx index 5666a55a..a6e297c3 100644 --- a/v2rayN/ServiceLib/Resx/ResUI.zh-Hans.resx +++ b/v2rayN/ServiceLib/Resx/ResUI.zh-Hans.resx @@ -747,9 +747,6 @@ 系统代理设置 - - 启用安全协议 TLS v1.3 (订阅/检查更新) - 托盘右键菜单配置展示数量限制 @@ -1590,4 +1587,4 @@ 可对 Routing 和 DNS 单独设定规则,ALL 则都生效 - + \ 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 2ab8dfbf..fe10f622 100644 --- a/v2rayN/ServiceLib/Resx/ResUI.zh-Hant.resx +++ b/v2rayN/ServiceLib/Resx/ResUI.zh-Hant.resx @@ -747,9 +747,6 @@ 系統代理設定 - - 啟用安全協定 TLS v1.3 (訂閱/檢查更新) - 工具列右鍵選單設定檔展示數量限制 diff --git a/v2rayN/ServiceLib/Services/DownloadService.cs b/v2rayN/ServiceLib/Services/DownloadService.cs index 4b2a7881..d4122964 100644 --- a/v2rayN/ServiceLib/Services/DownloadService.cs +++ b/v2rayN/ServiceLib/Services/DownloadService.cs @@ -17,8 +17,6 @@ public class DownloadService { try { - SetSecurityProtocol(AppManager.Instance.Config.GuiItem.EnableSecurityProtocolTls13); - var progress = new Progress(); progress.ProgressChanged += (sender, value) => updateFunc?.Invoke(false, $"{value}"); @@ -42,7 +40,6 @@ public class DownloadService { try { - SetSecurityProtocol(AppManager.Instance.Config.GuiItem.EnableSecurityProtocolTls13); UpdateCompleted?.Invoke(this, new RetResult(false, $"{ResUI.Downloading} {url}")); var progress = new Progress(); @@ -69,7 +66,6 @@ public class DownloadService public async Task UrlRedirectAsync(string url, bool blProxy) { - SetSecurityProtocol(AppManager.Instance.Config.GuiItem.EnableSecurityProtocolTls13); var webRequestHandler = new SocketsHttpHandler { AllowAutoRedirect = false, @@ -139,7 +135,6 @@ public class DownloadService { try { - SetSecurityProtocol(AppManager.Instance.Config.GuiItem.EnableSecurityProtocolTls13); var webProxy = await GetWebProxy(blProxy); var client = new HttpClient(new SocketsHttpHandler() { @@ -184,8 +179,6 @@ public class DownloadService { try { - SetSecurityProtocol(AppManager.Instance.Config.GuiItem.EnableSecurityProtocolTls13); - var webProxy = await GetWebProxy(blProxy); if (userAgent.IsNullOrEmpty()) @@ -236,17 +229,4 @@ public class DownloadService return false; } } - - private static void SetSecurityProtocol(bool enableSecurityProtocolTls13) - { - if (enableSecurityProtocolTls13) - { - ServicePointManager.SecurityProtocol |= SecurityProtocolType.Tls12 | SecurityProtocolType.Tls13; - } - else - { - ServicePointManager.SecurityProtocol |= SecurityProtocolType.Tls12; - } - ServicePointManager.DefaultConnectionLimit = 256; - } } diff --git a/v2rayN/ServiceLib/ViewModels/OptionSettingViewModel.cs b/v2rayN/ServiceLib/ViewModels/OptionSettingViewModel.cs index d2f334af..8bf21763 100644 --- a/v2rayN/ServiceLib/ViewModels/OptionSettingViewModel.cs +++ b/v2rayN/ServiceLib/ViewModels/OptionSettingViewModel.cs @@ -48,7 +48,6 @@ public class OptionSettingViewModel : MyReactiveObject [Reactive] public bool DisplayRealTimeSpeed { get; set; } [Reactive] public bool EnableAutoAdjustMainLvColWidth { get; set; } [Reactive] public bool EnableUpdateSubOnlyRemarksExist { get; set; } - [Reactive] public bool EnableSecurityProtocolTls13 { get; set; } [Reactive] public bool AutoHideStartup { get; set; } [Reactive] public bool Hide2TrayWhenClose { get; set; } [Reactive] public bool EnableDragDropSort { get; set; } @@ -166,7 +165,6 @@ public class OptionSettingViewModel : MyReactiveObject KeepOlderDedupl = _config.GuiItem.KeepOlderDedupl; EnableAutoAdjustMainLvColWidth = _config.UiItem.EnableAutoAdjustMainLvColWidth; EnableUpdateSubOnlyRemarksExist = _config.UiItem.EnableUpdateSubOnlyRemarksExist; - EnableSecurityProtocolTls13 = _config.GuiItem.EnableSecurityProtocolTls13; AutoHideStartup = _config.UiItem.AutoHideStartup; Hide2TrayWhenClose = _config.UiItem.Hide2TrayWhenClose; EnableDragDropSort = _config.UiItem.EnableDragDropSort; @@ -326,7 +324,6 @@ public class OptionSettingViewModel : MyReactiveObject _config.GuiItem.KeepOlderDedupl = KeepOlderDedupl; _config.UiItem.EnableAutoAdjustMainLvColWidth = EnableAutoAdjustMainLvColWidth; _config.UiItem.EnableUpdateSubOnlyRemarksExist = EnableUpdateSubOnlyRemarksExist; - _config.GuiItem.EnableSecurityProtocolTls13 = EnableSecurityProtocolTls13; _config.UiItem.AutoHideStartup = AutoHideStartup; _config.UiItem.Hide2TrayWhenClose = Hide2TrayWhenClose; _config.GuiItem.AutoUpdateInterval = AutoUpdateInterval; diff --git a/v2rayN/v2rayN.Desktop/Views/OptionSettingWindow.axaml b/v2rayN/v2rayN.Desktop/Views/OptionSettingWindow.axaml index e3d225d6..40faf34a 100644 --- a/v2rayN/v2rayN.Desktop/Views/OptionSettingWindow.axaml +++ b/v2rayN/v2rayN.Desktop/Views/OptionSettingWindow.axaml @@ -429,19 +429,6 @@ Margin="{StaticResource Margin4}" HorizontalAlignment="Left" /> - - - this.Bind(ViewModel, vm => vm.KeepOlderDedupl, v => v.togKeepOlderDedupl.IsChecked).DisposeWith(disposables); this.Bind(ViewModel, vm => vm.EnableAutoAdjustMainLvColWidth, v => v.togEnableAutoAdjustMainLvColWidth.IsChecked).DisposeWith(disposables); this.Bind(ViewModel, vm => vm.EnableUpdateSubOnlyRemarksExist, v => v.togEnableUpdateSubOnlyRemarksExist.IsChecked).DisposeWith(disposables); - this.Bind(ViewModel, vm => vm.EnableSecurityProtocolTls13, v => v.togEnableSecurityProtocolTls13.IsChecked).DisposeWith(disposables); this.Bind(ViewModel, vm => vm.AutoHideStartup, v => v.togAutoHideStartup.IsChecked).DisposeWith(disposables); this.Bind(ViewModel, vm => vm.Hide2TrayWhenClose, v => v.togHide2TrayWhenClose.IsChecked).DisposeWith(disposables); this.Bind(ViewModel, vm => vm.DoubleClick2Activate, v => v.togDoubleClick2Activate.IsChecked).DisposeWith(disposables); diff --git a/v2rayN/v2rayN/Views/OptionSettingWindow.xaml b/v2rayN/v2rayN/Views/OptionSettingWindow.xaml index 98b90235..129f1d09 100644 --- a/v2rayN/v2rayN/Views/OptionSettingWindow.xaml +++ b/v2rayN/v2rayN/Views/OptionSettingWindow.xaml @@ -651,20 +651,6 @@ Margin="{StaticResource Margin8}" HorizontalAlignment="Left" /> - - - vm.KeepOlderDedupl, v => v.togKeepOlderDedupl.IsChecked).DisposeWith(disposables); this.Bind(ViewModel, vm => vm.EnableAutoAdjustMainLvColWidth, v => v.togEnableAutoAdjustMainLvColWidth.IsChecked).DisposeWith(disposables); this.Bind(ViewModel, vm => vm.EnableUpdateSubOnlyRemarksExist, v => v.togEnableUpdateSubOnlyRemarksExist.IsChecked).DisposeWith(disposables); - this.Bind(ViewModel, vm => vm.EnableSecurityProtocolTls13, v => v.togEnableSecurityProtocolTls13.IsChecked).DisposeWith(disposables); this.Bind(ViewModel, vm => vm.AutoHideStartup, v => v.togAutoHideStartup.IsChecked).DisposeWith(disposables); this.Bind(ViewModel, vm => vm.EnableDragDropSort, v => v.togEnableDragDropSort.IsChecked).DisposeWith(disposables); this.Bind(ViewModel, vm => vm.DoubleClick2Activate, v => v.togDoubleClick2Activate.IsChecked).DisposeWith(disposables); From 91bca3a7aee898b64e9b49bb6b3f6c9b2efbe3d5 Mon Sep 17 00:00:00 2001 From: JieXu Date: Tue, 21 Oct 2025 09:29:52 +0800 Subject: [PATCH 08/21] Update Bug report (#8157) * Update package-rhel.sh * Update package-rhel.sh * Update 01_bug_report.yml * Fix formatting in bug report issue template * Update 01_bug_report.yml * Update 01_bug_report.yml * Update 01_bug_report.yml * Update 01_bug_report.yml * Update 01_bug_report.yml * Update 01_bug_report.yml * Update 01_bug_report.yml * Update 01_bug_report.yml * Update 01_bug_report.yml * Update 01_bug_report.yml * Update bug report template to remove checkmark Removed the checkmark from the bug report template. * Update 01_bug_report.yml * Update 01_bug_report.yml * Update bug report template header formatting * Update 01_bug_report.yml * Update 01_bug_report.yml * Fix placeholder text in bug report template * Update 01_bug_report.yml * Create config.yml for issue templates Add issue template configuration with contact links. * Update config.yml * Update config.yml * Update config.yml --- .github/ISSUE_TEMPLATE/01_bug_report.yml | 45 +++++++++++++++++++++--- .github/ISSUE_TEMPLATE/config.yml | 9 +++++ 2 files changed, 50 insertions(+), 4 deletions(-) create mode 100644 .github/ISSUE_TEMPLATE/config.yml diff --git a/.github/ISSUE_TEMPLATE/01_bug_report.yml b/.github/ISSUE_TEMPLATE/01_bug_report.yml index e96682bd..a9a4753e 100644 --- a/.github/ISSUE_TEMPLATE/01_bug_report.yml +++ b/.github/ISSUE_TEMPLATE/01_bug_report.yml @@ -3,6 +3,18 @@ description: 在提出问题前请先自行排除服务器端问题和升级到 title: "[Bug]: " labels: ["bug"] body: + - type: markdown + attributes: + value: | + ### 报告 Bug 前请务必确认以下事项: + > ** ** + > **✓ 已自行排除服务器端问题。** + > **✓ 已升级到最新客户端版本。** + > **✓ 已通过搜索确认没有人提出过相同问题。** + > **✓ 已确认自己的电脑系统环境是受支持的。** + + --- + - type: input id: "os-version" attributes: @@ -10,6 +22,7 @@ body: description: "操作系统和版本" validations: required: true + - type: input id: "expectation" attributes: @@ -17,6 +30,7 @@ body: description: "描述你认为应该发生什么" validations: required: true + - type: textarea id: "describe-the-bug" attributes: @@ -24,22 +38,34 @@ body: description: "描述实际发生了什么" validations: required: true + - type: textarea id: "reproduction-method" attributes: label: "复现方法" description: "在BUG出现前执行了哪些操作" - placeholder: 标序号 + placeholder: "标序号" validations: required: true + - type: textarea - id: "log" + id: "gui-log" attributes: - label: "日志信息" + label: "软件日志" description: "位置在软件当前目录下的guiLogs" - placeholder: 在日志开始和结束位置粘贴冒号后的内容:``` + placeholder: "在日志开始和结束位置粘贴冒号后的内容到这:" validations: required: true + + - type: textarea + id: "core-log" + attributes: + label: "内核日志" + description: "位置在软件主界面的信息框内" + placeholder: "在信息框内鼠标右键复制全部信息粘贴在这:" + validations: + required: true + - type: textarea id: "more" attributes: @@ -47,6 +73,7 @@ body: description: "可选" validations: required: false + - type: checkboxes id: "latest-version" attributes: @@ -55,6 +82,7 @@ body: options: - label: 是 required: true + - type: checkboxes id: "issues" attributes: @@ -63,3 +91,12 @@ body: options: - label: 是 required: true + + - type: checkboxes + id: "system-version" + attributes: + label: "我确认系统版本是受支持的" + description: "否则请切换后尝试" + options: + - label: 是 + required: true diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml new file mode 100644 index 00000000..8dc9c926 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -0,0 +1,9 @@ +blank_issues_enabled: false + +contact_links: + - name: Discussions / 讨论区 + url: https://github.com/2dust/v2rayN/discussions + about: 使用问题或需要帮助请前往 Discussions。 + - name: Wiki / 使用说明 + url: https://github.com/2dust/v2rayN/wiki + about: 查看常见问题和使用文档。 From 07e173eab1b01ddf9f1f4c543151d44664b911e6 Mon Sep 17 00:00:00 2001 From: DHR60 Date: Tue, 21 Oct 2025 17:28:48 +0800 Subject: [PATCH 09/21] Bootstrap DNS (#8160) Also fix the handling of IPv6 domains --- v2rayN/ServiceLib/Common/Utils.cs | 104 ++++++++++++++++++ v2rayN/ServiceLib/Handler/ConfigHandler.cs | 7 +- v2rayN/ServiceLib/Models/ConfigItems.cs | 1 + v2rayN/ServiceLib/Resx/ResUI.Designer.cs | 18 +++ v2rayN/ServiceLib/Resx/ResUI.fa-Ir.resx | 6 + v2rayN/ServiceLib/Resx/ResUI.hu.resx | 6 + v2rayN/ServiceLib/Resx/ResUI.resx | 6 + v2rayN/ServiceLib/Resx/ResUI.ru.resx | 6 + v2rayN/ServiceLib/Resx/ResUI.zh-Hans.resx | 6 + v2rayN/ServiceLib/Resx/ResUI.zh-Hant.resx | 6 + .../CoreConfig/Singbox/SingboxDnsService.cs | 81 +++----------- .../CoreConfig/V2ray/V2rayDnsService.cs | 33 ++++++ .../ViewModels/DNSSettingViewModel.cs | 3 + .../Views/DNSSettingWindow.axaml | 37 +++++-- .../Views/DNSSettingWindow.axaml.cs | 2 + v2rayN/v2rayN/Views/DNSSettingWindow.xaml | 38 +++++-- v2rayN/v2rayN/Views/DNSSettingWindow.xaml.cs | 2 + 17 files changed, 280 insertions(+), 82 deletions(-) diff --git a/v2rayN/ServiceLib/Common/Utils.cs b/v2rayN/ServiceLib/Common/Utils.cs index 8adf9d83..5ca96a88 100644 --- a/v2rayN/ServiceLib/Common/Utils.cs +++ b/v2rayN/ServiceLib/Common/Utils.cs @@ -355,6 +355,110 @@ public class Utils return userHostsMap; } + /// + /// Parse a possibly non-standard URL into scheme, domain, port, and path. + /// If parsing fails, the entire input is returned as domain, and others are empty or zero. + /// + /// Input URL or string + /// (domain, scheme, port, path) + public static (string domain, string scheme, int port, string path) ParseUrl(string url) + { + if (string.IsNullOrWhiteSpace(url)) + { + return ("", "", 0, ""); + } + + // 1. First, try to parse using the standard Uri class. + if (Uri.TryCreate(url, UriKind.Absolute, out var uri) && !string.IsNullOrEmpty(uri.Host)) + { + var scheme = uri.Scheme; + var domain = uri.Host; + var port = uri.IsDefaultPort ? 0 : uri.Port; + var path = uri.PathAndQuery; + return (domain, scheme, port, path); + } + + // 2. Try to handle more general cases with a regular expression, including non-standard schemes. + // This regex captures the scheme (optional), authority (host+port), and path (optional). + var match = Regex.Match(url, @"^(?:([a-zA-Z][a-zA-Z0-9+.-]*):/{2,})?([^/?#]+)([^?#]*)?.*$"); + + if (match.Success) + { + var scheme = match.Groups[1].Value; + var authority = match.Groups[2].Value; + var path = match.Groups[3].Value; + + // Remove userinfo from the authority part. + var atIndex = authority.LastIndexOf('@'); + if (atIndex > 0) + { + authority = authority.Substring(atIndex + 1); + } + + var (domain, port) = ParseAuthority(authority); + + // If the parsed domain is empty, it means the authority part is malformed, so trigger the fallback. + if (!string.IsNullOrEmpty(domain)) + { + return (domain, scheme, port, path); + } + } + + // 3. If all of the above fails, execute the final fallback strategy. + return (url, "", 0, ""); + } + + /// + /// Helper function to parse domain and port from the authority part, with correct handling for IPv6. + /// + private static (string domain, int port) ParseAuthority(string authority) + { + if (string.IsNullOrEmpty(authority)) + { + return ("", 0); + } + + var port = 0; + var domain = authority; + + // Handle IPv6 addresses, e.g., "[2001:db8::1]:443" + if (authority.StartsWith("[") && authority.Contains("]")) + { + int closingBracketIndex = authority.LastIndexOf(']'); + if (closingBracketIndex < authority.Length - 1 && authority[closingBracketIndex + 1] == ':') + { + // Port exists + var portStr = authority.Substring(closingBracketIndex + 2); + if (int.TryParse(portStr, out var portNum)) + { + port = portNum; + } + domain = authority.Substring(0, closingBracketIndex + 1); + } + else + { + // No port + domain = authority; + } + } + else // Handle IPv4 or domain names + { + var lastColonIndex = authority.LastIndexOf(':'); + // Ensure there are digits after the colon and that this colon is not part of an IPv6 address. + if (lastColonIndex > 0 && lastColonIndex < authority.Length - 1 && authority.Substring(lastColonIndex + 1).All(char.IsDigit)) + { + var portStr = authority.Substring(lastColonIndex + 1); + if (int.TryParse(portStr, out var portNum)) + { + port = portNum; + domain = authority.Substring(0, lastColonIndex); + } + } + } + + return (domain, port); + } + #endregion 转换函数 #region 数据检查 diff --git a/v2rayN/ServiceLib/Handler/ConfigHandler.cs b/v2rayN/ServiceLib/Handler/ConfigHandler.cs index fd93d8be..2840fab7 100644 --- a/v2rayN/ServiceLib/Handler/ConfigHandler.cs +++ b/v2rayN/ServiceLib/Handler/ConfigHandler.cs @@ -112,10 +112,8 @@ public static class ConfigHandler config.ConstItem ??= new ConstItem(); config.SimpleDNSItem ??= InitBuiltinSimpleDNS(); - if (config.SimpleDNSItem.GlobalFakeIp is null) - { - config.SimpleDNSItem.GlobalFakeIp = true; - } + config.SimpleDNSItem.GlobalFakeIp ??= true; + config.SimpleDNSItem.BootstrapDNS ??= Global.DomainPureIPDNSAddress.FirstOrDefault(); config.SpeedTestItem ??= new(); if (config.SpeedTestItem.SpeedTestTimeout < 10) @@ -2273,6 +2271,7 @@ public static class ConfigHandler BlockBindingQuery = true, DirectDNS = Global.DomainDirectDNSAddress.FirstOrDefault(), RemoteDNS = Global.DomainRemoteDNSAddress.FirstOrDefault(), + BootstrapDNS = Global.DomainPureIPDNSAddress.FirstOrDefault(), }; } diff --git a/v2rayN/ServiceLib/Models/ConfigItems.cs b/v2rayN/ServiceLib/Models/ConfigItems.cs index 985c3a88..531a99f4 100644 --- a/v2rayN/ServiceLib/Models/ConfigItems.cs +++ b/v2rayN/ServiceLib/Models/ConfigItems.cs @@ -263,6 +263,7 @@ public class SimpleDNSItem public bool? BlockBindingQuery { get; set; } public string? DirectDNS { get; set; } public string? RemoteDNS { get; set; } + public string? BootstrapDNS { get; set; } public string? RayStrategy4Freedom { get; set; } public string? SingboxStrategy4Direct { get; set; } public string? SingboxStrategy4Proxy { get; set; } diff --git a/v2rayN/ServiceLib/Resx/ResUI.Designer.cs b/v2rayN/ServiceLib/Resx/ResUI.Designer.cs index 5bf7eb6e..3b12a5ee 100644 --- a/v2rayN/ServiceLib/Resx/ResUI.Designer.cs +++ b/v2rayN/ServiceLib/Resx/ResUI.Designer.cs @@ -2517,6 +2517,24 @@ namespace ServiceLib.Resx { } } + /// + /// 查找类似 Bootstrap DNS 的本地化字符串。 + /// + public static string TbBootstrapDNS { + get { + return ResourceManager.GetString("TbBootstrapDNS", resourceCulture); + } + } + + /// + /// 查找类似 Resolve DNS server domains, requires IP 的本地化字符串。 + /// + public static string TbBootstrapDNSTips { + get { + return ResourceManager.GetString("TbBootstrapDNSTips", resourceCulture); + } + } + /// /// 查找类似 Browse 的本地化字符串。 /// diff --git a/v2rayN/ServiceLib/Resx/ResUI.fa-Ir.resx b/v2rayN/ServiceLib/Resx/ResUI.fa-Ir.resx index 7bcf40f5..02235c2d 100644 --- a/v2rayN/ServiceLib/Resx/ResUI.fa-Ir.resx +++ b/v2rayN/ServiceLib/Resx/ResUI.fa-Ir.resx @@ -1590,4 +1590,10 @@ You can set separate rules for Routing and DNS, or select "ALL" to apply to both + + Bootstrap DNS + + + Resolve DNS server domains, requires IP + \ No newline at end of file diff --git a/v2rayN/ServiceLib/Resx/ResUI.hu.resx b/v2rayN/ServiceLib/Resx/ResUI.hu.resx index 3ffa2e12..60b56d21 100644 --- a/v2rayN/ServiceLib/Resx/ResUI.hu.resx +++ b/v2rayN/ServiceLib/Resx/ResUI.hu.resx @@ -1590,4 +1590,10 @@ Rule Type + + Bootstrap DNS + + + Resolve DNS server domains, requires IP + \ No newline at end of file diff --git a/v2rayN/ServiceLib/Resx/ResUI.resx b/v2rayN/ServiceLib/Resx/ResUI.resx index 5447e569..d92df24d 100644 --- a/v2rayN/ServiceLib/Resx/ResUI.resx +++ b/v2rayN/ServiceLib/Resx/ResUI.resx @@ -1590,4 +1590,10 @@ Rule Type + + Bootstrap DNS + + + Resolve DNS server domains, requires IP + \ No newline at end of file diff --git a/v2rayN/ServiceLib/Resx/ResUI.ru.resx b/v2rayN/ServiceLib/Resx/ResUI.ru.resx index 72a63936..7b2e12cb 100644 --- a/v2rayN/ServiceLib/Resx/ResUI.ru.resx +++ b/v2rayN/ServiceLib/Resx/ResUI.ru.resx @@ -1590,4 +1590,10 @@ Rule Type + + Bootstrap DNS + + + Resolve DNS server domains, requires IP + \ 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 a6e297c3..b4d912d2 100644 --- a/v2rayN/ServiceLib/Resx/ResUI.zh-Hans.resx +++ b/v2rayN/ServiceLib/Resx/ResUI.zh-Hans.resx @@ -1587,4 +1587,10 @@ 可对 Routing 和 DNS 单独设定规则,ALL 则都生效 + + Bootstrap DNS + + + 解析 DNS 服务器域名,需指定为 IP + \ 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 fe10f622..9605afc8 100644 --- a/v2rayN/ServiceLib/Resx/ResUI.zh-Hant.resx +++ b/v2rayN/ServiceLib/Resx/ResUI.zh-Hant.resx @@ -1587,4 +1587,10 @@ 可对 Routing 和 DNS 单独设定规则,ALL 则都生效 + + Bootstrap DNS + + + Resolve DNS server domains, requires IP + \ No newline at end of file diff --git a/v2rayN/ServiceLib/Services/CoreConfig/Singbox/SingboxDnsService.cs b/v2rayN/ServiceLib/Services/CoreConfig/Singbox/SingboxDnsService.cs index b1698ab4..d44c626a 100644 --- a/v2rayN/ServiceLib/Services/CoreConfig/Singbox/SingboxDnsService.cs +++ b/v2rayN/ServiceLib/Services/CoreConfig/Singbox/SingboxDnsService.cs @@ -138,12 +138,7 @@ public partial class CoreConfigSingboxService private async Task GenDnsDomains(SingboxConfig singboxConfig, SimpleDNSItem? simpleDNSItem) { - var finalDnsAddress = "local"; - if (_config.TunModeItem.EnableTun) - { - finalDnsAddress = "dhcp://auto"; - } - var finalDns = ParseDnsAddress(finalDnsAddress); + var finalDns = ParseDnsAddress(simpleDNSItem.BootstrapDNS); finalDns.tag = Global.SingboxLocalDNSTag; singboxConfig.dns ??= new Dns4Sbox(); singboxConfig.dns.servers ??= new List(); @@ -459,15 +454,19 @@ public partial class CoreConfigSingboxService return server; } - if (addressFirst.StartsWith("dhcp://", StringComparison.OrdinalIgnoreCase)) + var (domain, scheme, port, path) = Utils.ParseUrl(addressFirst); + + if (scheme.Equals("dhcp", StringComparison.OrdinalIgnoreCase)) { - var interface_name = addressFirst.Substring(7); server.type = "dhcp"; - server.Interface = interface_name == "auto" ? null : interface_name; + if ((!domain.IsNullOrEmpty()) && domain != "auto") + { + server.server = domain; + } return server; } - if (!addressFirst.Contains("://")) + if (scheme.IsNullOrEmpty()) { // udp dns server.type = "udp"; @@ -475,63 +474,19 @@ public partial class CoreConfigSingboxService return server; } - try + //server.type = scheme.ToLower(); + // remove "+local" suffix + // TODO: "+local" suffix decide server.detour = "direct" ? + server.type = scheme.Replace("+local", "", StringComparison.OrdinalIgnoreCase).ToLower(); + server.server = domain; + if (port != 0) { - var protocolEndIndex = addressFirst.IndexOf("://", StringComparison.Ordinal); - server.type = addressFirst.Substring(0, protocolEndIndex).ToLower(); - - var uri = new Uri(addressFirst); - server.server = uri.Host; - - if (!uri.IsDefaultPort) - { - server.server_port = uri.Port; - } - - if ((server.type == "https" || server.type == "h3") && !string.IsNullOrEmpty(uri.AbsolutePath) && uri.AbsolutePath != "/") - { - server.path = uri.AbsolutePath; - } + server.server_port = port; } - catch (UriFormatException) + if ((server.type == "https" || server.type == "h3") && !string.IsNullOrEmpty(path) && path != "/") { - var protocolEndIndex = addressFirst.IndexOf("://", StringComparison.Ordinal); - if (protocolEndIndex > 0) - { - server.type = addressFirst.Substring(0, protocolEndIndex).ToLower(); - var remaining = addressFirst.Substring(protocolEndIndex + 3); - - var portIndex = remaining.IndexOf(':'); - var pathIndex = remaining.IndexOf('/'); - - if (portIndex > 0) - { - server.server = remaining.Substring(0, portIndex); - var portPart = pathIndex > portIndex - ? remaining.Substring(portIndex + 1, pathIndex - portIndex - 1) - : remaining.Substring(portIndex + 1); - - if (int.TryParse(portPart, out var parsedPort)) - { - server.server_port = parsedPort; - } - } - else if (pathIndex > 0) - { - server.server = remaining.Substring(0, pathIndex); - } - else - { - server.server = remaining; - } - - if (pathIndex > 0 && (server.type == "https" || server.type == "h3")) - { - server.path = remaining.Substring(pathIndex); - } - } + server.path = path; } - return server; } } diff --git a/v2rayN/ServiceLib/Services/CoreConfig/V2ray/V2rayDnsService.cs b/v2rayN/ServiceLib/Services/CoreConfig/V2ray/V2rayDnsService.cs index cb731612..45f0c28a 100644 --- a/v2rayN/ServiceLib/Services/CoreConfig/V2ray/V2rayDnsService.cs +++ b/v2rayN/ServiceLib/Services/CoreConfig/V2ray/V2rayDnsService.cs @@ -103,6 +103,35 @@ public partial class CoreConfigV2rayService var expectedIPs = new List(); var regionNames = new HashSet(); + var bootstrapDNSAddress = ParseDnsAddresses(simpleDNSItem?.BootstrapDNS, Global.DomainPureIPDNSAddress.FirstOrDefault()); + var dnsServerDomains = new List(); + + foreach (var dns in directDNSAddress) + { + var (domain, _, _, _) = Utils.ParseUrl(dns); + if (domain == "localhost") + { + continue; + } + if (Utils.IsDomain(domain)) + { + dnsServerDomains.Add($"full:{domain}"); + } + } + foreach (var dns in remoteDNSAddress) + { + var (domain, _, _, _) = Utils.ParseUrl(dns); + if (domain == "localhost") + { + continue; + } + if (Utils.IsDomain(domain)) + { + dnsServerDomains.Add($"full:{domain}"); + } + } + dnsServerDomains = dnsServerDomains.Distinct().ToList(); + if (!string.IsNullOrEmpty(simpleDNSItem?.DirectExpectedIPs)) { expectedIPs = simpleDNSItem.DirectExpectedIPs @@ -217,6 +246,10 @@ public partial class CoreConfigV2rayService AddDnsServers(remoteDNSAddress, proxyGeositeList); AddDnsServers(directDNSAddress, directGeositeList); AddDnsServers(directDNSAddress, expectedDomainList, expectedIPs); + if (dnsServerDomains.Count > 0) + { + AddDnsServers(bootstrapDNSAddress, dnsServerDomains); + } var useDirectDns = rules?.LastOrDefault() is { } lastRule && lastRule.OutboundTag == Global.DirectTag diff --git a/v2rayN/ServiceLib/ViewModels/DNSSettingViewModel.cs b/v2rayN/ServiceLib/ViewModels/DNSSettingViewModel.cs index 9c559a23..d53b960d 100644 --- a/v2rayN/ServiceLib/ViewModels/DNSSettingViewModel.cs +++ b/v2rayN/ServiceLib/ViewModels/DNSSettingViewModel.cs @@ -8,6 +8,7 @@ public class DNSSettingViewModel : MyReactiveObject [Reactive] public bool? BlockBindingQuery { get; set; } [Reactive] public string? DirectDNS { get; set; } [Reactive] public string? RemoteDNS { get; set; } + [Reactive] public string? BootstrapDNS { get; set; } [Reactive] public string? RayStrategy4Freedom { get; set; } [Reactive] public string? SingboxStrategy4Direct { get; set; } [Reactive] public string? SingboxStrategy4Proxy { get; set; } @@ -68,6 +69,7 @@ public class DNSSettingViewModel : MyReactiveObject BlockBindingQuery = item.BlockBindingQuery; DirectDNS = item.DirectDNS; RemoteDNS = item.RemoteDNS; + BootstrapDNS = item.BootstrapDNS; RayStrategy4Freedom = item.RayStrategy4Freedom; SingboxStrategy4Direct = item.SingboxStrategy4Direct; SingboxStrategy4Proxy = item.SingboxStrategy4Proxy; @@ -97,6 +99,7 @@ public class DNSSettingViewModel : MyReactiveObject _config.SimpleDNSItem.BlockBindingQuery = BlockBindingQuery; _config.SimpleDNSItem.DirectDNS = DirectDNS; _config.SimpleDNSItem.RemoteDNS = RemoteDNS; + _config.SimpleDNSItem.BootstrapDNS = BootstrapDNS; _config.SimpleDNSItem.RayStrategy4Freedom = RayStrategy4Freedom; _config.SimpleDNSItem.SingboxStrategy4Direct = SingboxStrategy4Direct; _config.SimpleDNSItem.SingboxStrategy4Proxy = SingboxStrategy4Proxy; diff --git a/v2rayN/v2rayN.Desktop/Views/DNSSettingWindow.axaml b/v2rayN/v2rayN.Desktop/Views/DNSSettingWindow.axaml index d15929eb..e5a785b7 100644 --- a/v2rayN/v2rayN.Desktop/Views/DNSSettingWindow.axaml +++ b/v2rayN/v2rayN.Desktop/Views/DNSSettingWindow.axaml @@ -83,58 +83,79 @@ VerticalAlignment="Center" Text="{x:Static resx:ResUI.TbRemoteDNSTips}" TextWrapping="Wrap" /> - + + + + + diff --git a/v2rayN/v2rayN.Desktop/Views/DNSSettingWindow.axaml.cs b/v2rayN/v2rayN.Desktop/Views/DNSSettingWindow.axaml.cs index 71c3999c..a37f2c14 100644 --- a/v2rayN/v2rayN.Desktop/Views/DNSSettingWindow.axaml.cs +++ b/v2rayN/v2rayN.Desktop/Views/DNSSettingWindow.axaml.cs @@ -20,6 +20,7 @@ public partial class DNSSettingWindow : WindowBase cmbSBRemoteDNSStrategy.ItemsSource = Global.SingboxDomainStrategy4Out; cmbDirectDNS.ItemsSource = Global.DomainDirectDNSAddress; cmbRemoteDNS.ItemsSource = Global.DomainRemoteDNSAddress; + cmbBootstrapDNS.ItemsSource = Global.DomainPureIPDNSAddress; cmbDirectExpectedIPs.ItemsSource = Global.ExpectedIPs; cmbdomainStrategy4FreedomCompatible.ItemsSource = Global.DomainStrategy4Freedoms; @@ -35,6 +36,7 @@ public partial class DNSSettingWindow : WindowBase this.Bind(ViewModel, vm => vm.BlockBindingQuery, v => v.togBlockBindingQuery.IsChecked).DisposeWith(disposables); this.Bind(ViewModel, vm => vm.DirectDNS, v => v.cmbDirectDNS.Text).DisposeWith(disposables); this.Bind(ViewModel, vm => vm.RemoteDNS, v => v.cmbRemoteDNS.Text).DisposeWith(disposables); + this.Bind(ViewModel, vm => vm.BootstrapDNS, v => v.cmbBootstrapDNS.Text).DisposeWith(disposables); this.Bind(ViewModel, vm => vm.RayStrategy4Freedom, v => v.cmbRayFreedomDNSStrategy.SelectedItem).DisposeWith(disposables); this.Bind(ViewModel, vm => vm.SingboxStrategy4Direct, v => v.cmbSBDirectDNSStrategy.SelectedItem).DisposeWith(disposables); this.Bind(ViewModel, vm => vm.SingboxStrategy4Proxy, v => v.cmbSBRemoteDNSStrategy.SelectedItem).DisposeWith(disposables); diff --git a/v2rayN/v2rayN/Views/DNSSettingWindow.xaml b/v2rayN/v2rayN/Views/DNSSettingWindow.xaml index 733f5a97..7deb7c25 100644 --- a/v2rayN/v2rayN/Views/DNSSettingWindow.xaml +++ b/v2rayN/v2rayN/Views/DNSSettingWindow.xaml @@ -115,10 +115,34 @@ Margin="{StaticResource Margin8}" VerticalAlignment="Center" Style="{StaticResource ToolbarTextBlock}" + Text="{x:Static resx:ResUI.TbBootstrapDNS}" /> + + + + diff --git a/v2rayN/v2rayN/Views/DNSSettingWindow.xaml.cs b/v2rayN/v2rayN/Views/DNSSettingWindow.xaml.cs index ad99b357..3eabd26f 100644 --- a/v2rayN/v2rayN/Views/DNSSettingWindow.xaml.cs +++ b/v2rayN/v2rayN/Views/DNSSettingWindow.xaml.cs @@ -18,6 +18,7 @@ public partial class DNSSettingWindow cmbSBRemoteDNSStrategy.ItemsSource = Global.SingboxDomainStrategy4Out; cmbDirectDNS.ItemsSource = Global.DomainDirectDNSAddress; cmbRemoteDNS.ItemsSource = Global.DomainRemoteDNSAddress; + cmbBootstrapDNS.ItemsSource = Global.DomainPureIPDNSAddress; cmbDirectExpectedIPs.ItemsSource = Global.ExpectedIPs; cmbdomainStrategy4FreedomCompatible.ItemsSource = Global.DomainStrategy4Freedoms; @@ -33,6 +34,7 @@ public partial class DNSSettingWindow this.Bind(ViewModel, vm => vm.BlockBindingQuery, v => v.togBlockBindingQuery.IsChecked).DisposeWith(disposables); this.Bind(ViewModel, vm => vm.DirectDNS, v => v.cmbDirectDNS.Text).DisposeWith(disposables); this.Bind(ViewModel, vm => vm.RemoteDNS, v => v.cmbRemoteDNS.Text).DisposeWith(disposables); + this.Bind(ViewModel, vm => vm.BootstrapDNS, v => v.cmbBootstrapDNS.Text).DisposeWith(disposables); this.Bind(ViewModel, vm => vm.RayStrategy4Freedom, v => v.cmbRayFreedomDNSStrategy.Text).DisposeWith(disposables); this.Bind(ViewModel, vm => vm.SingboxStrategy4Direct, v => v.cmbSBDirectDNSStrategy.Text).DisposeWith(disposables); this.Bind(ViewModel, vm => vm.SingboxStrategy4Proxy, v => v.cmbSBRemoteDNSStrategy.Text).DisposeWith(disposables); From 6a19896915c60d14ea349b0860f692e69284e489 Mon Sep 17 00:00:00 2001 From: 2dust <31833384+2dust@users.noreply.github.com> Date: Tue, 21 Oct 2025 20:00:02 +0800 Subject: [PATCH 10/21] Optimize the desktop version icon --- v2rayN/v2rayN.Desktop/App.axaml | 16 +++++++------- .../v2rayN.Desktop/Assets/GlobalStyles.axaml | 9 ++++++++ .../Views/AddServerWindow.axaml | 12 ++++++----- .../Views/BackupAndRestoreView.axaml | 13 ++++++------ .../Views/ClashConnectionsView.axaml | 14 ++++--------- .../Views/ClashProxiesView.axaml | 14 ++++--------- v2rayN/v2rayN.Desktop/Views/MsgView.axaml | 14 ++++--------- .../Views/ProfilesSelectWindow.axaml | 7 +++---- .../v2rayN.Desktop/Views/ProfilesView.axaml | 21 ++++++------------- .../v2rayN.Desktop/Views/SubEditWindow.axaml | 12 ++++++----- .../Views/ThemeSettingView.axaml | 12 +++++------ 11 files changed, 65 insertions(+), 79 deletions(-) diff --git a/v2rayN/v2rayN.Desktop/App.axaml b/v2rayN/v2rayN.Desktop/App.axaml index 37c54471..21204f60 100644 --- a/v2rayN/v2rayN.Desktop/App.axaml +++ b/v2rayN/v2rayN.Desktop/App.axaml @@ -8,14 +8,7 @@ xmlns:vms="clr-namespace:ServiceLib.ViewModels;assembly=ServiceLib" Name="v2rayN" x:DataType="vms:StatusBarViewModel" - RequestedThemeVariant="Default"> - - - - - - - + RequestedThemeVariant="Default"> @@ -23,6 +16,13 @@ + + + + + + + diff --git a/v2rayN/v2rayN.Desktop/Assets/GlobalStyles.axaml b/v2rayN/v2rayN.Desktop/Assets/GlobalStyles.axaml index 6a2cfacd..eccdeb91 100644 --- a/v2rayN/v2rayN.Desktop/Assets/GlobalStyles.axaml +++ b/v2rayN/v2rayN.Desktop/Assets/GlobalStyles.axaml @@ -13,6 +13,7 @@ + + + diff --git a/v2rayN/v2rayN.Desktop/Views/AddServerWindow.axaml b/v2rayN/v2rayN.Desktop/Views/AddServerWindow.axaml index 7aa6a0be..7e3dda10 100644 --- a/v2rayN/v2rayN.Desktop/Views/AddServerWindow.axaml +++ b/v2rayN/v2rayN.Desktop/Views/AddServerWindow.axaml @@ -607,12 +607,14 @@ diff --git a/v2rayN/v2rayN.Desktop/Views/ClashProxiesView.axaml b/v2rayN/v2rayN.Desktop/Views/ClashProxiesView.axaml index 974d5192..a4ef8315 100644 --- a/v2rayN/v2rayN.Desktop/Views/ClashProxiesView.axaml +++ b/v2rayN/v2rayN.Desktop/Views/ClashProxiesView.axaml @@ -50,27 +50,21 @@ diff --git a/v2rayN/v2rayN.Desktop/Views/MsgView.axaml b/v2rayN/v2rayN.Desktop/Views/MsgView.axaml index 2f7ad807..8c2cc90c 100644 --- a/v2rayN/v2rayN.Desktop/Views/MsgView.axaml +++ b/v2rayN/v2rayN.Desktop/Views/MsgView.axaml @@ -25,28 +25,22 @@ - + diff --git a/v2rayN/v2rayN.Desktop/Views/ProfilesView.axaml b/v2rayN/v2rayN.Desktop/Views/ProfilesView.axaml index a0f5af1b..7a6cf085 100644 --- a/v2rayN/v2rayN.Desktop/Views/ProfilesView.axaml +++ b/v2rayN/v2rayN.Desktop/Views/ProfilesView.axaml @@ -32,39 +32,30 @@ diff --git a/v2rayN/v2rayN.Desktop/Views/SubEditWindow.axaml b/v2rayN/v2rayN.Desktop/Views/SubEditWindow.axaml index 211cff40..79216921 100644 --- a/v2rayN/v2rayN.Desktop/Views/SubEditWindow.axaml +++ b/v2rayN/v2rayN.Desktop/Views/SubEditWindow.axaml @@ -72,13 +72,15 @@ + + - + Classes="IconButton Success" + ToolTip.Tip="{x:Static resx:ResUI.menuFastRealPing}"> + + + + + - + + diff --git a/v2rayN/v2rayN.Desktop/Views/ProfilesView.axaml.cs b/v2rayN/v2rayN.Desktop/Views/ProfilesView.axaml.cs index 09d0952c..754f6aa6 100644 --- a/v2rayN/v2rayN.Desktop/Views/ProfilesView.axaml.cs +++ b/v2rayN/v2rayN.Desktop/Views/ProfilesView.axaml.cs @@ -80,6 +80,7 @@ public partial class ProfilesView : ReactiveUserControl this.BindCommand(ViewModel, vm => vm.SpeedServerCmd, v => v.menuSpeedServer).DisposeWith(disposables); this.BindCommand(ViewModel, vm => vm.SortServerResultCmd, v => v.menuSortServerResult).DisposeWith(disposables); this.BindCommand(ViewModel, vm => vm.RemoveInvalidServerResultCmd, v => v.menuRemoveInvalidServerResult).DisposeWith(disposables); + this.BindCommand(ViewModel, vm => vm.FastRealPingCmd, v => v.btnFastRealPing).DisposeWith(disposables); //servers export this.BindCommand(ViewModel, vm => vm.Export2ClientConfigCmd, v => v.menuExport2ClientConfig).DisposeWith(disposables); diff --git a/v2rayN/v2rayN/Views/ProfilesView.xaml b/v2rayN/v2rayN/Views/ProfilesView.xaml index 495dfb1b..1a33966b 100644 --- a/v2rayN/v2rayN/Views/ProfilesView.xaml +++ b/v2rayN/v2rayN/Views/ProfilesView.xaml @@ -57,16 +57,6 @@ - + + + + vm.SpeedServerCmd, v => v.menuSpeedServer).DisposeWith(disposables); this.BindCommand(ViewModel, vm => vm.SortServerResultCmd, v => v.menuSortServerResult).DisposeWith(disposables); this.BindCommand(ViewModel, vm => vm.RemoveInvalidServerResultCmd, v => v.menuRemoveInvalidServerResult).DisposeWith(disposables); + this.BindCommand(ViewModel, vm => vm.FastRealPingCmd, v => v.btnFastRealPing).DisposeWith(disposables); //servers export this.BindCommand(ViewModel, vm => vm.Export2ClientConfigCmd, v => v.menuExport2ClientConfig).DisposeWith(disposables); From ecf42cb85d667d29f3588fe43109cdb60234b9a1 Mon Sep 17 00:00:00 2001 From: DHR60 Date: Thu, 23 Oct 2025 09:09:26 +0800 Subject: [PATCH 15/21] Fix dns (#8174) --- v2rayN/ServiceLib/Models/V2rayConfig.cs | 1 + .../Services/CoreConfig/V2ray/V2rayDnsService.cs | 11 ++++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/v2rayN/ServiceLib/Models/V2rayConfig.cs b/v2rayN/ServiceLib/Models/V2rayConfig.cs index 0f4fd348..22dcf9f4 100644 --- a/v2rayN/ServiceLib/Models/V2rayConfig.cs +++ b/v2rayN/ServiceLib/Models/V2rayConfig.cs @@ -215,6 +215,7 @@ public class Dns4Ray public class DnsServer4Ray { public string? address { get; set; } + public int? port { get; set; } public List? domains { get; set; } public bool? skipFallback { get; set; } public List? expectedIPs { get; set; } diff --git a/v2rayN/ServiceLib/Services/CoreConfig/V2ray/V2rayDnsService.cs b/v2rayN/ServiceLib/Services/CoreConfig/V2ray/V2rayDnsService.cs index 45f0c28a..d3cff6cc 100644 --- a/v2rayN/ServiceLib/Services/CoreConfig/V2ray/V2rayDnsService.cs +++ b/v2rayN/ServiceLib/Services/CoreConfig/V2ray/V2rayDnsService.cs @@ -79,9 +79,18 @@ public partial class CoreConfigV2rayService static object CreateDnsServer(string dnsAddress, List domains, List? expectedIPs = null) { + var (domain, scheme, port, path) = Utils.ParseUrl(dnsAddress); + var domainFinal = dnsAddress; + int? portFinal = null; + if (scheme.IsNullOrEmpty() || scheme.Contains("udp", StringComparison.OrdinalIgnoreCase) || scheme.Contains("tcp", StringComparison.OrdinalIgnoreCase)) + { + domainFinal = domain; + portFinal = port > 0 ? port : null; + } var dnsServer = new DnsServer4Ray { - address = dnsAddress, + address = domainFinal, + port = portFinal, skipFallback = true, domains = domains.Count > 0 ? domains : null, expectedIPs = expectedIPs?.Count > 0 ? expectedIPs : null From bbedc4dbb11472e56f9fe766fbedcee4fc95f872 Mon Sep 17 00:00:00 2001 From: DHR60 Date: Thu, 23 Oct 2025 09:10:21 +0800 Subject: [PATCH 16/21] Fix (#8175) --- .../Singbox/SingboxOutboundService.cs | 2 +- .../V2ray/V2rayConfigTemplateService.cs | 25 ++++++++++++++----- 2 files changed, 20 insertions(+), 7 deletions(-) diff --git a/v2rayN/ServiceLib/Services/CoreConfig/Singbox/SingboxOutboundService.cs b/v2rayN/ServiceLib/Services/CoreConfig/Singbox/SingboxOutboundService.cs index 097df4c3..84111652 100644 --- a/v2rayN/ServiceLib/Services/CoreConfig/Singbox/SingboxOutboundService.cs +++ b/v2rayN/ServiceLib/Services/CoreConfig/Singbox/SingboxOutboundService.cs @@ -294,7 +294,7 @@ public partial class CoreConfigSingboxService var tls = new Tls4Sbox() { enabled = true, - record_fragment = _config.CoreBasicItem.EnableFragment, + record_fragment = _config.CoreBasicItem.EnableFragment ? true : null, server_name = server_name, insecure = Utils.ToBool(node.AllowInsecure.IsNullOrEmpty() ? _config.CoreBasicItem.DefAllowInsecure.ToString().ToLower() : node.AllowInsecure), alpn = node.GetAlpn(), diff --git a/v2rayN/ServiceLib/Services/CoreConfig/V2ray/V2rayConfigTemplateService.cs b/v2rayN/ServiceLib/Services/CoreConfig/V2ray/V2rayConfigTemplateService.cs index f53308d1..ed023126 100644 --- a/v2rayN/ServiceLib/Services/CoreConfig/V2ray/V2rayConfigTemplateService.cs +++ b/v2rayN/ServiceLib/Services/CoreConfig/V2ray/V2rayConfigTemplateService.cs @@ -86,8 +86,8 @@ public partial class CoreConfigV2rayService } } - // Handle outbounds - append instead of override - var customOutboundsNode = fullConfigTemplateNode["outbounds"] is JsonArray outbounds ? outbounds : new JsonArray(); + var customOutboundsNode = new JsonArray(); + foreach (var outbound in v2rayConfig.outbounds) { if (outbound.protocol.ToLower() is "blackhole" or "dns" or "freedom") @@ -97,14 +97,27 @@ public partial class CoreConfigV2rayService continue; } } - else if ((outbound.streamSettings?.sockopt?.dialerProxy.IsNullOrEmpty() == true) && (!fullConfigTemplate.ProxyDetour.IsNullOrEmpty()) && !(Utils.IsPrivateNetwork(outbound.settings?.servers?.FirstOrDefault()?.address ?? string.Empty) || Utils.IsPrivateNetwork(outbound.settings?.vnext?.FirstOrDefault()?.address ?? string.Empty))) + else if (!fullConfigTemplate.ProxyDetour.IsNullOrEmpty()) { - outbound.streamSettings ??= new StreamSettings4Ray(); - outbound.streamSettings.sockopt ??= new Sockopt4Ray(); - outbound.streamSettings.sockopt.dialerProxy = fullConfigTemplate.ProxyDetour; + var outboundAddress = outbound.settings?.servers?.FirstOrDefault()?.address ?? outbound.settings?.vnext?.FirstOrDefault()?.address ?? string.Empty; + if (!Utils.IsPrivateNetwork(outboundAddress)) + { + outbound.streamSettings ??= new StreamSettings4Ray(); + outbound.streamSettings.sockopt ??= new Sockopt4Ray(); + outbound.streamSettings.sockopt.dialerProxy = fullConfigTemplate.ProxyDetour; + } } customOutboundsNode.Add(JsonUtils.DeepCopy(outbound)); } + + if (fullConfigTemplateNode["outbounds"] is JsonArray templateOutbounds) + { + foreach (var outbound in templateOutbounds) + { + customOutboundsNode.Add(outbound?.DeepClone()); + } + } + fullConfigTemplateNode["outbounds"] = customOutboundsNode; return await Task.FromResult(JsonUtils.Serialize(fullConfigTemplateNode)); From f28fa31c145c56f1024881797343b439533ad013 Mon Sep 17 00:00:00 2001 From: DHR60 Date: Thu, 23 Oct 2025 17:57:47 +0800 Subject: [PATCH 17/21] Fix tcp dns (#8179) --- .../Services/CoreConfig/V2ray/V2rayDnsService.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/v2rayN/ServiceLib/Services/CoreConfig/V2ray/V2rayDnsService.cs b/v2rayN/ServiceLib/Services/CoreConfig/V2ray/V2rayDnsService.cs index d3cff6cc..7170c5f0 100644 --- a/v2rayN/ServiceLib/Services/CoreConfig/V2ray/V2rayDnsService.cs +++ b/v2rayN/ServiceLib/Services/CoreConfig/V2ray/V2rayDnsService.cs @@ -82,11 +82,16 @@ public partial class CoreConfigV2rayService var (domain, scheme, port, path) = Utils.ParseUrl(dnsAddress); var domainFinal = dnsAddress; int? portFinal = null; - if (scheme.IsNullOrEmpty() || scheme.Contains("udp", StringComparison.OrdinalIgnoreCase) || scheme.Contains("tcp", StringComparison.OrdinalIgnoreCase)) + if (scheme.IsNullOrEmpty() || scheme.StartsWith("udp", StringComparison.OrdinalIgnoreCase)) { domainFinal = domain; portFinal = port > 0 ? port : null; } + else if (scheme.StartsWith("tcp", StringComparison.OrdinalIgnoreCase)) + { + domainFinal = scheme + "://" + domain; + portFinal = port > 0 ? port : null; + } var dnsServer = new DnsServer4Ray { address = domainFinal, From 7c76308c936fd4ca7ba9d1a7afbffe20eef633f8 Mon Sep 17 00:00:00 2001 From: DHR60 Date: Thu, 23 Oct 2025 17:58:02 +0800 Subject: [PATCH 18/21] Fix (#8180) --- .../CoreConfig/V2ray/V2rayConfigTemplateService.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/v2rayN/ServiceLib/Services/CoreConfig/V2ray/V2rayConfigTemplateService.cs b/v2rayN/ServiceLib/Services/CoreConfig/V2ray/V2rayConfigTemplateService.cs index ed023126..986e1966 100644 --- a/v2rayN/ServiceLib/Services/CoreConfig/V2ray/V2rayConfigTemplateService.cs +++ b/v2rayN/ServiceLib/Services/CoreConfig/V2ray/V2rayConfigTemplateService.cs @@ -97,9 +97,12 @@ public partial class CoreConfigV2rayService continue; } } - else if (!fullConfigTemplate.ProxyDetour.IsNullOrEmpty()) + else if ((!fullConfigTemplate.ProxyDetour.IsNullOrEmpty()) + && ((outbound.streamSettings?.sockopt?.dialerProxy.IsNullOrEmpty() ?? true) == true)) { - var outboundAddress = outbound.settings?.servers?.FirstOrDefault()?.address ?? outbound.settings?.vnext?.FirstOrDefault()?.address ?? string.Empty; + var outboundAddress = outbound.settings?.servers?.FirstOrDefault()?.address + ?? outbound.settings?.vnext?.FirstOrDefault()?.address + ?? string.Empty; if (!Utils.IsPrivateNetwork(outboundAddress)) { outbound.streamSettings ??= new StreamSettings4Ray(); From b4c20e7b812ef5c5ff34f29def8ab4c51b655649 Mon Sep 17 00:00:00 2001 From: 2dust <31833384+2dust@users.noreply.github.com> Date: Thu, 23 Oct 2025 19:03:16 +0800 Subject: [PATCH 19/21] Bug fix https://github.com/2dust/v2rayN/discussions/8168 --- v2rayN/ServiceLib/Handler/ConfigHandler.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/v2rayN/ServiceLib/Handler/ConfigHandler.cs b/v2rayN/ServiceLib/Handler/ConfigHandler.cs index 2840fab7..8b5acff2 100644 --- a/v2rayN/ServiceLib/Handler/ConfigHandler.cs +++ b/v2rayN/ServiceLib/Handler/ConfigHandler.cs @@ -1221,6 +1221,7 @@ public static class ConfigHandler CoreType = coreType, ConfigType = EConfigType.PolicyGroup, Remarks = remark, + IsSub = false }; if (!subId.IsNullOrEmpty()) { From 83d4a9c18e6dc5aa8de9ef11285548643882c40c Mon Sep 17 00:00:00 2001 From: 2dust <31833384+2dust@users.noreply.github.com> Date: Fri, 24 Oct 2025 14:22:05 +0800 Subject: [PATCH 20/21] Update Directory.Packages.props --- v2rayN/Directory.Packages.props | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/v2rayN/Directory.Packages.props b/v2rayN/Directory.Packages.props index a3dde2c1..a339af4c 100644 --- a/v2rayN/Directory.Packages.props +++ b/v2rayN/Directory.Packages.props @@ -6,13 +6,13 @@ - - - - + + + + - + From 1a0f50a41e0f6ef15af64885edc67b841627ca5e Mon Sep 17 00:00:00 2001 From: 2dust <31833384+2dust@users.noreply.github.com> Date: Fri, 24 Oct 2025 14:22:35 +0800 Subject: [PATCH 21/21] up 7.15.6 --- v2rayN/Directory.Build.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/v2rayN/Directory.Build.props b/v2rayN/Directory.Build.props index 4c25065d..bea02572 100644 --- a/v2rayN/Directory.Build.props +++ b/v2rayN/Directory.Build.props @@ -1,7 +1,7 @@ - 7.15.5 + 7.15.6