From ed7fb4f6e39570de95388eb986c197ddb95c9677 Mon Sep 17 00:00:00 2001 From: 2dust <31833384+2dust@users.noreply.github.com> Date: Sun, 5 Jan 2025 14:50:31 +0800 Subject: [PATCH] Code clean --- v2rayN/ServiceLib/Common/WindowsUtils.cs | 1 + v2rayN/ServiceLib/Handler/ConfigHandler.cs | 2 +- v2rayN/ServiceLib/Handler/CoreConfigHandler.cs | 4 +--- v2rayN/ServiceLib/Handler/SysProxy/SysProxyHandler.cs | 1 + v2rayN/ServiceLib/Handler/WebDavHandler.cs | 1 - v2rayN/ServiceLib/Services/DownloadService.cs | 1 + v2rayN/v2rayN/Common/WindowsUtils.cs | 1 + 7 files changed, 6 insertions(+), 5 deletions(-) diff --git a/v2rayN/ServiceLib/Common/WindowsUtils.cs b/v2rayN/ServiceLib/Common/WindowsUtils.cs index 94b3b811..83e2ee57 100644 --- a/v2rayN/ServiceLib/Common/WindowsUtils.cs +++ b/v2rayN/ServiceLib/Common/WindowsUtils.cs @@ -5,6 +5,7 @@ namespace ServiceLib.Common internal static class WindowsUtils { private static readonly string _tag = "WindowsUtils"; + public static string? RegReadValue(string path, string name, string def) { RegistryKey? regKey = null; diff --git a/v2rayN/ServiceLib/Handler/ConfigHandler.cs b/v2rayN/ServiceLib/Handler/ConfigHandler.cs index fea4b3f4..a3fa8513 100644 --- a/v2rayN/ServiceLib/Handler/ConfigHandler.cs +++ b/v2rayN/ServiceLib/Handler/ConfigHandler.cs @@ -1870,7 +1870,7 @@ namespace ServiceLib.Handler await SaveDNSItems(config, await GetExternalDNSItem(ECoreType.sing_box, Global.DNSTemplateSources[1] + "sing_box.json")); return true; - + case EPresetType.Iran: config.ConstItem.GeoSourceUrl = Global.GeoFilesSources[2]; config.ConstItem.SrsSourceUrl = Global.SingboxRulesetSources[2]; diff --git a/v2rayN/ServiceLib/Handler/CoreConfigHandler.cs b/v2rayN/ServiceLib/Handler/CoreConfigHandler.cs index a034712d..e3df88d4 100644 --- a/v2rayN/ServiceLib/Handler/CoreConfigHandler.cs +++ b/v2rayN/ServiceLib/Handler/CoreConfigHandler.cs @@ -1,6 +1,4 @@ -using YamlDotNet.Core.Tokens; - -namespace ServiceLib.Handler +namespace ServiceLib.Handler { /// /// Core configuration file processing class diff --git a/v2rayN/ServiceLib/Handler/SysProxy/SysProxyHandler.cs b/v2rayN/ServiceLib/Handler/SysProxy/SysProxyHandler.cs index 7aceb5fd..0d3e2ec1 100644 --- a/v2rayN/ServiceLib/Handler/SysProxy/SysProxyHandler.cs +++ b/v2rayN/ServiceLib/Handler/SysProxy/SysProxyHandler.cs @@ -3,6 +3,7 @@ public static class SysProxyHandler { private static readonly string _tag = "SysProxyHandler"; + public static async Task UpdateSysProxy(Config config, bool forceDisable) { var type = config.SystemProxyItem.SysProxyType; diff --git a/v2rayN/ServiceLib/Handler/WebDavHandler.cs b/v2rayN/ServiceLib/Handler/WebDavHandler.cs index 4deed956..d661eb66 100644 --- a/v2rayN/ServiceLib/Handler/WebDavHandler.cs +++ b/v2rayN/ServiceLib/Handler/WebDavHandler.cs @@ -14,7 +14,6 @@ namespace ServiceLib.Handler private string _webDir = Global.AppName + "_backup"; private readonly string _webFileName = "backup.zip"; private readonly string _tag = "WebDav--"; - public WebDavHandler() { diff --git a/v2rayN/ServiceLib/Services/DownloadService.cs b/v2rayN/ServiceLib/Services/DownloadService.cs index e420ce78..c5de51be 100644 --- a/v2rayN/ServiceLib/Services/DownloadService.cs +++ b/v2rayN/ServiceLib/Services/DownloadService.cs @@ -13,6 +13,7 @@ namespace ServiceLib.Services public event EventHandler? UpdateCompleted; public event ErrorEventHandler? Error; + private static readonly string _tag = "DownloadService"; public async Task DownloadDataAsync(string url, WebProxy webProxy, int downloadTimeout, Action updateFunc) diff --git a/v2rayN/v2rayN/Common/WindowsUtils.cs b/v2rayN/v2rayN/Common/WindowsUtils.cs index d07920f3..02ec9abb 100644 --- a/v2rayN/v2rayN/Common/WindowsUtils.cs +++ b/v2rayN/v2rayN/Common/WindowsUtils.cs @@ -14,6 +14,7 @@ namespace v2rayN internal static class WindowsUtils { private static readonly string _tag = "WindowsUtils"; + /// /// 获取剪贴板数 ///