From 61bea05f6358f1b1b354e64db6d4829d65e48592 Mon Sep 17 00:00:00 2001 From: 2dust <31833384+2dust@users.noreply.github.com> Date: Mon, 19 Aug 2024 18:15:54 +0800 Subject: [PATCH] Refactoring Project --- .../Common/DownloaderHelper.cs | 5 +- .../Common/FileManager.cs | 19 ++++- .../Common/HttpClientHelper.cs | 6 +- v2rayN/{v2rayN => ServiceLib}/Common/Job.cs | 2 +- .../Common/JsonUtils.cs | 7 +- .../{v2rayN => ServiceLib}/Common/Logging.cs | 3 +- .../Common/QueryableExtension.cs | 2 +- .../Common/SemanticVersion.cs | 2 +- .../Common/SqliteHelper.cs | 2 +- .../{v2rayN => ServiceLib}/Common/StringEx.cs | 5 +- v2rayN/{v2rayN => ServiceLib}/Common/Utils.cs | 5 +- .../Common/YamlUtils.cs | 4 +- .../Enums/EConfigType.cs | 2 +- .../{v2rayN => ServiceLib}/Enums/ECoreType.cs | 2 +- .../Enums/EGirdOrientation.cs | 2 +- .../Enums/EGlobalHotkey.cs | 2 +- .../Enums/EInboundProtocol.cs | 2 +- v2rayN/{v2rayN => ServiceLib}/Enums/EMove.cs | 2 +- .../{v2rayN => ServiceLib}/Enums/ERuleMode.cs | 2 +- .../Enums/EServerColName.cs | 2 +- .../Enums/ESpeedActionType.cs | 2 +- .../Enums/ESysProxyType.cs | 2 +- .../Enums/ETransport.cs | 2 +- .../Enums/EViewAction.cs | 2 +- v2rayN/{v2rayN => ServiceLib}/Global.cs | 36 ++++---- v2rayN/ServiceLib/GlobalUsings.cs | 7 ++ .../Handler/ClashApiHandler.cs | 5 +- .../Handler/ConfigHandler.cs | 11 +-- .../Handler/CoreConfig/CoreConfigClash.cs | 10 +-- .../Handler/CoreConfig/CoreConfigHandler.cs | 9 +- .../Handler/CoreConfig/CoreConfigSingbox.cs | 8 +- .../Handler/CoreConfig/CoreConfigV2ray.cs | 7 +- .../Handler/CoreHandler.cs | 9 +- .../Handler/CoreInfoHandler.cs | 4 +- .../Handler/DownloadHandler.cs | 8 +- .../Handler/Fmt/BaseFmt.cs | 7 +- .../Handler/Fmt/ClashFmt.cs | 7 +- .../Handler/Fmt/FmtHandler.cs | 8 +- .../Handler/Fmt/Hysteria2Fmt.cs | 8 +- .../Handler/Fmt/NaiveproxyFmt.cs | 7 +- .../Handler/Fmt/ShadowsocksFmt.cs | 7 +- .../Handler/Fmt/SingboxFmt.cs | 7 +- .../Handler/Fmt/SocksFmt.cs | 8 +- .../Handler/Fmt/TrojanFmt.cs | 8 +- .../Handler/Fmt/TuicFmt.cs | 8 +- .../Handler/Fmt/V2rayFmt.cs | 7 +- .../Handler/Fmt/VLESSFmt.cs | 8 +- .../Handler/Fmt/VmessFmt.cs | 8 +- .../Handler/Fmt/WireguardFmt.cs | 8 +- .../Handler/LazyConfig.cs | 6 +- .../Handler/ProfileExHandler.cs | 8 +- .../Handler/SpeedtestHandler.cs | 48 +++-------- .../Handler/Statistics/StatisticsHandler.cs | 6 +- .../Handler/Statistics/StatisticsSingbox.cs | 6 +- .../Handler/Statistics/StatisticsV2ray.cs | 6 +- .../Handler/TaskHandler.cs | 6 +- .../Handler/UpdateHandler.cs | 59 +++---------- .../Models/ClashConnectionModel.cs | 2 +- .../Models/ClashConnections.cs | 2 +- .../Models/ClashProviders.cs | 4 +- .../Models/ClashProxies.cs | 2 +- .../Models/ClashProxyModel.cs | 10 +-- .../Models/ComboItem.cs | 2 +- .../{v2rayN => ServiceLib}/Models/Config.cs | 4 +- .../Models/ConfigItems.cs | 4 +- .../{v2rayN => ServiceLib}/Models/CoreInfo.cs | 4 +- .../{v2rayN => ServiceLib}/Models/DNSItem.cs | 3 +- .../Models/GitHubRelease.cs | 2 +- .../Models/ProfileExItem.cs | 2 +- .../Models/ProfileItem.cs | 3 +- .../Models/ProfileItemModel.cs | 2 +- .../Models/RoutingItem.cs | 2 +- .../Models/RoutingItemModel.cs | 2 +- .../Models/RulesItem.cs | 2 +- .../Models/RulesItemModel.cs | 2 +- .../Models/ServerSpeedItem.cs | 2 +- .../Models/ServerStatItem.cs | 2 +- .../Models/ServerTestItem.cs | 6 +- .../Models/SingboxConfig.cs | 2 +- .../Models/SpeedTestResult.cs | 2 +- .../{v2rayN => ServiceLib}/Models/SsSIP008.cs | 2 +- .../{v2rayN => ServiceLib}/Models/SubItem.cs | 2 +- .../Models/SysProxyConfig.cs | 4 +- .../Models/V2rayConfig.cs | 2 +- .../Models/V2rayTcpRequest.cs | 2 +- .../Models/VmessQRCode.cs | 4 +- .../Resx/ResUI.Designer.cs | 6 +- .../Resx/ResUI.fa-Ir.resx | 0 v2rayN/{v2rayN => ServiceLib}/Resx/ResUI.resx | 0 .../{v2rayN => ServiceLib}/Resx/ResUI.ru.resx | 0 .../Resx/ResUI.zh-Hans.resx | 0 .../Resx/ResUI.zh-Hant.resx | 0 .../Sample/SampleClientConfig | 0 .../Sample/SampleHttpRequest | 0 .../Sample/SampleHttpResponse | 0 .../Sample/SampleInbound | 0 .../Sample/SampleOutbound | 0 .../Sample/SingboxSampleClientConfig | 0 .../Sample/SingboxSampleOutbound | 0 .../Sample/clash_mixin_yaml | 0 .../Sample/clash_tun_yaml | 0 .../Sample/custom_routing_black | 0 .../Sample/custom_routing_global | 0 .../Sample/custom_routing_locked | 0 .../Sample/custom_routing_rules | 0 .../Sample/custom_routing_white | 0 .../Sample/dns_singbox_normal | 0 .../Sample/dns_v2ray_normal | 0 .../Sample/tun_singbox_dns | 0 .../Sample/tun_singbox_inbound | 0 .../Sample/tun_singbox_rules | 0 v2rayN/ServiceLib/ServiceLib.csproj | 75 +++++++++++++++++ v2rayN/v2rayN.sln | 6 ++ v2rayN/v2rayN/App.xaml | 2 +- v2rayN/v2rayN/App.xaml.cs | 2 - v2rayN/v2rayN/Base/MyReactiveObject.cs | 2 - .../v2rayN/Converters/MaterialDesignFonts.cs | 1 - v2rayN/v2rayN/GlobalUsings.cs | 9 ++ v2rayN/v2rayN/Handler/HotkeyHandler.cs | 3 - v2rayN/v2rayN/Handler/SysProxyHandler.cs | 2 - v2rayN/v2rayN/Handler/WindowsHandler.cs | 2 - .../v2rayN/ViewModels/AddServer2ViewModel.cs | 3 - .../v2rayN/ViewModels/AddServerViewModel.cs | 3 - .../ViewModels/ClashConnectionsViewModel.cs | 3 - .../ViewModels/ClashProxiesViewModel.cs | 9 +- .../v2rayN/ViewModels/DNSSettingViewModel.cs | 3 - .../v2rayN/ViewModels/MainWindowViewModel.cs | 27 ++++-- .../ViewModels/OptionSettingViewModel.cs | 3 - v2rayN/v2rayN/ViewModels/ProfilesViewModel.cs | 13 +-- .../ViewModels/RoutingRuleDetailsViewModel.cs | 3 - .../ViewModels/RoutingRuleSettingViewModel.cs | 3 - .../ViewModels/RoutingSettingViewModel.cs | 3 - v2rayN/v2rayN/ViewModels/SubEditViewModel.cs | 3 - .../v2rayN/ViewModels/SubSettingViewModel.cs | 3 - .../ViewModels/ThemeSettingViewModel.cs | 2 - v2rayN/v2rayN/Views/AddServer2Window.xaml | 10 +-- v2rayN/v2rayN/Views/AddServer2Window.xaml.cs | 3 - v2rayN/v2rayN/Views/AddServerWindow.xaml | 10 +-- v2rayN/v2rayN/Views/AddServerWindow.xaml.cs | 4 - v2rayN/v2rayN/Views/ClashConnectionsView.xaml | 8 +- .../v2rayN/Views/ClashConnectionsView.xaml.cs | 2 - v2rayN/v2rayN/Views/ClashProxiesView.xaml | 10 +-- v2rayN/v2rayN/Views/ClashProxiesView.xaml.cs | 2 - v2rayN/v2rayN/Views/DNSSettingWindow.xaml | 2 +- v2rayN/v2rayN/Views/DNSSettingWindow.xaml.cs | 3 - .../Views/GlobalHotkeySettingWindow.xaml | 2 +- .../Views/GlobalHotkeySettingWindow.xaml.cs | 3 - v2rayN/v2rayN/Views/MainWindow.xaml | 2 +- v2rayN/v2rayN/Views/MainWindow.xaml.cs | 5 +- v2rayN/v2rayN/Views/MsgView.xaml | 2 +- v2rayN/v2rayN/Views/MsgView.xaml.cs | 2 - v2rayN/v2rayN/Views/OptionSettingWindow.xaml | 2 +- .../v2rayN/Views/OptionSettingWindow.xaml.cs | 3 - v2rayN/v2rayN/Views/ProfilesView.xaml | 2 +- v2rayN/v2rayN/Views/ProfilesView.xaml.cs | 6 +- v2rayN/v2rayN/Views/QrcodeView.xaml | 2 +- .../Views/RoutingRuleDetailsWindow.xaml | 2 +- .../Views/RoutingRuleDetailsWindow.xaml.cs | 3 - .../Views/RoutingRuleSettingWindow.xaml | 2 +- .../Views/RoutingRuleSettingWindow.xaml.cs | 4 - v2rayN/v2rayN/Views/RoutingSettingWindow.xaml | 2 +- .../v2rayN/Views/RoutingSettingWindow.xaml.cs | 4 - v2rayN/v2rayN/Views/SubEditWindow.xaml | 2 +- v2rayN/v2rayN/Views/SubEditWindow.xaml.cs | 3 - v2rayN/v2rayN/Views/SubSettingWindow.xaml | 2 +- v2rayN/v2rayN/Views/SubSettingWindow.xaml.cs | 4 - v2rayN/v2rayN/Views/ThemeSettingView.xaml | 2 +- v2rayN/v2rayN/v2rayN.csproj | 82 +------------------ 168 files changed, 345 insertions(+), 578 deletions(-) rename v2rayN/{v2rayN => ServiceLib}/Common/DownloaderHelper.cs (98%) rename v2rayN/{v2rayN => ServiceLib}/Common/FileManager.cs (84%) rename v2rayN/{v2rayN => ServiceLib}/Common/HttpClientHelper.cs (98%) rename v2rayN/{v2rayN => ServiceLib}/Common/Job.cs (99%) rename v2rayN/{v2rayN => ServiceLib}/Common/JsonUtils.cs (97%) rename v2rayN/{v2rayN => ServiceLib}/Common/Logging.cs (98%) rename v2rayN/{v2rayN => ServiceLib}/Common/QueryableExtension.cs (98%) rename v2rayN/{v2rayN => ServiceLib}/Common/SemanticVersion.cs (99%) rename v2rayN/{v2rayN => ServiceLib}/Common/SqliteHelper.cs (99%) rename v2rayN/{v2rayN => ServiceLib}/Common/StringEx.cs (97%) rename v2rayN/{v2rayN => ServiceLib}/Common/Utils.cs (99%) rename v2rayN/{v2rayN => ServiceLib}/Common/YamlUtils.cs (96%) rename v2rayN/{v2rayN => ServiceLib}/Enums/EConfigType.cs (89%) rename v2rayN/{v2rayN => ServiceLib}/Enums/ECoreType.cs (91%) rename v2rayN/{v2rayN => ServiceLib}/Enums/EGirdOrientation.cs (76%) rename v2rayN/{v2rayN => ServiceLib}/Enums/EGlobalHotkey.cs (86%) rename v2rayN/{v2rayN => ServiceLib}/Enums/EInboundProtocol.cs (85%) rename v2rayN/{v2rayN => ServiceLib}/Enums/EMove.cs (81%) rename v2rayN/{v2rayN => ServiceLib}/Enums/ERuleMode.cs (80%) rename v2rayN/{v2rayN => ServiceLib}/Enums/EServerColName.cs (90%) rename v2rayN/{v2rayN => ServiceLib}/Enums/ESpeedActionType.cs (79%) rename v2rayN/{v2rayN => ServiceLib}/Enums/ESysProxyType.cs (81%) rename v2rayN/{v2rayN => ServiceLib}/Enums/ETransport.cs (85%) rename v2rayN/{v2rayN => ServiceLib}/Enums/EViewAction.cs (96%) rename v2rayN/{v2rayN => ServiceLib}/Global.cs (90%) create mode 100644 v2rayN/ServiceLib/GlobalUsings.cs rename v2rayN/{v2rayN => ServiceLib}/Handler/ClashApiHandler.cs (98%) rename v2rayN/{v2rayN => ServiceLib}/Handler/ConfigHandler.cs (99%) rename v2rayN/{v2rayN => ServiceLib}/Handler/CoreConfig/CoreConfigClash.cs (97%) rename v2rayN/{v2rayN => ServiceLib}/Handler/CoreConfig/CoreConfigHandler.cs (97%) rename v2rayN/{v2rayN => ServiceLib}/Handler/CoreConfig/CoreConfigSingbox.cs (99%) rename v2rayN/{v2rayN => ServiceLib}/Handler/CoreConfig/CoreConfigV2ray.cs (99%) rename v2rayN/{v2rayN => ServiceLib}/Handler/CoreHandler.cs (98%) rename v2rayN/{v2rayN => ServiceLib}/Handler/CoreInfoHandler.cs (99%) rename v2rayN/{v2rayN => ServiceLib}/Handler/DownloadHandler.cs (98%) rename v2rayN/{v2rayN => ServiceLib}/Handler/Fmt/BaseFmt.cs (98%) rename v2rayN/{v2rayN => ServiceLib}/Handler/Fmt/ClashFmt.cs (83%) rename v2rayN/{v2rayN => ServiceLib}/Handler/Fmt/FmtHandler.cs (96%) rename v2rayN/{v2rayN => ServiceLib}/Handler/Fmt/Hysteria2Fmt.cs (96%) rename v2rayN/{v2rayN => ServiceLib}/Handler/Fmt/NaiveproxyFmt.cs (83%) rename v2rayN/{v2rayN => ServiceLib}/Handler/Fmt/ShadowsocksFmt.cs (97%) rename v2rayN/{v2rayN => ServiceLib}/Handler/Fmt/SingboxFmt.cs (94%) rename v2rayN/{v2rayN => ServiceLib}/Handler/Fmt/SocksFmt.cs (96%) rename v2rayN/{v2rayN => ServiceLib}/Handler/Fmt/TrojanFmt.cs (91%) rename v2rayN/{v2rayN => ServiceLib}/Handler/Fmt/TuicFmt.cs (93%) rename v2rayN/{v2rayN => ServiceLib}/Handler/Fmt/V2rayFmt.cs (94%) rename v2rayN/{v2rayN => ServiceLib}/Handler/Fmt/VLESSFmt.cs (93%) rename v2rayN/{v2rayN => ServiceLib}/Handler/Fmt/VmessFmt.cs (96%) rename v2rayN/{v2rayN => ServiceLib}/Handler/Fmt/WireguardFmt.cs (94%) rename v2rayN/{v2rayN => ServiceLib}/Handler/LazyConfig.cs (98%) rename v2rayN/{v2rayN => ServiceLib}/Handler/ProfileExHandler.cs (97%) rename v2rayN/{v2rayN => ServiceLib}/Handler/SpeedtestHandler.cs (92%) rename v2rayN/{v2rayN => ServiceLib}/Handler/Statistics/StatisticsHandler.cs (97%) rename v2rayN/{v2rayN => ServiceLib}/Handler/Statistics/StatisticsSingbox.cs (97%) rename v2rayN/{v2rayN => ServiceLib}/Handler/Statistics/StatisticsV2ray.cs (97%) rename v2rayN/{v2rayN => ServiceLib}/Handler/TaskHandler.cs (97%) rename v2rayN/{v2rayN => ServiceLib}/Handler/UpdateHandler.cs (91%) rename v2rayN/{v2rayN => ServiceLib}/Models/ClashConnectionModel.cs (94%) rename v2rayN/{v2rayN => ServiceLib}/Models/ClashConnections.cs (97%) rename v2rayN/{v2rayN => ServiceLib}/Models/ClashProviders.cs (83%) rename v2rayN/{v2rayN => ServiceLib}/Models/ClashProxies.cs (95%) rename v2rayN/{v2rayN => ServiceLib}/Models/ClashProxyModel.cs (65%) rename v2rayN/{v2rayN => ServiceLib}/Models/ComboItem.cs (85%) rename v2rayN/{v2rayN => ServiceLib}/Models/Config.cs (97%) rename v2rayN/{v2rayN => ServiceLib}/Models/ConfigItems.cs (99%) rename v2rayN/{v2rayN => ServiceLib}/Models/CoreInfo.cs (92%) rename v2rayN/{v2rayN => ServiceLib}/Models/DNSItem.cs (92%) rename v2rayN/{v2rayN => ServiceLib}/Models/GitHubRelease.cs (98%) rename v2rayN/{v2rayN => ServiceLib}/Models/ProfileExItem.cs (90%) rename v2rayN/{v2rayN => ServiceLib}/Models/ProfileItem.cs (99%) rename v2rayN/{v2rayN => ServiceLib}/Models/ProfileItemModel.cs (94%) rename v2rayN/{v2rayN => ServiceLib}/Models/RoutingItem.cs (95%) rename v2rayN/{v2rayN => ServiceLib}/Models/RoutingItemModel.cs (80%) rename v2rayN/{v2rayN => ServiceLib}/Models/RulesItem.cs (95%) rename v2rayN/{v2rayN => ServiceLib}/Models/RulesItemModel.cs (89%) rename v2rayN/{v2rayN => ServiceLib}/Models/ServerSpeedItem.cs (94%) rename v2rayN/{v2rayN => ServiceLib}/Models/ServerStatItem.cs (95%) rename v2rayN/{v2rayN => ServiceLib}/Models/ServerTestItem.cs (78%) rename v2rayN/{v2rayN => ServiceLib}/Models/SingboxConfig.cs (99%) rename v2rayN/{v2rayN => ServiceLib}/Models/SpeedTestResult.cs (86%) rename v2rayN/{v2rayN => ServiceLib}/Models/SsSIP008.cs (93%) rename v2rayN/{v2rayN => ServiceLib}/Models/SubItem.cs (96%) rename v2rayN/{v2rayN => ServiceLib}/Models/SysProxyConfig.cs (86%) rename v2rayN/{v2rayN => ServiceLib}/Models/V2rayConfig.cs (99%) rename v2rayN/{v2rayN => ServiceLib}/Models/V2rayTcpRequest.cs (92%) rename v2rayN/{v2rayN => ServiceLib}/Models/VmessQRCode.cs (95%) rename v2rayN/{v2rayN => ServiceLib}/Resx/ResUI.Designer.cs (99%) rename v2rayN/{v2rayN => ServiceLib}/Resx/ResUI.fa-Ir.resx (100%) rename v2rayN/{v2rayN => ServiceLib}/Resx/ResUI.resx (100%) rename v2rayN/{v2rayN => ServiceLib}/Resx/ResUI.ru.resx (100%) rename v2rayN/{v2rayN => ServiceLib}/Resx/ResUI.zh-Hans.resx (100%) rename v2rayN/{v2rayN => ServiceLib}/Resx/ResUI.zh-Hant.resx (100%) rename v2rayN/{v2rayN => ServiceLib}/Sample/SampleClientConfig (100%) rename v2rayN/{v2rayN => ServiceLib}/Sample/SampleHttpRequest (100%) rename v2rayN/{v2rayN => ServiceLib}/Sample/SampleHttpResponse (100%) rename v2rayN/{v2rayN => ServiceLib}/Sample/SampleInbound (100%) rename v2rayN/{v2rayN => ServiceLib}/Sample/SampleOutbound (100%) rename v2rayN/{v2rayN => ServiceLib}/Sample/SingboxSampleClientConfig (100%) rename v2rayN/{v2rayN => ServiceLib}/Sample/SingboxSampleOutbound (100%) rename v2rayN/{v2rayN => ServiceLib}/Sample/clash_mixin_yaml (100%) rename v2rayN/{v2rayN => ServiceLib}/Sample/clash_tun_yaml (100%) rename v2rayN/{v2rayN => ServiceLib}/Sample/custom_routing_black (100%) rename v2rayN/{v2rayN => ServiceLib}/Sample/custom_routing_global (100%) rename v2rayN/{v2rayN => ServiceLib}/Sample/custom_routing_locked (100%) rename v2rayN/{v2rayN => ServiceLib}/Sample/custom_routing_rules (100%) rename v2rayN/{v2rayN => ServiceLib}/Sample/custom_routing_white (100%) rename v2rayN/{v2rayN => ServiceLib}/Sample/dns_singbox_normal (100%) rename v2rayN/{v2rayN => ServiceLib}/Sample/dns_v2ray_normal (100%) rename v2rayN/{v2rayN => ServiceLib}/Sample/tun_singbox_dns (100%) rename v2rayN/{v2rayN => ServiceLib}/Sample/tun_singbox_inbound (100%) rename v2rayN/{v2rayN => ServiceLib}/Sample/tun_singbox_rules (100%) create mode 100644 v2rayN/ServiceLib/ServiceLib.csproj create mode 100644 v2rayN/v2rayN/GlobalUsings.cs diff --git a/v2rayN/v2rayN/Common/DownloaderHelper.cs b/v2rayN/ServiceLib/Common/DownloaderHelper.cs similarity index 98% rename from v2rayN/v2rayN/Common/DownloaderHelper.cs rename to v2rayN/ServiceLib/Common/DownloaderHelper.cs index ddfe3811606..b41640392db 100644 --- a/v2rayN/v2rayN/Common/DownloaderHelper.cs +++ b/v2rayN/ServiceLib/Common/DownloaderHelper.cs @@ -1,10 +1,9 @@ using Downloader; -using System.IO; using System.Net; -namespace v2rayN +namespace ServiceLib.Common { - internal class DownloaderHelper + public class DownloaderHelper { private static readonly Lazy _instance = new(() => new()); public static DownloaderHelper Instance => _instance.Value; diff --git a/v2rayN/v2rayN/Common/FileManager.cs b/v2rayN/ServiceLib/Common/FileManager.cs similarity index 84% rename from v2rayN/v2rayN/Common/FileManager.cs rename to v2rayN/ServiceLib/Common/FileManager.cs index b721f5dbb39..39cfeb59e86 100644 --- a/v2rayN/v2rayN/Common/FileManager.cs +++ b/v2rayN/ServiceLib/Common/FileManager.cs @@ -1,8 +1,7 @@ -using System.IO; -using System.IO.Compression; +using System.IO.Compression; using System.Text; -namespace v2rayN +namespace ServiceLib.Common { public static class FileManager { @@ -86,5 +85,19 @@ public static bool ZipExtractToFile(string fileName, string toPath, string ignor } return true; } + + public static bool CreateFromDirectory(string sourceDirectoryName, string destinationArchiveFileName) + { + try + { + ZipFile.CreateFromDirectory(sourceDirectoryName, destinationArchiveFileName); + } + catch (Exception ex) + { + Logging.SaveLog(ex.Message, ex); + return false; + } + return true; + } } } \ No newline at end of file diff --git a/v2rayN/v2rayN/Common/HttpClientHelper.cs b/v2rayN/ServiceLib/Common/HttpClientHelper.cs similarity index 98% rename from v2rayN/v2rayN/Common/HttpClientHelper.cs rename to v2rayN/ServiceLib/Common/HttpClientHelper.cs index 60f9ad2b73e..dd730dbff3c 100644 --- a/v2rayN/v2rayN/Common/HttpClientHelper.cs +++ b/v2rayN/ServiceLib/Common/HttpClientHelper.cs @@ -1,10 +1,8 @@ -using System.IO; -using System.Net.Http; -using System.Net.Http.Headers; +using System.Net.Http.Headers; using System.Net.Mime; using System.Text; -namespace v2rayN +namespace ServiceLib.Common { /// /// diff --git a/v2rayN/v2rayN/Common/Job.cs b/v2rayN/ServiceLib/Common/Job.cs similarity index 99% rename from v2rayN/v2rayN/Common/Job.cs rename to v2rayN/ServiceLib/Common/Job.cs index c25a2221074..0cd623fbb2c 100644 --- a/v2rayN/v2rayN/Common/Job.cs +++ b/v2rayN/ServiceLib/Common/Job.cs @@ -1,7 +1,7 @@ using System.Diagnostics; using System.Runtime.InteropServices; -namespace v2rayN +namespace ServiceLib.Common { /* * See: diff --git a/v2rayN/v2rayN/Common/JsonUtils.cs b/v2rayN/ServiceLib/Common/JsonUtils.cs similarity index 97% rename from v2rayN/v2rayN/Common/JsonUtils.cs rename to v2rayN/ServiceLib/Common/JsonUtils.cs index ab81d41efad..d7650d2c5a8 100644 --- a/v2rayN/v2rayN/Common/JsonUtils.cs +++ b/v2rayN/ServiceLib/Common/JsonUtils.cs @@ -1,11 +1,10 @@ -using System.IO; -using System.Text.Json; +using System.Text.Json; using System.Text.Json.Nodes; using System.Text.Json.Serialization; -namespace v2rayN +namespace ServiceLib.Common { - internal class JsonUtils + public class JsonUtils { /// /// DeepCopy diff --git a/v2rayN/v2rayN/Common/Logging.cs b/v2rayN/ServiceLib/Common/Logging.cs similarity index 98% rename from v2rayN/v2rayN/Common/Logging.cs rename to v2rayN/ServiceLib/Common/Logging.cs index ba5b97e7e25..c212fd17c34 100644 --- a/v2rayN/v2rayN/Common/Logging.cs +++ b/v2rayN/ServiceLib/Common/Logging.cs @@ -1,9 +1,8 @@ using NLog; using NLog.Config; using NLog.Targets; -using System.IO; -namespace v2rayN +namespace ServiceLib.Common { public class Logging { diff --git a/v2rayN/v2rayN/Common/QueryableExtension.cs b/v2rayN/ServiceLib/Common/QueryableExtension.cs similarity index 98% rename from v2rayN/v2rayN/Common/QueryableExtension.cs rename to v2rayN/ServiceLib/Common/QueryableExtension.cs index 113f2824570..767676566d2 100644 --- a/v2rayN/v2rayN/Common/QueryableExtension.cs +++ b/v2rayN/ServiceLib/Common/QueryableExtension.cs @@ -1,7 +1,7 @@ using System.Linq.Expressions; using System.Reflection; -namespace v2rayN +namespace ServiceLib.Common { public static class QueryableExtension { diff --git a/v2rayN/v2rayN/Common/SemanticVersion.cs b/v2rayN/ServiceLib/Common/SemanticVersion.cs similarity index 99% rename from v2rayN/v2rayN/Common/SemanticVersion.cs rename to v2rayN/ServiceLib/Common/SemanticVersion.cs index 597ed970de7..ec4c4931c05 100644 --- a/v2rayN/v2rayN/Common/SemanticVersion.cs +++ b/v2rayN/ServiceLib/Common/SemanticVersion.cs @@ -1,4 +1,4 @@ -namespace v2rayN +namespace ServiceLib.Common { public class SemanticVersion { diff --git a/v2rayN/v2rayN/Common/SqliteHelper.cs b/v2rayN/ServiceLib/Common/SqliteHelper.cs similarity index 99% rename from v2rayN/v2rayN/Common/SqliteHelper.cs rename to v2rayN/ServiceLib/Common/SqliteHelper.cs index 70beb81074c..9faa72baeb4 100644 --- a/v2rayN/v2rayN/Common/SqliteHelper.cs +++ b/v2rayN/ServiceLib/Common/SqliteHelper.cs @@ -1,7 +1,7 @@ using SQLite; using System.Collections; -namespace v2rayN +namespace ServiceLib.Common { public sealed class SQLiteHelper { diff --git a/v2rayN/v2rayN/Common/StringEx.cs b/v2rayN/ServiceLib/Common/StringEx.cs similarity index 97% rename from v2rayN/v2rayN/Common/StringEx.cs rename to v2rayN/ServiceLib/Common/StringEx.cs index 9a751ce9db0..008af348644 100644 --- a/v2rayN/v2rayN/Common/StringEx.cs +++ b/v2rayN/ServiceLib/Common/StringEx.cs @@ -1,9 +1,8 @@ using System.Diagnostics.CodeAnalysis; -using System.IO; -namespace v2rayN +namespace ServiceLib.Common { - internal static class StringEx + public static class StringEx { public static bool IsNullOrEmpty([NotNullWhen(false)] this string? value) { diff --git a/v2rayN/v2rayN/Common/Utils.cs b/v2rayN/ServiceLib/Common/Utils.cs similarity index 99% rename from v2rayN/v2rayN/Common/Utils.cs rename to v2rayN/ServiceLib/Common/Utils.cs index c4fb551ea7c..77587642b4a 100644 --- a/v2rayN/v2rayN/Common/Utils.cs +++ b/v2rayN/ServiceLib/Common/Utils.cs @@ -1,6 +1,5 @@ using System.Collections.Specialized; using System.Diagnostics; -using System.IO; using System.IO.Compression; using System.Net; using System.Net.NetworkInformation; @@ -10,9 +9,9 @@ using System.Text; using System.Text.RegularExpressions; -namespace v2rayN +namespace ServiceLib.Common { - internal class Utils + public class Utils { #region 资源Json操作 diff --git a/v2rayN/v2rayN/Common/YamlUtils.cs b/v2rayN/ServiceLib/Common/YamlUtils.cs similarity index 96% rename from v2rayN/v2rayN/Common/YamlUtils.cs rename to v2rayN/ServiceLib/Common/YamlUtils.cs index 3a4f9387381..7fd4c67e8c2 100644 --- a/v2rayN/v2rayN/Common/YamlUtils.cs +++ b/v2rayN/ServiceLib/Common/YamlUtils.cs @@ -1,9 +1,9 @@ using YamlDotNet.Serialization; using YamlDotNet.Serialization.NamingConventions; -namespace v2rayN.Common +namespace ServiceLib.Common { - internal class YamlUtils + public class YamlUtils { #region YAML diff --git a/v2rayN/v2rayN/Enums/EConfigType.cs b/v2rayN/ServiceLib/Enums/EConfigType.cs similarity index 89% rename from v2rayN/v2rayN/Enums/EConfigType.cs rename to v2rayN/ServiceLib/Enums/EConfigType.cs index 60ef796a430..b7005e4a53f 100644 --- a/v2rayN/v2rayN/Enums/EConfigType.cs +++ b/v2rayN/ServiceLib/Enums/EConfigType.cs @@ -1,4 +1,4 @@ -namespace v2rayN.Enums +namespace ServiceLib.Enums { public enum EConfigType { diff --git a/v2rayN/v2rayN/Enums/ECoreType.cs b/v2rayN/ServiceLib/Enums/ECoreType.cs similarity index 91% rename from v2rayN/v2rayN/Enums/ECoreType.cs rename to v2rayN/ServiceLib/Enums/ECoreType.cs index 54c078870f0..cfaffb9f433 100644 --- a/v2rayN/v2rayN/Enums/ECoreType.cs +++ b/v2rayN/ServiceLib/Enums/ECoreType.cs @@ -1,4 +1,4 @@ -namespace v2rayN.Enums +namespace ServiceLib.Enums { public enum ECoreType { diff --git a/v2rayN/v2rayN/Enums/EGirdOrientation.cs b/v2rayN/ServiceLib/Enums/EGirdOrientation.cs similarity index 76% rename from v2rayN/v2rayN/Enums/EGirdOrientation.cs rename to v2rayN/ServiceLib/Enums/EGirdOrientation.cs index e7f9749f4a6..1a62c7bbaf7 100644 --- a/v2rayN/v2rayN/Enums/EGirdOrientation.cs +++ b/v2rayN/ServiceLib/Enums/EGirdOrientation.cs @@ -1,4 +1,4 @@ -namespace v2rayN.Enums +namespace ServiceLib.Enums { public enum EGirdOrientation { diff --git a/v2rayN/v2rayN/Enums/EGlobalHotkey.cs b/v2rayN/ServiceLib/Enums/EGlobalHotkey.cs similarity index 86% rename from v2rayN/v2rayN/Enums/EGlobalHotkey.cs rename to v2rayN/ServiceLib/Enums/EGlobalHotkey.cs index f4a92bdba83..328bf36edc5 100644 --- a/v2rayN/v2rayN/Enums/EGlobalHotkey.cs +++ b/v2rayN/ServiceLib/Enums/EGlobalHotkey.cs @@ -1,4 +1,4 @@ -namespace v2rayN.Enums +namespace ServiceLib.Enums { public enum EGlobalHotkey { diff --git a/v2rayN/v2rayN/Enums/EInboundProtocol.cs b/v2rayN/ServiceLib/Enums/EInboundProtocol.cs similarity index 85% rename from v2rayN/v2rayN/Enums/EInboundProtocol.cs rename to v2rayN/ServiceLib/Enums/EInboundProtocol.cs index 07cd13698f8..c1ff81ea266 100644 --- a/v2rayN/v2rayN/Enums/EInboundProtocol.cs +++ b/v2rayN/ServiceLib/Enums/EInboundProtocol.cs @@ -1,4 +1,4 @@ -namespace v2rayN.Enums +namespace ServiceLib.Enums { public enum EInboundProtocol { diff --git a/v2rayN/v2rayN/Enums/EMove.cs b/v2rayN/ServiceLib/Enums/EMove.cs similarity index 81% rename from v2rayN/v2rayN/Enums/EMove.cs rename to v2rayN/ServiceLib/Enums/EMove.cs index fcbc23dccd0..ced5a4e6117 100644 --- a/v2rayN/v2rayN/Enums/EMove.cs +++ b/v2rayN/ServiceLib/Enums/EMove.cs @@ -1,4 +1,4 @@ -namespace v2rayN.Enums +namespace ServiceLib.Enums { public enum EMove { diff --git a/v2rayN/v2rayN/Enums/ERuleMode.cs b/v2rayN/ServiceLib/Enums/ERuleMode.cs similarity index 80% rename from v2rayN/v2rayN/Enums/ERuleMode.cs rename to v2rayN/ServiceLib/Enums/ERuleMode.cs index 59a014301a8..179384d5dec 100644 --- a/v2rayN/v2rayN/Enums/ERuleMode.cs +++ b/v2rayN/ServiceLib/Enums/ERuleMode.cs @@ -1,4 +1,4 @@ -namespace v2rayN.Enums +namespace ServiceLib.Enums { public enum ERuleMode { diff --git a/v2rayN/v2rayN/Enums/EServerColName.cs b/v2rayN/ServiceLib/Enums/EServerColName.cs similarity index 90% rename from v2rayN/v2rayN/Enums/EServerColName.cs rename to v2rayN/ServiceLib/Enums/EServerColName.cs index 453dbe881ad..448f4cdc94f 100644 --- a/v2rayN/v2rayN/Enums/EServerColName.cs +++ b/v2rayN/ServiceLib/Enums/EServerColName.cs @@ -1,4 +1,4 @@ -namespace v2rayN.Enums +namespace ServiceLib.Enums { public enum EServerColName { diff --git a/v2rayN/v2rayN/Enums/ESpeedActionType.cs b/v2rayN/ServiceLib/Enums/ESpeedActionType.cs similarity index 79% rename from v2rayN/v2rayN/Enums/ESpeedActionType.cs rename to v2rayN/ServiceLib/Enums/ESpeedActionType.cs index e0663d92d62..63f1391942b 100644 --- a/v2rayN/v2rayN/Enums/ESpeedActionType.cs +++ b/v2rayN/ServiceLib/Enums/ESpeedActionType.cs @@ -1,4 +1,4 @@ -namespace v2rayN.Enums +namespace ServiceLib.Enums { public enum ESpeedActionType { diff --git a/v2rayN/v2rayN/Enums/ESysProxyType.cs b/v2rayN/ServiceLib/Enums/ESysProxyType.cs similarity index 81% rename from v2rayN/v2rayN/Enums/ESysProxyType.cs rename to v2rayN/ServiceLib/Enums/ESysProxyType.cs index b08576122c8..84beaffec60 100644 --- a/v2rayN/v2rayN/Enums/ESysProxyType.cs +++ b/v2rayN/ServiceLib/Enums/ESysProxyType.cs @@ -1,4 +1,4 @@ -namespace v2rayN.Enums +namespace ServiceLib.Enums { public enum ESysProxyType { diff --git a/v2rayN/v2rayN/Enums/ETransport.cs b/v2rayN/ServiceLib/Enums/ETransport.cs similarity index 85% rename from v2rayN/v2rayN/Enums/ETransport.cs rename to v2rayN/ServiceLib/Enums/ETransport.cs index 349d68e7293..f313db9cf66 100644 --- a/v2rayN/v2rayN/Enums/ETransport.cs +++ b/v2rayN/ServiceLib/Enums/ETransport.cs @@ -1,4 +1,4 @@ -namespace v2rayN.Enums +namespace ServiceLib.Enums { public enum ETransport { diff --git a/v2rayN/v2rayN/Enums/EViewAction.cs b/v2rayN/ServiceLib/Enums/EViewAction.cs similarity index 96% rename from v2rayN/v2rayN/Enums/EViewAction.cs rename to v2rayN/ServiceLib/Enums/EViewAction.cs index b90682a1504..3331ceadc41 100644 --- a/v2rayN/v2rayN/Enums/EViewAction.cs +++ b/v2rayN/ServiceLib/Enums/EViewAction.cs @@ -1,4 +1,4 @@ -namespace v2rayN.Enums +namespace ServiceLib.Enums { public enum EViewAction { diff --git a/v2rayN/v2rayN/Global.cs b/v2rayN/ServiceLib/Global.cs similarity index 90% rename from v2rayN/v2rayN/Global.cs rename to v2rayN/ServiceLib/Global.cs index ed548b81ff3..44720c71f91 100644 --- a/v2rayN/v2rayN/Global.cs +++ b/v2rayN/ServiceLib/Global.cs @@ -1,8 +1,6 @@ -using v2rayN.Enums; - -namespace v2rayN +namespace ServiceLib { - internal class Global + public class Global { #region const @@ -32,21 +30,21 @@ internal class Global public const string CoreSpeedtestConfigFileName = "configSpeedtest.json"; public const string CoreMultipleLoadConfigFileName = "configMultipleLoad.json"; public const string ClashMixinConfigFileName = "Mixin.yaml"; - public const string V2raySampleClient = "v2rayN.Sample.SampleClientConfig"; - public const string SingboxSampleClient = "v2rayN.Sample.SingboxSampleClientConfig"; - public const string V2raySampleHttpRequestFileName = "v2rayN.Sample.SampleHttpRequest"; - public const string V2raySampleHttpResponseFileName = "v2rayN.Sample.SampleHttpResponse"; - public const string V2raySampleInbound = "v2rayN.Sample.SampleInbound"; - public const string V2raySampleOutbound = "v2rayN.Sample.SampleOutbound"; - public const string SingboxSampleOutbound = "v2rayN.Sample.SingboxSampleOutbound"; - public const string CustomRoutingFileName = "v2rayN.Sample.custom_routing_"; - public const string TunSingboxDNSFileName = "v2rayN.Sample.tun_singbox_dns"; - public const string TunSingboxInboundFileName = "v2rayN.Sample.tun_singbox_inbound"; - public const string TunSingboxRulesFileName = "v2rayN.Sample.tun_singbox_rules"; - public const string DNSV2rayNormalFileName = "v2rayN.Sample.dns_v2ray_normal"; - public const string DNSSingboxNormalFileName = "v2rayN.Sample.dns_singbox_normal"; - public const string ClashMixinYaml = "v2rayN.Sample.clash_mixin_yaml"; - public const string ClashTunYaml = "v2rayN.Sample.clash_tun_yaml"; + public const string V2raySampleClient = "ServiceLib.Sample.SampleClientConfig"; + public const string SingboxSampleClient = "ServiceLib.Sample.SingboxSampleClientConfig"; + public const string V2raySampleHttpRequestFileName = "ServiceLib.Sample.SampleHttpRequest"; + public const string V2raySampleHttpResponseFileName = "ServiceLib.Sample.SampleHttpResponse"; + public const string V2raySampleInbound = "ServiceLib.Sample.SampleInbound"; + public const string V2raySampleOutbound = "ServiceLib.Sample.SampleOutbound"; + public const string SingboxSampleOutbound = "ServiceLib.Sample.SingboxSampleOutbound"; + public const string CustomRoutingFileName = "ServiceLib.Sample.custom_routing_"; + public const string TunSingboxDNSFileName = "ServiceLib.Sample.tun_singbox_dns"; + public const string TunSingboxInboundFileName = "ServiceLib.Sample.tun_singbox_inbound"; + public const string TunSingboxRulesFileName = "ServiceLib.Sample.tun_singbox_rules"; + public const string DNSV2rayNormalFileName = "ServiceLib.Sample.dns_v2ray_normal"; + public const string DNSSingboxNormalFileName = "ServiceLib.Sample.dns_singbox_normal"; + public const string ClashMixinYaml = "ServiceLib.Sample.clash_mixin_yaml"; + public const string ClashTunYaml = "ServiceLib.Sample.clash_tun_yaml"; public const string DefaultSecurity = "auto"; public const string DefaultNetwork = "tcp"; diff --git a/v2rayN/ServiceLib/GlobalUsings.cs b/v2rayN/ServiceLib/GlobalUsings.cs new file mode 100644 index 00000000000..5470f5eb37a --- /dev/null +++ b/v2rayN/ServiceLib/GlobalUsings.cs @@ -0,0 +1,7 @@ +global using ServiceLib.Common; +global using ServiceLib.Enums; +global using ServiceLib.Handler.CoreConfig; +global using ServiceLib.Handler.Fmt; +global using ServiceLib.Handler.Statistics; +global using ServiceLib.Models; +global using ServiceLib.Resx; \ No newline at end of file diff --git a/v2rayN/v2rayN/Handler/ClashApiHandler.cs b/v2rayN/ServiceLib/Handler/ClashApiHandler.cs similarity index 98% rename from v2rayN/v2rayN/Handler/ClashApiHandler.cs rename to v2rayN/ServiceLib/Handler/ClashApiHandler.cs index b749e2cd1b2..a85b4b5cd49 100644 --- a/v2rayN/v2rayN/Handler/ClashApiHandler.cs +++ b/v2rayN/ServiceLib/Handler/ClashApiHandler.cs @@ -1,7 +1,6 @@ -using v2rayN.Models; -using static v2rayN.Models.ClashProxies; +using static ServiceLib.Models.ClashProxies; -namespace v2rayN.Handler +namespace ServiceLib.Handler { public sealed class ClashApiHandler { diff --git a/v2rayN/v2rayN/Handler/ConfigHandler.cs b/v2rayN/ServiceLib/Handler/ConfigHandler.cs similarity index 99% rename from v2rayN/v2rayN/Handler/ConfigHandler.cs rename to v2rayN/ServiceLib/Handler/ConfigHandler.cs index 8e8c08532d7..0d1d96cada9 100644 --- a/v2rayN/v2rayN/Handler/ConfigHandler.cs +++ b/v2rayN/ServiceLib/Handler/ConfigHandler.cs @@ -1,18 +1,13 @@ using System.Data; -using System.IO; using System.Text.RegularExpressions; using System.Web; -using v2rayN.Enums; -using v2rayN.Handler.CoreConfig; -using v2rayN.Handler.Fmt; -using v2rayN.Models; -namespace v2rayN.Handler +namespace ServiceLib.Handler { /// /// 本软件配置文件处理类 /// - internal class ConfigHandler + public class ConfigHandler { private static string configRes = Global.ConfigFileName; private static readonly object objLock = new(); @@ -1156,7 +1151,7 @@ public static int AddCustomServer4Multiple(Config config, List sele var profileItem = LazyConfig.Instance.GetProfileItem(indexId) ?? new(); profileItem.indexId = indexId; - profileItem.remarks = coreType == ECoreType.sing_box ? Resx.ResUI.menuSetDefaultMultipleServer : Resx.ResUI.menuSetDefaultLoadBalanceServer; + profileItem.remarks = coreType == ECoreType.sing_box ? ResUI.menuSetDefaultMultipleServer : ResUI.menuSetDefaultLoadBalanceServer; profileItem.address = Global.CoreMultipleLoadConfigFileName; profileItem.configType = EConfigType.Custom; profileItem.coreType = coreType; diff --git a/v2rayN/v2rayN/Handler/CoreConfig/CoreConfigClash.cs b/v2rayN/ServiceLib/Handler/CoreConfig/CoreConfigClash.cs similarity index 97% rename from v2rayN/v2rayN/Handler/CoreConfig/CoreConfigClash.cs rename to v2rayN/ServiceLib/Handler/CoreConfig/CoreConfigClash.cs index b29a571a6e5..878e7d7c488 100644 --- a/v2rayN/v2rayN/Handler/CoreConfig/CoreConfigClash.cs +++ b/v2rayN/ServiceLib/Handler/CoreConfig/CoreConfigClash.cs @@ -1,15 +1,9 @@ -using System.IO; -using v2rayN.Common; -using v2rayN.Enums; -using v2rayN.Models; -using v2rayN.Resx; - -namespace v2rayN.Handler.CoreConfig +namespace ServiceLib.Handler.CoreConfig { /// /// Core configuration file processing class /// - internal class CoreConfigClash + public class CoreConfigClash { private Config _config; diff --git a/v2rayN/v2rayN/Handler/CoreConfig/CoreConfigHandler.cs b/v2rayN/ServiceLib/Handler/CoreConfig/CoreConfigHandler.cs similarity index 97% rename from v2rayN/v2rayN/Handler/CoreConfig/CoreConfigHandler.cs rename to v2rayN/ServiceLib/Handler/CoreConfig/CoreConfigHandler.cs index b8aa4b4092c..21162aad3d0 100644 --- a/v2rayN/v2rayN/Handler/CoreConfig/CoreConfigHandler.cs +++ b/v2rayN/ServiceLib/Handler/CoreConfig/CoreConfigHandler.cs @@ -1,14 +1,9 @@ -using System.IO; -using v2rayN.Enums; -using v2rayN.Models; -using v2rayN.Resx; - -namespace v2rayN.Handler.CoreConfig +namespace ServiceLib.Handler.CoreConfig { /// /// Core configuration file processing class /// - internal class CoreConfigHandler + public class CoreConfigHandler { public static int GenerateClientConfig(ProfileItem node, string? fileName, out string msg, out string content) { diff --git a/v2rayN/v2rayN/Handler/CoreConfig/CoreConfigSingbox.cs b/v2rayN/ServiceLib/Handler/CoreConfig/CoreConfigSingbox.cs similarity index 99% rename from v2rayN/v2rayN/Handler/CoreConfig/CoreConfigSingbox.cs rename to v2rayN/ServiceLib/Handler/CoreConfig/CoreConfigSingbox.cs index baa384c9814..ba6fc69d00e 100644 --- a/v2rayN/v2rayN/Handler/CoreConfig/CoreConfigSingbox.cs +++ b/v2rayN/ServiceLib/Handler/CoreConfig/CoreConfigSingbox.cs @@ -1,14 +1,10 @@ using System.Data; -using System.IO; using System.Net; using System.Net.NetworkInformation; -using v2rayN.Enums; -using v2rayN.Models; -using v2rayN.Resx; -namespace v2rayN.Handler.CoreConfig +namespace ServiceLib.Handler.CoreConfig { - internal class CoreConfigSingbox + public class CoreConfigSingbox { private Config _config; diff --git a/v2rayN/v2rayN/Handler/CoreConfig/CoreConfigV2ray.cs b/v2rayN/ServiceLib/Handler/CoreConfig/CoreConfigV2ray.cs similarity index 99% rename from v2rayN/v2rayN/Handler/CoreConfig/CoreConfigV2ray.cs rename to v2rayN/ServiceLib/Handler/CoreConfig/CoreConfigV2ray.cs index 7a9a578f6b3..9e092ae336e 100644 --- a/v2rayN/v2rayN/Handler/CoreConfig/CoreConfigV2ray.cs +++ b/v2rayN/ServiceLib/Handler/CoreConfig/CoreConfigV2ray.cs @@ -1,13 +1,10 @@ using System.Net; using System.Net.NetworkInformation; using System.Text.Json.Nodes; -using v2rayN.Enums; -using v2rayN.Models; -using v2rayN.Resx; -namespace v2rayN.Handler.CoreConfig +namespace ServiceLib.Handler.CoreConfig { - internal class CoreConfigV2ray + public class CoreConfigV2ray { private Config _config; diff --git a/v2rayN/v2rayN/Handler/CoreHandler.cs b/v2rayN/ServiceLib/Handler/CoreHandler.cs similarity index 98% rename from v2rayN/v2rayN/Handler/CoreHandler.cs rename to v2rayN/ServiceLib/Handler/CoreHandler.cs index 936521361b3..6eddc956d91 100644 --- a/v2rayN/v2rayN/Handler/CoreHandler.cs +++ b/v2rayN/ServiceLib/Handler/CoreHandler.cs @@ -1,17 +1,12 @@ using System.Diagnostics; -using System.IO; using System.Text; -using v2rayN.Enums; -using v2rayN.Handler.CoreConfig; -using v2rayN.Models; -using v2rayN.Resx; -namespace v2rayN.Handler +namespace ServiceLib.Handler { /// /// Core process processing class /// - internal class CoreHandler + public class CoreHandler { private Config _config; private Process? _process; diff --git a/v2rayN/v2rayN/Handler/CoreInfoHandler.cs b/v2rayN/ServiceLib/Handler/CoreInfoHandler.cs similarity index 99% rename from v2rayN/v2rayN/Handler/CoreInfoHandler.cs rename to v2rayN/ServiceLib/Handler/CoreInfoHandler.cs index e0b83c8b520..09e2d3212d0 100644 --- a/v2rayN/v2rayN/Handler/CoreInfoHandler.cs +++ b/v2rayN/ServiceLib/Handler/CoreInfoHandler.cs @@ -1,8 +1,6 @@ using System.Runtime.Intrinsics.X86; -using v2rayN.Enums; -using v2rayN.Models; -namespace v2rayN.Handler +namespace ServiceLib.Handler { public sealed class CoreInfoHandler { diff --git a/v2rayN/v2rayN/Handler/DownloadHandler.cs b/v2rayN/ServiceLib/Handler/DownloadHandler.cs similarity index 98% rename from v2rayN/v2rayN/Handler/DownloadHandler.cs rename to v2rayN/ServiceLib/Handler/DownloadHandler.cs index 99ba06a6b9f..1674232bb47 100644 --- a/v2rayN/v2rayN/Handler/DownloadHandler.cs +++ b/v2rayN/ServiceLib/Handler/DownloadHandler.cs @@ -1,18 +1,14 @@ using System.Diagnostics; -using System.IO; using System.Net; -using System.Net.Http; using System.Net.Http.Headers; using System.Net.Sockets; -using v2rayN.Enums; -using v2rayN.Resx; -namespace v2rayN.Handler +namespace ServiceLib.Handler { /// ///Download /// - internal class DownloadHandler + public class DownloadHandler { public event EventHandler? UpdateCompleted; diff --git a/v2rayN/v2rayN/Handler/Fmt/BaseFmt.cs b/v2rayN/ServiceLib/Handler/Fmt/BaseFmt.cs similarity index 98% rename from v2rayN/v2rayN/Handler/Fmt/BaseFmt.cs rename to v2rayN/ServiceLib/Handler/Fmt/BaseFmt.cs index e13eadc4a33..5205067bab2 100644 --- a/v2rayN/v2rayN/Handler/Fmt/BaseFmt.cs +++ b/v2rayN/ServiceLib/Handler/Fmt/BaseFmt.cs @@ -1,11 +1,8 @@ using System.Collections.Specialized; -using System.IO; -using v2rayN.Enums; -using v2rayN.Models; -namespace v2rayN.Handler.Fmt +namespace ServiceLib.Handler.Fmt { - internal class BaseFmt + public class BaseFmt { protected static string GetIpv6(string address) { diff --git a/v2rayN/v2rayN/Handler/Fmt/ClashFmt.cs b/v2rayN/ServiceLib/Handler/Fmt/ClashFmt.cs similarity index 83% rename from v2rayN/v2rayN/Handler/Fmt/ClashFmt.cs rename to v2rayN/ServiceLib/Handler/Fmt/ClashFmt.cs index 90d96749fcf..f68c247476e 100644 --- a/v2rayN/v2rayN/Handler/Fmt/ClashFmt.cs +++ b/v2rayN/ServiceLib/Handler/Fmt/ClashFmt.cs @@ -1,9 +1,6 @@ -using v2rayN.Enums; -using v2rayN.Models; - -namespace v2rayN.Handler.Fmt +namespace ServiceLib.Handler.Fmt { - internal class ClashFmt : BaseFmt + public class ClashFmt : BaseFmt { public static ProfileItem? ResolveFull(string strData, string? subRemarks) { diff --git a/v2rayN/v2rayN/Handler/Fmt/FmtHandler.cs b/v2rayN/ServiceLib/Handler/Fmt/FmtHandler.cs similarity index 96% rename from v2rayN/v2rayN/Handler/Fmt/FmtHandler.cs rename to v2rayN/ServiceLib/Handler/Fmt/FmtHandler.cs index af0cffe7d5a..03e9bf96dda 100644 --- a/v2rayN/v2rayN/Handler/Fmt/FmtHandler.cs +++ b/v2rayN/ServiceLib/Handler/Fmt/FmtHandler.cs @@ -1,10 +1,6 @@ -using v2rayN.Enums; -using v2rayN.Models; -using v2rayN.Resx; - -namespace v2rayN.Handler.Fmt +namespace ServiceLib.Handler.Fmt { - internal class FmtHandler + public class FmtHandler { public static string? GetShareUri(ProfileItem item) { diff --git a/v2rayN/v2rayN/Handler/Fmt/Hysteria2Fmt.cs b/v2rayN/ServiceLib/Handler/Fmt/Hysteria2Fmt.cs similarity index 96% rename from v2rayN/v2rayN/Handler/Fmt/Hysteria2Fmt.cs rename to v2rayN/ServiceLib/Handler/Fmt/Hysteria2Fmt.cs index f205861f1ec..145a907e804 100644 --- a/v2rayN/v2rayN/Handler/Fmt/Hysteria2Fmt.cs +++ b/v2rayN/ServiceLib/Handler/Fmt/Hysteria2Fmt.cs @@ -1,10 +1,6 @@ -using v2rayN.Enums; -using v2rayN.Models; -using v2rayN.Resx; - -namespace v2rayN.Handler.Fmt +namespace ServiceLib.Handler.Fmt { - internal class Hysteria2Fmt : BaseFmt + public class Hysteria2Fmt : BaseFmt { public static ProfileItem? Resolve(string str, out string msg) { diff --git a/v2rayN/v2rayN/Handler/Fmt/NaiveproxyFmt.cs b/v2rayN/ServiceLib/Handler/Fmt/NaiveproxyFmt.cs similarity index 83% rename from v2rayN/v2rayN/Handler/Fmt/NaiveproxyFmt.cs rename to v2rayN/ServiceLib/Handler/Fmt/NaiveproxyFmt.cs index 3e523170b27..325cf9b6fc4 100644 --- a/v2rayN/v2rayN/Handler/Fmt/NaiveproxyFmt.cs +++ b/v2rayN/ServiceLib/Handler/Fmt/NaiveproxyFmt.cs @@ -1,9 +1,6 @@ -using v2rayN.Enums; -using v2rayN.Models; - -namespace v2rayN.Handler.Fmt +namespace ServiceLib.Handler.Fmt { - internal class NaiveproxyFmt : BaseFmt + public class NaiveproxyFmt : BaseFmt { public static ProfileItem? ResolveFull(string strData, string? subRemarks) { diff --git a/v2rayN/v2rayN/Handler/Fmt/ShadowsocksFmt.cs b/v2rayN/ServiceLib/Handler/Fmt/ShadowsocksFmt.cs similarity index 97% rename from v2rayN/v2rayN/Handler/Fmt/ShadowsocksFmt.cs rename to v2rayN/ServiceLib/Handler/Fmt/ShadowsocksFmt.cs index 495f0d50dc5..98460640c0b 100644 --- a/v2rayN/v2rayN/Handler/Fmt/ShadowsocksFmt.cs +++ b/v2rayN/ServiceLib/Handler/Fmt/ShadowsocksFmt.cs @@ -1,11 +1,8 @@ using System.Text.RegularExpressions; -using v2rayN.Enums; -using v2rayN.Models; -using v2rayN.Resx; -namespace v2rayN.Handler.Fmt +namespace ServiceLib.Handler.Fmt { - internal class ShadowsocksFmt : BaseFmt + public class ShadowsocksFmt : BaseFmt { public static ProfileItem? Resolve(string str, out string msg) { diff --git a/v2rayN/v2rayN/Handler/Fmt/SingboxFmt.cs b/v2rayN/ServiceLib/Handler/Fmt/SingboxFmt.cs similarity index 94% rename from v2rayN/v2rayN/Handler/Fmt/SingboxFmt.cs rename to v2rayN/ServiceLib/Handler/Fmt/SingboxFmt.cs index c8221afeedb..c6d4ad78d9f 100644 --- a/v2rayN/v2rayN/Handler/Fmt/SingboxFmt.cs +++ b/v2rayN/ServiceLib/Handler/Fmt/SingboxFmt.cs @@ -1,9 +1,6 @@ -using v2rayN.Enums; -using v2rayN.Models; - -namespace v2rayN.Handler.Fmt +namespace ServiceLib.Handler.Fmt { - internal class SingboxFmt : BaseFmt + public class SingboxFmt : BaseFmt { public static List? ResolveFullArray(string strData, string? subRemarks) { diff --git a/v2rayN/v2rayN/Handler/Fmt/SocksFmt.cs b/v2rayN/ServiceLib/Handler/Fmt/SocksFmt.cs similarity index 96% rename from v2rayN/v2rayN/Handler/Fmt/SocksFmt.cs rename to v2rayN/ServiceLib/Handler/Fmt/SocksFmt.cs index ae99f3f8009..de5ef5c8662 100644 --- a/v2rayN/v2rayN/Handler/Fmt/SocksFmt.cs +++ b/v2rayN/ServiceLib/Handler/Fmt/SocksFmt.cs @@ -1,10 +1,6 @@ -using v2rayN.Enums; -using v2rayN.Models; -using v2rayN.Resx; - -namespace v2rayN.Handler.Fmt +namespace ServiceLib.Handler.Fmt { - internal class SocksFmt : BaseFmt + public class SocksFmt : BaseFmt { public static ProfileItem? Resolve(string str, out string msg) { diff --git a/v2rayN/v2rayN/Handler/Fmt/TrojanFmt.cs b/v2rayN/ServiceLib/Handler/Fmt/TrojanFmt.cs similarity index 91% rename from v2rayN/v2rayN/Handler/Fmt/TrojanFmt.cs rename to v2rayN/ServiceLib/Handler/Fmt/TrojanFmt.cs index 71f23805d85..d32e1f56b4c 100644 --- a/v2rayN/v2rayN/Handler/Fmt/TrojanFmt.cs +++ b/v2rayN/ServiceLib/Handler/Fmt/TrojanFmt.cs @@ -1,10 +1,6 @@ -using v2rayN.Enums; -using v2rayN.Models; -using v2rayN.Resx; - -namespace v2rayN.Handler.Fmt +namespace ServiceLib.Handler.Fmt { - internal class TrojanFmt : BaseFmt + public class TrojanFmt : BaseFmt { public static ProfileItem? Resolve(string str, out string msg) { diff --git a/v2rayN/v2rayN/Handler/Fmt/TuicFmt.cs b/v2rayN/ServiceLib/Handler/Fmt/TuicFmt.cs similarity index 93% rename from v2rayN/v2rayN/Handler/Fmt/TuicFmt.cs rename to v2rayN/ServiceLib/Handler/Fmt/TuicFmt.cs index f1c64cd9b21..2f473681f5c 100644 --- a/v2rayN/v2rayN/Handler/Fmt/TuicFmt.cs +++ b/v2rayN/ServiceLib/Handler/Fmt/TuicFmt.cs @@ -1,10 +1,6 @@ -using v2rayN.Enums; -using v2rayN.Models; -using v2rayN.Resx; - -namespace v2rayN.Handler.Fmt +namespace ServiceLib.Handler.Fmt { - internal class TuicFmt : BaseFmt + public class TuicFmt : BaseFmt { public static ProfileItem? Resolve(string str, out string msg) { diff --git a/v2rayN/v2rayN/Handler/Fmt/V2rayFmt.cs b/v2rayN/ServiceLib/Handler/Fmt/V2rayFmt.cs similarity index 94% rename from v2rayN/v2rayN/Handler/Fmt/V2rayFmt.cs rename to v2rayN/ServiceLib/Handler/Fmt/V2rayFmt.cs index ed34c9a29c0..770166e1d72 100644 --- a/v2rayN/v2rayN/Handler/Fmt/V2rayFmt.cs +++ b/v2rayN/ServiceLib/Handler/Fmt/V2rayFmt.cs @@ -1,9 +1,6 @@ -using v2rayN.Enums; -using v2rayN.Models; - -namespace v2rayN.Handler.Fmt +namespace ServiceLib.Handler.Fmt { - internal class V2rayFmt : BaseFmt + public class V2rayFmt : BaseFmt { public static List? ResolveFullArray(string strData, string? subRemarks) { diff --git a/v2rayN/v2rayN/Handler/Fmt/VLESSFmt.cs b/v2rayN/ServiceLib/Handler/Fmt/VLESSFmt.cs similarity index 93% rename from v2rayN/v2rayN/Handler/Fmt/VLESSFmt.cs rename to v2rayN/ServiceLib/Handler/Fmt/VLESSFmt.cs index b7451ca2dac..f4d3b570b40 100644 --- a/v2rayN/v2rayN/Handler/Fmt/VLESSFmt.cs +++ b/v2rayN/ServiceLib/Handler/Fmt/VLESSFmt.cs @@ -1,10 +1,6 @@ -using v2rayN.Enums; -using v2rayN.Models; -using v2rayN.Resx; - -namespace v2rayN.Handler.Fmt +namespace ServiceLib.Handler.Fmt { - internal class VLESSFmt : BaseFmt + public class VLESSFmt : BaseFmt { public static ProfileItem? Resolve(string str, out string msg) { diff --git a/v2rayN/v2rayN/Handler/Fmt/VmessFmt.cs b/v2rayN/ServiceLib/Handler/Fmt/VmessFmt.cs similarity index 96% rename from v2rayN/v2rayN/Handler/Fmt/VmessFmt.cs rename to v2rayN/ServiceLib/Handler/Fmt/VmessFmt.cs index 7a04d56c47b..340ec04c271 100644 --- a/v2rayN/v2rayN/Handler/Fmt/VmessFmt.cs +++ b/v2rayN/ServiceLib/Handler/Fmt/VmessFmt.cs @@ -1,10 +1,6 @@ -using v2rayN.Enums; -using v2rayN.Models; -using v2rayN.Resx; - -namespace v2rayN.Handler.Fmt +namespace ServiceLib.Handler.Fmt { - internal class VmessFmt : BaseFmt + public class VmessFmt : BaseFmt { public static ProfileItem? Resolve(string str, out string msg) { diff --git a/v2rayN/v2rayN/Handler/Fmt/WireguardFmt.cs b/v2rayN/ServiceLib/Handler/Fmt/WireguardFmt.cs similarity index 94% rename from v2rayN/v2rayN/Handler/Fmt/WireguardFmt.cs rename to v2rayN/ServiceLib/Handler/Fmt/WireguardFmt.cs index 08af7262ccd..571a38ab459 100644 --- a/v2rayN/v2rayN/Handler/Fmt/WireguardFmt.cs +++ b/v2rayN/ServiceLib/Handler/Fmt/WireguardFmt.cs @@ -1,10 +1,6 @@ -using v2rayN.Enums; -using v2rayN.Models; -using v2rayN.Resx; - -namespace v2rayN.Handler.Fmt +namespace ServiceLib.Handler.Fmt { - internal class WireguardFmt : BaseFmt + public class WireguardFmt : BaseFmt { public static ProfileItem? Resolve(string str, out string msg) { diff --git a/v2rayN/v2rayN/Handler/LazyConfig.cs b/v2rayN/ServiceLib/Handler/LazyConfig.cs similarity index 98% rename from v2rayN/v2rayN/Handler/LazyConfig.cs rename to v2rayN/ServiceLib/Handler/LazyConfig.cs index 3017466f0fc..a8fd5b97e06 100644 --- a/v2rayN/v2rayN/Handler/LazyConfig.cs +++ b/v2rayN/ServiceLib/Handler/LazyConfig.cs @@ -1,8 +1,4 @@ -using v2rayN.Enums; -using v2rayN.Handler.Statistics; -using v2rayN.Models; - -namespace v2rayN.Handler +namespace ServiceLib.Handler { public sealed class LazyConfig { diff --git a/v2rayN/v2rayN/Handler/ProfileExHandler.cs b/v2rayN/ServiceLib/Handler/ProfileExHandler.cs similarity index 97% rename from v2rayN/v2rayN/Handler/ProfileExHandler.cs rename to v2rayN/ServiceLib/Handler/ProfileExHandler.cs index 2d7fc9327dc..460692af955 100644 --- a/v2rayN/v2rayN/Handler/ProfileExHandler.cs +++ b/v2rayN/ServiceLib/Handler/ProfileExHandler.cs @@ -1,10 +1,10 @@ using System.Collections.Concurrent; -using System.Reactive.Linq; -using v2rayN.Models; -namespace v2rayN.Handler +//using System.Reactive.Linq; + +namespace ServiceLib.Handler { - internal class ProfileExHandler + public class ProfileExHandler { private static readonly Lazy _instance = new(() => new()); private ConcurrentBag _lstProfileEx = []; diff --git a/v2rayN/v2rayN/Handler/SpeedtestHandler.cs b/v2rayN/ServiceLib/Handler/SpeedtestHandler.cs similarity index 92% rename from v2rayN/v2rayN/Handler/SpeedtestHandler.cs rename to v2rayN/ServiceLib/Handler/SpeedtestHandler.cs index 3744417d9f9..07636cb181d 100644 --- a/v2rayN/v2rayN/Handler/SpeedtestHandler.cs +++ b/v2rayN/ServiceLib/Handler/SpeedtestHandler.cs @@ -1,25 +1,17 @@ -using ReactiveUI; -using System.Diagnostics; +using System.Diagnostics; using System.Net; using System.Net.Sockets; -using v2rayN.Enums; -using v2rayN.Models; -using v2rayN.Resx; -namespace v2rayN.Handler +namespace ServiceLib.Handler { - internal class SpeedtestHandler + public class SpeedtestHandler { private Config? _config; private CoreHandler _coreHandler; private List _selecteds; private ESpeedActionType _actionType; private Action _updateFunc; - - public SpeedtestHandler(Config config) - { - _config = config; - } + private bool _exitLoop = false; public SpeedtestHandler(Config config, CoreHandler coreHandler, List selecteds, ESpeedActionType actionType, Action update) { @@ -91,6 +83,12 @@ public SpeedtestHandler(Config config, CoreHandler coreHandler, List(Global.CommandStopSpeedTest) - .Subscribe(x => - { - if (!exitLoop) - { - UpdateFunc("", ResUI.SpeedtestingStop); - } - exitLoop = true; - }); - foreach (var it in _selecteds) { - if (exitLoop) + if (_exitLoop) { UpdateFunc(it.indexId, "", ResUI.SpeedtestingSkip); continue; @@ -288,20 +275,9 @@ private async Task RunSpeedTestMulti() DownloadHandler downloadHandle = new(); - var exitLoop = false; - MessageBus.Current.Listen(Global.CommandStopSpeedTest) - .Subscribe(x => - { - if (!exitLoop) - { - UpdateFunc("", ResUI.SpeedtestingStop); - } - exitLoop = true; - }); - foreach (var it in _selecteds) { - if (exitLoop) + if (_exitLoop) { UpdateFunc(it.indexId, "", ResUI.SpeedtestingSkip); continue; diff --git a/v2rayN/v2rayN/Handler/Statistics/StatisticsHandler.cs b/v2rayN/ServiceLib/Handler/Statistics/StatisticsHandler.cs similarity index 97% rename from v2rayN/v2rayN/Handler/Statistics/StatisticsHandler.cs rename to v2rayN/ServiceLib/Handler/Statistics/StatisticsHandler.cs index 3b789c755ea..6ca0d4f3ca8 100644 --- a/v2rayN/v2rayN/Handler/Statistics/StatisticsHandler.cs +++ b/v2rayN/ServiceLib/Handler/Statistics/StatisticsHandler.cs @@ -1,8 +1,6 @@ -using v2rayN.Models; - -namespace v2rayN.Handler.Statistics +namespace ServiceLib.Handler.Statistics { - internal class StatisticsHandler + public class StatisticsHandler { private static readonly Lazy instance = new(() => new()); public static StatisticsHandler Instance => instance.Value; diff --git a/v2rayN/v2rayN/Handler/Statistics/StatisticsSingbox.cs b/v2rayN/ServiceLib/Handler/Statistics/StatisticsSingbox.cs similarity index 97% rename from v2rayN/v2rayN/Handler/Statistics/StatisticsSingbox.cs rename to v2rayN/ServiceLib/Handler/Statistics/StatisticsSingbox.cs index e4860b16dd0..b4627cafec6 100644 --- a/v2rayN/v2rayN/Handler/Statistics/StatisticsSingbox.cs +++ b/v2rayN/ServiceLib/Handler/Statistics/StatisticsSingbox.cs @@ -1,11 +1,9 @@ using System.Net.WebSockets; using System.Text; -using v2rayN.Enums; -using v2rayN.Models; -namespace v2rayN.Handler.Statistics +namespace ServiceLib.Handler.Statistics { - internal class StatisticsSingbox + public class StatisticsSingbox { private Config _config; private bool _exitFlag; diff --git a/v2rayN/v2rayN/Handler/Statistics/StatisticsV2ray.cs b/v2rayN/ServiceLib/Handler/Statistics/StatisticsV2ray.cs similarity index 97% rename from v2rayN/v2rayN/Handler/Statistics/StatisticsV2ray.cs rename to v2rayN/ServiceLib/Handler/Statistics/StatisticsV2ray.cs index 331ccde1ded..55b15b30959 100644 --- a/v2rayN/v2rayN/Handler/Statistics/StatisticsV2ray.cs +++ b/v2rayN/ServiceLib/Handler/Statistics/StatisticsV2ray.cs @@ -1,12 +1,10 @@ using Grpc.Core; using Grpc.Net.Client; using ProtosLib.Statistics; -using v2rayN.Enums; -using v2rayN.Models; -namespace v2rayN.Handler.Statistics +namespace ServiceLib.Handler.Statistics { - internal class StatisticsV2ray + public class StatisticsV2ray { private Models.Config _config; private GrpcChannel? _channel; diff --git a/v2rayN/v2rayN/Handler/TaskHandler.cs b/v2rayN/ServiceLib/Handler/TaskHandler.cs similarity index 97% rename from v2rayN/v2rayN/Handler/TaskHandler.cs rename to v2rayN/ServiceLib/Handler/TaskHandler.cs index e7657ccd1b0..e7b9ad932d1 100644 --- a/v2rayN/v2rayN/Handler/TaskHandler.cs +++ b/v2rayN/ServiceLib/Handler/TaskHandler.cs @@ -1,8 +1,6 @@ -using v2rayN.Models; - -namespace v2rayN.Handler +namespace ServiceLib.Handler { - internal class TaskHandler + public class TaskHandler { private static readonly Lazy _instance = new(() => new()); public static TaskHandler Instance => _instance.Value; diff --git a/v2rayN/v2rayN/Handler/UpdateHandler.cs b/v2rayN/ServiceLib/Handler/UpdateHandler.cs similarity index 91% rename from v2rayN/v2rayN/Handler/UpdateHandler.cs rename to v2rayN/ServiceLib/Handler/UpdateHandler.cs index 4f2e1be6c86..73492c3048f 100644 --- a/v2rayN/v2rayN/Handler/UpdateHandler.cs +++ b/v2rayN/ServiceLib/Handler/UpdateHandler.cs @@ -1,17 +1,11 @@ -using DynamicData; -using Splat; -using System.Diagnostics; -using System.IO; +using System.Diagnostics; using System.Runtime.InteropServices; using System.Text; using System.Text.RegularExpressions; -using v2rayN.Enums; -using v2rayN.Models; -using v2rayN.Resx; -namespace v2rayN.Handler +namespace ServiceLib.Handler { - internal class UpdateHandler + public class UpdateHandler { private Action _updateFunc; private Config _config; @@ -44,30 +38,9 @@ public void CheckUpdateGuiN(Config config, Action update, bool pre if (args.Success) { _updateFunc(false, ResUI.MsgDownloadV2rayCoreSuccessfully); - - try - { - string fileName = Utils.GetTempPath(Utils.GetDownloadFileName(url)); - fileName = Utils.UrlEncode(fileName); - Process process = new() - { - StartInfo = new ProcessStartInfo - { - FileName = "v2rayUpgrade.exe", - Arguments = fileName.AppendQuotes(), - WorkingDirectory = Utils.StartupPath() - } - }; - process.Start(); - if (process.Id > 0) - { - _updateFunc(true, ""); - } - } - catch (Exception ex) - { - _updateFunc(false, ex.Message); - } + string fileName = Utils.GetTempPath(Utils.GetDownloadFileName(url)); + fileName = Utils.UrlEncode(fileName); + _updateFunc(true, fileName); } else { @@ -82,7 +55,7 @@ public void CheckUpdateGuiN(Config config, Action update, bool pre { if (args.Success) { - _updateFunc(false, string.Format(ResUI.MsgParsingSuccessfully, "v2rayN")); + _updateFunc(false, string.Format(ResUI.MsgParsingSuccessfully, ECoreType.v2rayN)); _updateFunc(false, args.Msg); url = args.Url; @@ -93,11 +66,10 @@ public void CheckUpdateGuiN(Config config, Action update, bool pre } else { - Locator.Current.GetService()?.Enqueue(args.Msg); _updateFunc(false, args.Msg); } }; - _updateFunc(false, string.Format(ResUI.MsgStartUpdating, "v2rayN")); + _updateFunc(false, string.Format(ResUI.MsgStartUpdating, ECoreType.v2rayN)); CheckUpdateAsync(ECoreType.v2rayN, preRelease); } @@ -138,7 +110,7 @@ public void CheckUpdateCore(ECoreType type, Config config, Action { if (args.Success) { - _updateFunc(false, string.Format(ResUI.MsgParsingSuccessfully, "Core")); + _updateFunc(false, string.Format(ResUI.MsgParsingSuccessfully, type)); _updateFunc(false, args.Msg); url = args.Url; @@ -149,11 +121,10 @@ public void CheckUpdateCore(ECoreType type, Config config, Action } else { - Locator.Current.GetService()?.Enqueue(args.Msg); _updateFunc(false, args.Msg); } }; - _updateFunc(false, string.Format(ResUI.MsgStartUpdating, "Core")); + _updateFunc(false, string.Format(ResUI.MsgStartUpdating, type)); CheckUpdateAsync(type, preRelease); } @@ -232,10 +203,7 @@ public void UpdateSubscriptionProcess(Config config, string subId, bool blProxy, result = Utils.Base64Decode(result); } - var lstUrl = new List - { - item.moreUrl.TrimEx().Split(",") - }; + var lstUrl = item.moreUrl.TrimEx().Split(",") ?? []; foreach (var it in lstUrl) { var url2 = Utils.GetPunycode(it); @@ -570,11 +538,6 @@ private async Task UpdateGeoFile(string geoName, Config config, Action - //{ - // string targetPath = Utile.GetBinPath($"{geoName}.dat", (ECoreType)Enum.Parse(typeof(ECoreType), it)); - // File.Copy(fileName, targetPath, true); - //}); string targetPath = Utils.GetBinPath($"{geoName}.dat"); File.Copy(fileName, targetPath, true); diff --git a/v2rayN/v2rayN/Models/ClashConnectionModel.cs b/v2rayN/ServiceLib/Models/ClashConnectionModel.cs similarity index 94% rename from v2rayN/v2rayN/Models/ClashConnectionModel.cs rename to v2rayN/ServiceLib/Models/ClashConnectionModel.cs index 94911d58b50..5d987a01713 100644 --- a/v2rayN/v2rayN/Models/ClashConnectionModel.cs +++ b/v2rayN/ServiceLib/Models/ClashConnectionModel.cs @@ -1,4 +1,4 @@ -namespace v2rayN.Models +namespace ServiceLib.Models { public class ClashConnectionModel { diff --git a/v2rayN/v2rayN/Models/ClashConnections.cs b/v2rayN/ServiceLib/Models/ClashConnections.cs similarity index 97% rename from v2rayN/v2rayN/Models/ClashConnections.cs rename to v2rayN/ServiceLib/Models/ClashConnections.cs index 439e3944515..b5fb2fcffe6 100644 --- a/v2rayN/v2rayN/Models/ClashConnections.cs +++ b/v2rayN/ServiceLib/Models/ClashConnections.cs @@ -1,4 +1,4 @@ -namespace v2rayN.Models +namespace ServiceLib.Models { public class ClashConnections { diff --git a/v2rayN/v2rayN/Models/ClashProviders.cs b/v2rayN/ServiceLib/Models/ClashProviders.cs similarity index 83% rename from v2rayN/v2rayN/Models/ClashProviders.cs rename to v2rayN/ServiceLib/Models/ClashProviders.cs index 28e387d53ba..ca64e0d2c51 100644 --- a/v2rayN/v2rayN/Models/ClashProviders.cs +++ b/v2rayN/ServiceLib/Models/ClashProviders.cs @@ -1,6 +1,6 @@ -using static v2rayN.Models.ClashProxies; +using static ServiceLib.Models.ClashProxies; -namespace v2rayN.Models +namespace ServiceLib.Models { public class ClashProviders { diff --git a/v2rayN/v2rayN/Models/ClashProxies.cs b/v2rayN/ServiceLib/Models/ClashProxies.cs similarity index 95% rename from v2rayN/v2rayN/Models/ClashProxies.cs rename to v2rayN/ServiceLib/Models/ClashProxies.cs index 4e8560c8ba2..b2fddeed19a 100644 --- a/v2rayN/v2rayN/Models/ClashProxies.cs +++ b/v2rayN/ServiceLib/Models/ClashProxies.cs @@ -1,4 +1,4 @@ -namespace v2rayN.Models +namespace ServiceLib.Models { public class ClashProxies { diff --git a/v2rayN/v2rayN/Models/ClashProxyModel.cs b/v2rayN/ServiceLib/Models/ClashProxyModel.cs similarity index 65% rename from v2rayN/v2rayN/Models/ClashProxyModel.cs rename to v2rayN/ServiceLib/Models/ClashProxyModel.cs index 13baeb1c008..e648b85a7f2 100644 --- a/v2rayN/v2rayN/Models/ClashProxyModel.cs +++ b/v2rayN/ServiceLib/Models/ClashProxyModel.cs @@ -1,26 +1,18 @@ -using ReactiveUI.Fody.Helpers; - -namespace v2rayN.Models +namespace ServiceLib.Models { [Serializable] public class ClashProxyModel { - [Reactive] public string name { get; set; } - [Reactive] public string type { get; set; } - [Reactive] public string now { get; set; } - [Reactive] public int delay { get; set; } - [Reactive] public string delayName { get; set; } - [Reactive] public bool isActive { get; set; } } } \ No newline at end of file diff --git a/v2rayN/v2rayN/Models/ComboItem.cs b/v2rayN/ServiceLib/Models/ComboItem.cs similarity index 85% rename from v2rayN/v2rayN/Models/ComboItem.cs rename to v2rayN/ServiceLib/Models/ComboItem.cs index 836d88bd411..f1b013ad47b 100644 --- a/v2rayN/v2rayN/Models/ComboItem.cs +++ b/v2rayN/ServiceLib/Models/ComboItem.cs @@ -1,4 +1,4 @@ -namespace v2rayN.Models +namespace ServiceLib.Models { public class ComboItem { diff --git a/v2rayN/v2rayN/Models/Config.cs b/v2rayN/ServiceLib/Models/Config.cs similarity index 97% rename from v2rayN/v2rayN/Models/Config.cs rename to v2rayN/ServiceLib/Models/Config.cs index f7e78e61a31..062cd501af9 100644 --- a/v2rayN/v2rayN/Models/Config.cs +++ b/v2rayN/ServiceLib/Models/Config.cs @@ -1,6 +1,4 @@ -using v2rayN.Enums; - -namespace v2rayN.Models +namespace ServiceLib.Models { /// /// 本软件配置文件实体类 diff --git a/v2rayN/v2rayN/Models/ConfigItems.cs b/v2rayN/ServiceLib/Models/ConfigItems.cs similarity index 99% rename from v2rayN/v2rayN/Models/ConfigItems.cs rename to v2rayN/ServiceLib/Models/ConfigItems.cs index b7c9c46fed8..ec7f746a09c 100644 --- a/v2rayN/v2rayN/Models/ConfigItems.cs +++ b/v2rayN/ServiceLib/Models/ConfigItems.cs @@ -1,6 +1,4 @@ -using v2rayN.Enums; - -namespace v2rayN.Models +namespace ServiceLib.Models { [Serializable] public class CoreBasicItem diff --git a/v2rayN/v2rayN/Models/CoreInfo.cs b/v2rayN/ServiceLib/Models/CoreInfo.cs similarity index 92% rename from v2rayN/v2rayN/Models/CoreInfo.cs rename to v2rayN/ServiceLib/Models/CoreInfo.cs index ad773c8ce5d..e1620953c95 100644 --- a/v2rayN/v2rayN/Models/CoreInfo.cs +++ b/v2rayN/ServiceLib/Models/CoreInfo.cs @@ -1,6 +1,4 @@ -using v2rayN.Enums; - -namespace v2rayN.Models +namespace ServiceLib.Models { [Serializable] public class CoreInfo diff --git a/v2rayN/v2rayN/Models/DNSItem.cs b/v2rayN/ServiceLib/Models/DNSItem.cs similarity index 92% rename from v2rayN/v2rayN/Models/DNSItem.cs rename to v2rayN/ServiceLib/Models/DNSItem.cs index 944eea953d7..d40bad55182 100644 --- a/v2rayN/v2rayN/Models/DNSItem.cs +++ b/v2rayN/ServiceLib/Models/DNSItem.cs @@ -1,7 +1,6 @@ using SQLite; -using v2rayN.Enums; -namespace v2rayN.Models +namespace ServiceLib.Models { [Serializable] public class DNSItem diff --git a/v2rayN/v2rayN/Models/GitHubRelease.cs b/v2rayN/ServiceLib/Models/GitHubRelease.cs similarity index 98% rename from v2rayN/v2rayN/Models/GitHubRelease.cs rename to v2rayN/ServiceLib/Models/GitHubRelease.cs index 84520d14b74..804753d8ac7 100644 --- a/v2rayN/v2rayN/Models/GitHubRelease.cs +++ b/v2rayN/ServiceLib/Models/GitHubRelease.cs @@ -1,6 +1,6 @@ using System.Text.Json.Serialization; -namespace v2rayN.Models +namespace ServiceLib.Models { public class GitHubReleaseAsset { diff --git a/v2rayN/v2rayN/Models/ProfileExItem.cs b/v2rayN/ServiceLib/Models/ProfileExItem.cs similarity index 90% rename from v2rayN/v2rayN/Models/ProfileExItem.cs rename to v2rayN/ServiceLib/Models/ProfileExItem.cs index b572bd50bb3..ba3f97c2314 100644 --- a/v2rayN/v2rayN/Models/ProfileExItem.cs +++ b/v2rayN/ServiceLib/Models/ProfileExItem.cs @@ -1,6 +1,6 @@ using SQLite; -namespace v2rayN.Models +namespace ServiceLib.Models { [Serializable] public class ProfileExItem diff --git a/v2rayN/v2rayN/Models/ProfileItem.cs b/v2rayN/ServiceLib/Models/ProfileItem.cs similarity index 99% rename from v2rayN/v2rayN/Models/ProfileItem.cs rename to v2rayN/ServiceLib/Models/ProfileItem.cs index 8fb05bad6fd..8c9092c66f3 100644 --- a/v2rayN/v2rayN/Models/ProfileItem.cs +++ b/v2rayN/ServiceLib/Models/ProfileItem.cs @@ -1,7 +1,6 @@ using SQLite; -using v2rayN.Enums; -namespace v2rayN.Models +namespace ServiceLib.Models { [Serializable] public class ProfileItem diff --git a/v2rayN/v2rayN/Models/ProfileItemModel.cs b/v2rayN/ServiceLib/Models/ProfileItemModel.cs similarity index 94% rename from v2rayN/v2rayN/Models/ProfileItemModel.cs rename to v2rayN/ServiceLib/Models/ProfileItemModel.cs index 8208d576c5d..750a8d916bf 100644 --- a/v2rayN/v2rayN/Models/ProfileItemModel.cs +++ b/v2rayN/ServiceLib/Models/ProfileItemModel.cs @@ -1,4 +1,4 @@ -namespace v2rayN.Models +namespace ServiceLib.Models { [Serializable] public class ProfileItemModel : ProfileItem diff --git a/v2rayN/v2rayN/Models/RoutingItem.cs b/v2rayN/ServiceLib/Models/RoutingItem.cs similarity index 95% rename from v2rayN/v2rayN/Models/RoutingItem.cs rename to v2rayN/ServiceLib/Models/RoutingItem.cs index de5cfb2afd7..6f51821e760 100644 --- a/v2rayN/v2rayN/Models/RoutingItem.cs +++ b/v2rayN/ServiceLib/Models/RoutingItem.cs @@ -1,6 +1,6 @@ using SQLite; -namespace v2rayN.Models +namespace ServiceLib.Models { [Serializable] public class RoutingItem diff --git a/v2rayN/v2rayN/Models/RoutingItemModel.cs b/v2rayN/ServiceLib/Models/RoutingItemModel.cs similarity index 80% rename from v2rayN/v2rayN/Models/RoutingItemModel.cs rename to v2rayN/ServiceLib/Models/RoutingItemModel.cs index 3e2fd4fc215..28461612d4d 100644 --- a/v2rayN/v2rayN/Models/RoutingItemModel.cs +++ b/v2rayN/ServiceLib/Models/RoutingItemModel.cs @@ -1,4 +1,4 @@ -namespace v2rayN.Models +namespace ServiceLib.Models { [Serializable] public class RoutingItemModel : RoutingItem diff --git a/v2rayN/v2rayN/Models/RulesItem.cs b/v2rayN/ServiceLib/Models/RulesItem.cs similarity index 95% rename from v2rayN/v2rayN/Models/RulesItem.cs rename to v2rayN/ServiceLib/Models/RulesItem.cs index 78c4e846d09..7581d43589a 100644 --- a/v2rayN/v2rayN/Models/RulesItem.cs +++ b/v2rayN/ServiceLib/Models/RulesItem.cs @@ -1,4 +1,4 @@ -namespace v2rayN.Models +namespace ServiceLib.Models { [Serializable] public class RulesItem diff --git a/v2rayN/v2rayN/Models/RulesItemModel.cs b/v2rayN/ServiceLib/Models/RulesItemModel.cs similarity index 89% rename from v2rayN/v2rayN/Models/RulesItemModel.cs rename to v2rayN/ServiceLib/Models/RulesItemModel.cs index fbe7c57adac..adffb011b66 100644 --- a/v2rayN/v2rayN/Models/RulesItemModel.cs +++ b/v2rayN/ServiceLib/Models/RulesItemModel.cs @@ -1,4 +1,4 @@ -namespace v2rayN.Models +namespace ServiceLib.Models { [Serializable] public class RulesItemModel : RulesItem diff --git a/v2rayN/v2rayN/Models/ServerSpeedItem.cs b/v2rayN/ServiceLib/Models/ServerSpeedItem.cs similarity index 94% rename from v2rayN/v2rayN/Models/ServerSpeedItem.cs rename to v2rayN/ServiceLib/Models/ServerSpeedItem.cs index d5411d329c8..09c5e6ba2bd 100644 --- a/v2rayN/v2rayN/Models/ServerSpeedItem.cs +++ b/v2rayN/ServiceLib/Models/ServerSpeedItem.cs @@ -1,4 +1,4 @@ -namespace v2rayN.Models +namespace ServiceLib.Models { [Serializable] public class ServerSpeedItem : ServerStatItem diff --git a/v2rayN/v2rayN/Models/ServerStatItem.cs b/v2rayN/ServiceLib/Models/ServerStatItem.cs similarity index 95% rename from v2rayN/v2rayN/Models/ServerStatItem.cs rename to v2rayN/ServiceLib/Models/ServerStatItem.cs index a24b78b087b..16939d1f82c 100644 --- a/v2rayN/v2rayN/Models/ServerStatItem.cs +++ b/v2rayN/ServiceLib/Models/ServerStatItem.cs @@ -1,6 +1,6 @@ using SQLite; -namespace v2rayN.Models +namespace ServiceLib.Models { [Serializable] public class ServerStatItem diff --git a/v2rayN/v2rayN/Models/ServerTestItem.cs b/v2rayN/ServiceLib/Models/ServerTestItem.cs similarity index 78% rename from v2rayN/v2rayN/Models/ServerTestItem.cs rename to v2rayN/ServiceLib/Models/ServerTestItem.cs index 8faea95ee45..de5c2869745 100644 --- a/v2rayN/v2rayN/Models/ServerTestItem.cs +++ b/v2rayN/ServiceLib/Models/ServerTestItem.cs @@ -1,9 +1,7 @@ -using v2rayN.Enums; - -namespace v2rayN.Models +namespace ServiceLib.Models { [Serializable] - internal class ServerTestItem + public class ServerTestItem { public string indexId { get; set; } public string address { get; set; } diff --git a/v2rayN/v2rayN/Models/SingboxConfig.cs b/v2rayN/ServiceLib/Models/SingboxConfig.cs similarity index 99% rename from v2rayN/v2rayN/Models/SingboxConfig.cs rename to v2rayN/ServiceLib/Models/SingboxConfig.cs index c0dd2b5f253..12689a1a5e6 100644 --- a/v2rayN/v2rayN/Models/SingboxConfig.cs +++ b/v2rayN/ServiceLib/Models/SingboxConfig.cs @@ -1,4 +1,4 @@ -namespace v2rayN.Models +namespace ServiceLib.Models { public class SingboxConfig { diff --git a/v2rayN/v2rayN/Models/SpeedTestResult.cs b/v2rayN/ServiceLib/Models/SpeedTestResult.cs similarity index 86% rename from v2rayN/v2rayN/Models/SpeedTestResult.cs rename to v2rayN/ServiceLib/Models/SpeedTestResult.cs index 08fc38fa3dc..63016bfc10a 100644 --- a/v2rayN/v2rayN/Models/SpeedTestResult.cs +++ b/v2rayN/ServiceLib/Models/SpeedTestResult.cs @@ -1,4 +1,4 @@ -namespace v2rayN.Models +namespace ServiceLib.Models { [Serializable] public class SpeedTestResult diff --git a/v2rayN/v2rayN/Models/SsSIP008.cs b/v2rayN/ServiceLib/Models/SsSIP008.cs similarity index 93% rename from v2rayN/v2rayN/Models/SsSIP008.cs rename to v2rayN/ServiceLib/Models/SsSIP008.cs index 3600a438ade..9e3d14a8e81 100644 --- a/v2rayN/v2rayN/Models/SsSIP008.cs +++ b/v2rayN/ServiceLib/Models/SsSIP008.cs @@ -1,4 +1,4 @@ -namespace v2rayN.Models +namespace ServiceLib.Models { public class SsSIP008 { diff --git a/v2rayN/v2rayN/Models/SubItem.cs b/v2rayN/ServiceLib/Models/SubItem.cs similarity index 96% rename from v2rayN/v2rayN/Models/SubItem.cs rename to v2rayN/ServiceLib/Models/SubItem.cs index 1f36bb9a28d..5c361d93e41 100644 --- a/v2rayN/v2rayN/Models/SubItem.cs +++ b/v2rayN/ServiceLib/Models/SubItem.cs @@ -1,6 +1,6 @@ using SQLite; -namespace v2rayN.Models +namespace ServiceLib.Models { [Serializable] public class SubItem diff --git a/v2rayN/v2rayN/Models/SysProxyConfig.cs b/v2rayN/ServiceLib/Models/SysProxyConfig.cs similarity index 86% rename from v2rayN/v2rayN/Models/SysProxyConfig.cs rename to v2rayN/ServiceLib/Models/SysProxyConfig.cs index 95c2221b494..6cc958247b0 100644 --- a/v2rayN/v2rayN/Models/SysProxyConfig.cs +++ b/v2rayN/ServiceLib/Models/SysProxyConfig.cs @@ -1,6 +1,6 @@ -namespace v2rayN.Models +namespace ServiceLib.Models { - internal class SysProxyConfig + public class SysProxyConfig { public bool UserSettingsRecorded; public string Flags; diff --git a/v2rayN/v2rayN/Models/V2rayConfig.cs b/v2rayN/ServiceLib/Models/V2rayConfig.cs similarity index 99% rename from v2rayN/v2rayN/Models/V2rayConfig.cs rename to v2rayN/ServiceLib/Models/V2rayConfig.cs index b86f4720b54..1118a193ae1 100644 --- a/v2rayN/v2rayN/Models/V2rayConfig.cs +++ b/v2rayN/ServiceLib/Models/V2rayConfig.cs @@ -1,6 +1,6 @@ using System.Text.Json.Serialization; -namespace v2rayN.Models +namespace ServiceLib.Models { /// /// v2ray配置文件实体类 例子SampleConfig.txt diff --git a/v2rayN/v2rayN/Models/V2rayTcpRequest.cs b/v2rayN/ServiceLib/Models/V2rayTcpRequest.cs similarity index 92% rename from v2rayN/v2rayN/Models/V2rayTcpRequest.cs rename to v2rayN/ServiceLib/Models/V2rayTcpRequest.cs index 89158f190e1..9856441589c 100644 --- a/v2rayN/v2rayN/Models/V2rayTcpRequest.cs +++ b/v2rayN/ServiceLib/Models/V2rayTcpRequest.cs @@ -1,4 +1,4 @@ -namespace v2rayN.Models +namespace ServiceLib.Models { /// /// Tcp伪装http的Request,只要Host diff --git a/v2rayN/v2rayN/Models/VmessQRCode.cs b/v2rayN/ServiceLib/Models/VmessQRCode.cs similarity index 95% rename from v2rayN/v2rayN/Models/VmessQRCode.cs rename to v2rayN/ServiceLib/Models/VmessQRCode.cs index e37d5c62533..92f93bf379e 100644 --- a/v2rayN/v2rayN/Models/VmessQRCode.cs +++ b/v2rayN/ServiceLib/Models/VmessQRCode.cs @@ -1,12 +1,12 @@ using System.Text.Json.Serialization; -namespace v2rayN.Models +namespace ServiceLib.Models { /// /// https://github.com/2dust/v2rayN/wiki/ /// [Serializable] - internal class VmessQRCode + public class VmessQRCode { [JsonNumberHandling(JsonNumberHandling.AllowReadingFromString | JsonNumberHandling.WriteAsString)] public int v { get; set; } = 2; diff --git a/v2rayN/v2rayN/Resx/ResUI.Designer.cs b/v2rayN/ServiceLib/Resx/ResUI.Designer.cs similarity index 99% rename from v2rayN/v2rayN/Resx/ResUI.Designer.cs rename to v2rayN/ServiceLib/Resx/ResUI.Designer.cs index 9cab6ac796d..e962417b7f3 100644 --- a/v2rayN/v2rayN/Resx/ResUI.Designer.cs +++ b/v2rayN/ServiceLib/Resx/ResUI.Designer.cs @@ -8,7 +8,7 @@ // //------------------------------------------------------------------------------ -namespace v2rayN.Resx { +namespace ServiceLib.Resx { using System; @@ -29,7 +29,7 @@ public class ResUI { private static global::System.Globalization.CultureInfo resourceCulture; [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - internal ResUI() { + public ResUI() { } /// @@ -39,7 +39,7 @@ internal ResUI() { public static global::System.Resources.ResourceManager ResourceManager { get { if (object.ReferenceEquals(resourceMan, null)) { - global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("v2rayN.Resx.ResUI", typeof(ResUI).Assembly); + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("ServiceLib.Resx.ResUI", typeof(ResUI).Assembly); resourceMan = temp; } return resourceMan; diff --git a/v2rayN/v2rayN/Resx/ResUI.fa-Ir.resx b/v2rayN/ServiceLib/Resx/ResUI.fa-Ir.resx similarity index 100% rename from v2rayN/v2rayN/Resx/ResUI.fa-Ir.resx rename to v2rayN/ServiceLib/Resx/ResUI.fa-Ir.resx diff --git a/v2rayN/v2rayN/Resx/ResUI.resx b/v2rayN/ServiceLib/Resx/ResUI.resx similarity index 100% rename from v2rayN/v2rayN/Resx/ResUI.resx rename to v2rayN/ServiceLib/Resx/ResUI.resx diff --git a/v2rayN/v2rayN/Resx/ResUI.ru.resx b/v2rayN/ServiceLib/Resx/ResUI.ru.resx similarity index 100% rename from v2rayN/v2rayN/Resx/ResUI.ru.resx rename to v2rayN/ServiceLib/Resx/ResUI.ru.resx diff --git a/v2rayN/v2rayN/Resx/ResUI.zh-Hans.resx b/v2rayN/ServiceLib/Resx/ResUI.zh-Hans.resx similarity index 100% rename from v2rayN/v2rayN/Resx/ResUI.zh-Hans.resx rename to v2rayN/ServiceLib/Resx/ResUI.zh-Hans.resx diff --git a/v2rayN/v2rayN/Resx/ResUI.zh-Hant.resx b/v2rayN/ServiceLib/Resx/ResUI.zh-Hant.resx similarity index 100% rename from v2rayN/v2rayN/Resx/ResUI.zh-Hant.resx rename to v2rayN/ServiceLib/Resx/ResUI.zh-Hant.resx diff --git a/v2rayN/v2rayN/Sample/SampleClientConfig b/v2rayN/ServiceLib/Sample/SampleClientConfig similarity index 100% rename from v2rayN/v2rayN/Sample/SampleClientConfig rename to v2rayN/ServiceLib/Sample/SampleClientConfig diff --git a/v2rayN/v2rayN/Sample/SampleHttpRequest b/v2rayN/ServiceLib/Sample/SampleHttpRequest similarity index 100% rename from v2rayN/v2rayN/Sample/SampleHttpRequest rename to v2rayN/ServiceLib/Sample/SampleHttpRequest diff --git a/v2rayN/v2rayN/Sample/SampleHttpResponse b/v2rayN/ServiceLib/Sample/SampleHttpResponse similarity index 100% rename from v2rayN/v2rayN/Sample/SampleHttpResponse rename to v2rayN/ServiceLib/Sample/SampleHttpResponse diff --git a/v2rayN/v2rayN/Sample/SampleInbound b/v2rayN/ServiceLib/Sample/SampleInbound similarity index 100% rename from v2rayN/v2rayN/Sample/SampleInbound rename to v2rayN/ServiceLib/Sample/SampleInbound diff --git a/v2rayN/v2rayN/Sample/SampleOutbound b/v2rayN/ServiceLib/Sample/SampleOutbound similarity index 100% rename from v2rayN/v2rayN/Sample/SampleOutbound rename to v2rayN/ServiceLib/Sample/SampleOutbound diff --git a/v2rayN/v2rayN/Sample/SingboxSampleClientConfig b/v2rayN/ServiceLib/Sample/SingboxSampleClientConfig similarity index 100% rename from v2rayN/v2rayN/Sample/SingboxSampleClientConfig rename to v2rayN/ServiceLib/Sample/SingboxSampleClientConfig diff --git a/v2rayN/v2rayN/Sample/SingboxSampleOutbound b/v2rayN/ServiceLib/Sample/SingboxSampleOutbound similarity index 100% rename from v2rayN/v2rayN/Sample/SingboxSampleOutbound rename to v2rayN/ServiceLib/Sample/SingboxSampleOutbound diff --git a/v2rayN/v2rayN/Sample/clash_mixin_yaml b/v2rayN/ServiceLib/Sample/clash_mixin_yaml similarity index 100% rename from v2rayN/v2rayN/Sample/clash_mixin_yaml rename to v2rayN/ServiceLib/Sample/clash_mixin_yaml diff --git a/v2rayN/v2rayN/Sample/clash_tun_yaml b/v2rayN/ServiceLib/Sample/clash_tun_yaml similarity index 100% rename from v2rayN/v2rayN/Sample/clash_tun_yaml rename to v2rayN/ServiceLib/Sample/clash_tun_yaml diff --git a/v2rayN/v2rayN/Sample/custom_routing_black b/v2rayN/ServiceLib/Sample/custom_routing_black similarity index 100% rename from v2rayN/v2rayN/Sample/custom_routing_black rename to v2rayN/ServiceLib/Sample/custom_routing_black diff --git a/v2rayN/v2rayN/Sample/custom_routing_global b/v2rayN/ServiceLib/Sample/custom_routing_global similarity index 100% rename from v2rayN/v2rayN/Sample/custom_routing_global rename to v2rayN/ServiceLib/Sample/custom_routing_global diff --git a/v2rayN/v2rayN/Sample/custom_routing_locked b/v2rayN/ServiceLib/Sample/custom_routing_locked similarity index 100% rename from v2rayN/v2rayN/Sample/custom_routing_locked rename to v2rayN/ServiceLib/Sample/custom_routing_locked diff --git a/v2rayN/v2rayN/Sample/custom_routing_rules b/v2rayN/ServiceLib/Sample/custom_routing_rules similarity index 100% rename from v2rayN/v2rayN/Sample/custom_routing_rules rename to v2rayN/ServiceLib/Sample/custom_routing_rules diff --git a/v2rayN/v2rayN/Sample/custom_routing_white b/v2rayN/ServiceLib/Sample/custom_routing_white similarity index 100% rename from v2rayN/v2rayN/Sample/custom_routing_white rename to v2rayN/ServiceLib/Sample/custom_routing_white diff --git a/v2rayN/v2rayN/Sample/dns_singbox_normal b/v2rayN/ServiceLib/Sample/dns_singbox_normal similarity index 100% rename from v2rayN/v2rayN/Sample/dns_singbox_normal rename to v2rayN/ServiceLib/Sample/dns_singbox_normal diff --git a/v2rayN/v2rayN/Sample/dns_v2ray_normal b/v2rayN/ServiceLib/Sample/dns_v2ray_normal similarity index 100% rename from v2rayN/v2rayN/Sample/dns_v2ray_normal rename to v2rayN/ServiceLib/Sample/dns_v2ray_normal diff --git a/v2rayN/v2rayN/Sample/tun_singbox_dns b/v2rayN/ServiceLib/Sample/tun_singbox_dns similarity index 100% rename from v2rayN/v2rayN/Sample/tun_singbox_dns rename to v2rayN/ServiceLib/Sample/tun_singbox_dns diff --git a/v2rayN/v2rayN/Sample/tun_singbox_inbound b/v2rayN/ServiceLib/Sample/tun_singbox_inbound similarity index 100% rename from v2rayN/v2rayN/Sample/tun_singbox_inbound rename to v2rayN/ServiceLib/Sample/tun_singbox_inbound diff --git a/v2rayN/v2rayN/Sample/tun_singbox_rules b/v2rayN/ServiceLib/Sample/tun_singbox_rules similarity index 100% rename from v2rayN/v2rayN/Sample/tun_singbox_rules rename to v2rayN/ServiceLib/Sample/tun_singbox_rules diff --git a/v2rayN/ServiceLib/ServiceLib.csproj b/v2rayN/ServiceLib/ServiceLib.csproj new file mode 100644 index 00000000000..47b0750a31f --- /dev/null +++ b/v2rayN/ServiceLib/ServiceLib.csproj @@ -0,0 +1,75 @@ + + + + net8.0 + enable + enable + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ResUI.resx + True + True + + + + + + Designer + PublicResXFileCodeGenerator + + + Designer + ResUI.Designer.cs + PublicResXFileCodeGenerator + + + Designer + PublicResXFileCodeGenerator + + + Designer + PublicResXFileCodeGenerator + + + Designer + PublicResXFileCodeGenerator + + + + diff --git a/v2rayN/v2rayN.sln b/v2rayN/v2rayN.sln index df0929a5695..f4afd009e80 100644 --- a/v2rayN/v2rayN.sln +++ b/v2rayN/v2rayN.sln @@ -11,6 +11,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PacLib", "PacLib\PacLib.csp EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "v2rayUpgrade", "v2rayUpgrade\v2rayUpgrade.csproj", "{3CD0B9E8-331B-42C6-A395-4DA0FD4BC8EB}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ServiceLib", "ServiceLib\ServiceLib.csproj", "{1B6456C4-FFAA-4298-80F6-7B689A6E9243}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -33,6 +35,10 @@ Global {3CD0B9E8-331B-42C6-A395-4DA0FD4BC8EB}.Debug|Any CPU.Build.0 = Debug|Any CPU {3CD0B9E8-331B-42C6-A395-4DA0FD4BC8EB}.Release|Any CPU.ActiveCfg = Release|Any CPU {3CD0B9E8-331B-42C6-A395-4DA0FD4BC8EB}.Release|Any CPU.Build.0 = Release|Any CPU + {1B6456C4-FFAA-4298-80F6-7B689A6E9243}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {1B6456C4-FFAA-4298-80F6-7B689A6E9243}.Debug|Any CPU.Build.0 = Debug|Any CPU + {1B6456C4-FFAA-4298-80F6-7B689A6E9243}.Release|Any CPU.ActiveCfg = Release|Any CPU + {1B6456C4-FFAA-4298-80F6-7B689A6E9243}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/v2rayN/v2rayN/App.xaml b/v2rayN/v2rayN/App.xaml index 3b7aefeec9d..04a602cb6fd 100644 --- a/v2rayN/v2rayN/App.xaml +++ b/v2rayN/v2rayN/App.xaml @@ -1,9 +1,9 @@  diff --git a/v2rayN/v2rayN/App.xaml.cs b/v2rayN/v2rayN/App.xaml.cs index 73467ee3446..f5b543c2dbb 100644 --- a/v2rayN/v2rayN/App.xaml.cs +++ b/v2rayN/v2rayN/App.xaml.cs @@ -1,8 +1,6 @@ using System.Diagnostics; using System.Windows; using System.Windows.Threading; -using v2rayN.Handler; -using v2rayN.Models; namespace v2rayN { diff --git a/v2rayN/v2rayN/Base/MyReactiveObject.cs b/v2rayN/v2rayN/Base/MyReactiveObject.cs index 8464e1ee14f..b326c7cbcae 100644 --- a/v2rayN/v2rayN/Base/MyReactiveObject.cs +++ b/v2rayN/v2rayN/Base/MyReactiveObject.cs @@ -1,7 +1,5 @@ using ReactiveUI; -using v2rayN.Enums; using v2rayN.Handler; -using v2rayN.Models; namespace v2rayN.Base { diff --git a/v2rayN/v2rayN/Converters/MaterialDesignFonts.cs b/v2rayN/v2rayN/Converters/MaterialDesignFonts.cs index 0e8fac70c6d..37d17f820db 100644 --- a/v2rayN/v2rayN/Converters/MaterialDesignFonts.cs +++ b/v2rayN/v2rayN/Converters/MaterialDesignFonts.cs @@ -1,5 +1,4 @@ using System.Windows.Media; -using v2rayN.Handler; namespace v2rayN.Converters { diff --git a/v2rayN/v2rayN/GlobalUsings.cs b/v2rayN/v2rayN/GlobalUsings.cs new file mode 100644 index 00000000000..42722976ac5 --- /dev/null +++ b/v2rayN/v2rayN/GlobalUsings.cs @@ -0,0 +1,9 @@ +global using ServiceLib; +global using ServiceLib.Common; +global using ServiceLib.Handler; +global using ServiceLib.Handler.CoreConfig; +global using ServiceLib.Handler.Fmt; +global using ServiceLib.Handler.Statistics; +global using ServiceLib.Enums; +global using ServiceLib.Models; +global using ServiceLib.Resx; \ No newline at end of file diff --git a/v2rayN/v2rayN/Handler/HotkeyHandler.cs b/v2rayN/v2rayN/Handler/HotkeyHandler.cs index 4dbe2ba4485..d3010fa75fd 100644 --- a/v2rayN/v2rayN/Handler/HotkeyHandler.cs +++ b/v2rayN/v2rayN/Handler/HotkeyHandler.cs @@ -4,9 +4,6 @@ using System.Windows; using System.Windows.Input; using System.Windows.Interop; -using v2rayN.Enums; -using v2rayN.Models; -using v2rayN.Resx; namespace v2rayN.Handler { diff --git a/v2rayN/v2rayN/Handler/SysProxyHandler.cs b/v2rayN/v2rayN/Handler/SysProxyHandler.cs index af73e311c88..1efe3d76597 100644 --- a/v2rayN/v2rayN/Handler/SysProxyHandler.cs +++ b/v2rayN/v2rayN/Handler/SysProxyHandler.cs @@ -1,7 +1,5 @@ using PacLib; using v2rayN.Common; -using v2rayN.Enums; -using v2rayN.Models; namespace v2rayN.Handler { diff --git a/v2rayN/v2rayN/Handler/WindowsHandler.cs b/v2rayN/v2rayN/Handler/WindowsHandler.cs index 4b6f62ba4e1..736b8892dc1 100644 --- a/v2rayN/v2rayN/Handler/WindowsHandler.cs +++ b/v2rayN/v2rayN/Handler/WindowsHandler.cs @@ -1,8 +1,6 @@ using System.Drawing; using System.IO; using System.Windows.Media.Imaging; -using v2rayN.Enums; -using v2rayN.Models; namespace v2rayN.Handler { diff --git a/v2rayN/v2rayN/ViewModels/AddServer2ViewModel.cs b/v2rayN/v2rayN/ViewModels/AddServer2ViewModel.cs index 4cc62f356db..97ea82e7f4d 100644 --- a/v2rayN/v2rayN/ViewModels/AddServer2ViewModel.cs +++ b/v2rayN/v2rayN/ViewModels/AddServer2ViewModel.cs @@ -4,10 +4,7 @@ using System.IO; using System.Reactive; using v2rayN.Base; -using v2rayN.Enums; using v2rayN.Handler; -using v2rayN.Models; -using v2rayN.Resx; namespace v2rayN.ViewModels { diff --git a/v2rayN/v2rayN/ViewModels/AddServerViewModel.cs b/v2rayN/v2rayN/ViewModels/AddServerViewModel.cs index 12c86f9cc54..c55025085bf 100644 --- a/v2rayN/v2rayN/ViewModels/AddServerViewModel.cs +++ b/v2rayN/v2rayN/ViewModels/AddServerViewModel.cs @@ -3,10 +3,7 @@ using Splat; using System.Reactive; using v2rayN.Base; -using v2rayN.Enums; using v2rayN.Handler; -using v2rayN.Models; -using v2rayN.Resx; namespace v2rayN.ViewModels { diff --git a/v2rayN/v2rayN/ViewModels/ClashConnectionsViewModel.cs b/v2rayN/v2rayN/ViewModels/ClashConnectionsViewModel.cs index 5d29d2cf539..529088ec854 100644 --- a/v2rayN/v2rayN/ViewModels/ClashConnectionsViewModel.cs +++ b/v2rayN/v2rayN/ViewModels/ClashConnectionsViewModel.cs @@ -5,9 +5,6 @@ using System.Reactive; using System.Reactive.Linq; using v2rayN.Base; -using v2rayN.Enums; -using v2rayN.Handler; -using v2rayN.Models; namespace v2rayN.ViewModels { diff --git a/v2rayN/v2rayN/ViewModels/ClashProxiesViewModel.cs b/v2rayN/v2rayN/ViewModels/ClashProxiesViewModel.cs index 3a74ca49fca..2a7fe3e5457 100644 --- a/v2rayN/v2rayN/ViewModels/ClashProxiesViewModel.cs +++ b/v2rayN/v2rayN/ViewModels/ClashProxiesViewModel.cs @@ -6,12 +6,9 @@ using System.Reactive; using System.Reactive.Linq; using v2rayN.Base; -using v2rayN.Enums; using v2rayN.Handler; -using v2rayN.Models; -using v2rayN.Resx; -using static v2rayN.Models.ClashProviders; -using static v2rayN.Models.ClashProxies; +using static ServiceLib.Models.ClashProviders; +using static ServiceLib.Models.ClashProxies; namespace v2rayN.ViewModels { @@ -383,10 +380,8 @@ public void SetActiveProxy() _proxyGroups.Replace(group, group2); SelectedGroup = group2; - } _noticeHandler?.Enqueue(ResUI.OperationSuccess); - } private void ProxiesDelayTest(bool blAll) diff --git a/v2rayN/v2rayN/ViewModels/DNSSettingViewModel.cs b/v2rayN/v2rayN/ViewModels/DNSSettingViewModel.cs index ea3ce40dba4..571ff8d3bcd 100644 --- a/v2rayN/v2rayN/ViewModels/DNSSettingViewModel.cs +++ b/v2rayN/v2rayN/ViewModels/DNSSettingViewModel.cs @@ -3,10 +3,7 @@ using Splat; using System.Reactive; using v2rayN.Base; -using v2rayN.Enums; using v2rayN.Handler; -using v2rayN.Models; -using v2rayN.Resx; namespace v2rayN.ViewModels { diff --git a/v2rayN/v2rayN/ViewModels/MainWindowViewModel.cs b/v2rayN/v2rayN/ViewModels/MainWindowViewModel.cs index e48577da3b8..d9ca6b90051 100644 --- a/v2rayN/v2rayN/ViewModels/MainWindowViewModel.cs +++ b/v2rayN/v2rayN/ViewModels/MainWindowViewModel.cs @@ -8,11 +8,7 @@ using System.Reactive.Linq; using System.Text; using v2rayN.Base; -using v2rayN.Enums; using v2rayN.Handler; -using v2rayN.Handler.Statistics; -using v2rayN.Models; -using v2rayN.Resx; namespace v2rayN.ViewModels { @@ -754,7 +750,28 @@ void _updateUI(bool success, string msg) _noticeHandler?.SendMessage(msg); if (success) { - MyAppExit(false); + try + { + var fileName = msg; + Process process = new() + { + StartInfo = new ProcessStartInfo + { + FileName = "v2rayUpgrade.exe", + Arguments = fileName.AppendQuotes(), + WorkingDirectory = Utils.StartupPath() + } + }; + process.Start(); + if (process.Id > 0) + { + MyAppExit(false); + } + } + catch (Exception ex) + { + _noticeHandler?.SendMessage(ex.Message); + } } } (new UpdateHandler()).CheckUpdateGuiN(_config, _updateUI, _config.guiItem.checkPreReleaseUpdate); diff --git a/v2rayN/v2rayN/ViewModels/OptionSettingViewModel.cs b/v2rayN/v2rayN/ViewModels/OptionSettingViewModel.cs index 286ef3aa252..46f6bceda05 100644 --- a/v2rayN/v2rayN/ViewModels/OptionSettingViewModel.cs +++ b/v2rayN/v2rayN/ViewModels/OptionSettingViewModel.cs @@ -3,10 +3,7 @@ using Splat; using System.Reactive; using v2rayN.Base; -using v2rayN.Enums; using v2rayN.Handler; -using v2rayN.Models; -using v2rayN.Resx; namespace v2rayN.ViewModels { diff --git a/v2rayN/v2rayN/ViewModels/ProfilesViewModel.cs b/v2rayN/v2rayN/ViewModels/ProfilesViewModel.cs index 0d395a16f6b..d2d83daf3e2 100644 --- a/v2rayN/v2rayN/ViewModels/ProfilesViewModel.cs +++ b/v2rayN/v2rayN/ViewModels/ProfilesViewModel.cs @@ -7,12 +7,7 @@ using System.Reactive.Linq; using System.Text; using v2rayN.Base; -using v2rayN.Enums; using v2rayN.Handler; -using v2rayN.Handler.CoreConfig; -using v2rayN.Handler.Fmt; -using v2rayN.Models; -using v2rayN.Resx; namespace v2rayN.ViewModels { @@ -24,6 +19,7 @@ public class ProfilesViewModel : MyReactiveObject private string _serverFilter = string.Empty; private Dictionary _dicHeaderSort = new(); + private SpeedtestHandler? _speedtestHandler; #endregion private prop @@ -676,10 +672,15 @@ public void ServerSpeedtest(ESpeedActionType actionType) var coreHandler = Locator.Current.GetService(); if (coreHandler != null) { - new SpeedtestHandler(_config, coreHandler, lstSelecteds, actionType, UpdateSpeedtestHandler); + _speedtestHandler = new SpeedtestHandler(_config, coreHandler, lstSelecteds, actionType, UpdateSpeedtestHandler); } } + public void ServerSpeedtestStop() + { + _speedtestHandler?.ExitLoop(); + } + private void Export2ClientConfig(bool blClipboard) { var item = LazyConfig.Instance.GetProfileItem(SelectedProfile.indexId); diff --git a/v2rayN/v2rayN/ViewModels/RoutingRuleDetailsViewModel.cs b/v2rayN/v2rayN/ViewModels/RoutingRuleDetailsViewModel.cs index 087a95462b4..31ab1a0b076 100644 --- a/v2rayN/v2rayN/ViewModels/RoutingRuleDetailsViewModel.cs +++ b/v2rayN/v2rayN/ViewModels/RoutingRuleDetailsViewModel.cs @@ -3,10 +3,7 @@ using Splat; using System.Reactive; using v2rayN.Base; -using v2rayN.Enums; using v2rayN.Handler; -using v2rayN.Models; -using v2rayN.Resx; namespace v2rayN.ViewModels { diff --git a/v2rayN/v2rayN/ViewModels/RoutingRuleSettingViewModel.cs b/v2rayN/v2rayN/ViewModels/RoutingRuleSettingViewModel.cs index 2468a85420a..c60ca6ea38a 100644 --- a/v2rayN/v2rayN/ViewModels/RoutingRuleSettingViewModel.cs +++ b/v2rayN/v2rayN/ViewModels/RoutingRuleSettingViewModel.cs @@ -4,10 +4,7 @@ using Splat; using System.Reactive; using v2rayN.Base; -using v2rayN.Enums; using v2rayN.Handler; -using v2rayN.Models; -using v2rayN.Resx; namespace v2rayN.ViewModels { diff --git a/v2rayN/v2rayN/ViewModels/RoutingSettingViewModel.cs b/v2rayN/v2rayN/ViewModels/RoutingSettingViewModel.cs index 30a9853e549..d94261858ef 100644 --- a/v2rayN/v2rayN/ViewModels/RoutingSettingViewModel.cs +++ b/v2rayN/v2rayN/ViewModels/RoutingSettingViewModel.cs @@ -4,10 +4,7 @@ using Splat; using System.Reactive; using v2rayN.Base; -using v2rayN.Enums; using v2rayN.Handler; -using v2rayN.Models; -using v2rayN.Resx; namespace v2rayN.ViewModels { diff --git a/v2rayN/v2rayN/ViewModels/SubEditViewModel.cs b/v2rayN/v2rayN/ViewModels/SubEditViewModel.cs index 8d2434806fd..d74c51308d6 100644 --- a/v2rayN/v2rayN/ViewModels/SubEditViewModel.cs +++ b/v2rayN/v2rayN/ViewModels/SubEditViewModel.cs @@ -3,10 +3,7 @@ using Splat; using System.Reactive; using v2rayN.Base; -using v2rayN.Enums; using v2rayN.Handler; -using v2rayN.Models; -using v2rayN.Resx; namespace v2rayN.ViewModels { diff --git a/v2rayN/v2rayN/ViewModels/SubSettingViewModel.cs b/v2rayN/v2rayN/ViewModels/SubSettingViewModel.cs index e6f9b56d7a2..3b716d58fcc 100644 --- a/v2rayN/v2rayN/ViewModels/SubSettingViewModel.cs +++ b/v2rayN/v2rayN/ViewModels/SubSettingViewModel.cs @@ -5,10 +5,7 @@ using Splat; using System.Reactive; using v2rayN.Base; -using v2rayN.Enums; using v2rayN.Handler; -using v2rayN.Models; -using v2rayN.Resx; namespace v2rayN.ViewModels { diff --git a/v2rayN/v2rayN/ViewModels/ThemeSettingViewModel.cs b/v2rayN/v2rayN/ViewModels/ThemeSettingViewModel.cs index cc43c4e97d7..1e717bb5033 100644 --- a/v2rayN/v2rayN/ViewModels/ThemeSettingViewModel.cs +++ b/v2rayN/v2rayN/ViewModels/ThemeSettingViewModel.cs @@ -12,8 +12,6 @@ using System.Windows.Interop; using v2rayN.Base; using v2rayN.Handler; -using v2rayN.Models; -using v2rayN.Resx; namespace v2rayN.ViewModels { diff --git a/v2rayN/v2rayN/Views/AddServer2Window.xaml b/v2rayN/v2rayN/Views/AddServer2Window.xaml index 0dba073859b..06c7487869f 100644 --- a/v2rayN/v2rayN/Views/AddServer2Window.xaml +++ b/v2rayN/v2rayN/Views/AddServer2Window.xaml @@ -1,13 +1,13 @@  diff --git a/v2rayN/v2rayN/Views/MsgView.xaml.cs b/v2rayN/v2rayN/Views/MsgView.xaml.cs index baea1153450..a24ad37a28a 100644 --- a/v2rayN/v2rayN/Views/MsgView.xaml.cs +++ b/v2rayN/v2rayN/Views/MsgView.xaml.cs @@ -2,8 +2,6 @@ using System.Reactive.Linq; using System.Text.RegularExpressions; using System.Windows.Threading; -using v2rayN.Handler; -using v2rayN.Models; namespace v2rayN.Views { diff --git a/v2rayN/v2rayN/Views/OptionSettingWindow.xaml b/v2rayN/v2rayN/Views/OptionSettingWindow.xaml index a516181ae44..d3bb85aef5f 100644 --- a/v2rayN/v2rayN/Views/OptionSettingWindow.xaml +++ b/v2rayN/v2rayN/Views/OptionSettingWindow.xaml @@ -7,7 +7,7 @@ xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:reactiveui="http://reactiveui.net" - xmlns:resx="clr-namespace:v2rayN.Resx" + xmlns:resx="clr-namespace:ServiceLib.Resx;assembly=ServiceLib" xmlns:vms="clr-namespace:v2rayN.ViewModels" Title="{x:Static resx:ResUI.menuSetting}" Width="1000" diff --git a/v2rayN/v2rayN/Views/OptionSettingWindow.xaml.cs b/v2rayN/v2rayN/Views/OptionSettingWindow.xaml.cs index 01800f504b7..09bdbe4f142 100644 --- a/v2rayN/v2rayN/Views/OptionSettingWindow.xaml.cs +++ b/v2rayN/v2rayN/Views/OptionSettingWindow.xaml.cs @@ -4,9 +4,6 @@ using System.Reactive.Disposables; using System.Windows; using System.Windows.Media; -using v2rayN.Enums; -using v2rayN.Handler; -using v2rayN.Models; using v2rayN.ViewModels; namespace v2rayN.Views diff --git a/v2rayN/v2rayN/Views/ProfilesView.xaml b/v2rayN/v2rayN/Views/ProfilesView.xaml index a1f08a912d7..a8c0395859d 100644 --- a/v2rayN/v2rayN/Views/ProfilesView.xaml +++ b/v2rayN/v2rayN/Views/ProfilesView.xaml @@ -8,7 +8,7 @@ xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:reactiveui="http://reactiveui.net" - xmlns:resx="clr-namespace:v2rayN.Resx" + xmlns:resx="clr-namespace:ServiceLib.Resx;assembly=ServiceLib" xmlns:vms="clr-namespace:v2rayN.ViewModels" d:DesignHeight="450" d:DesignWidth="800" diff --git a/v2rayN/v2rayN/Views/ProfilesView.xaml.cs b/v2rayN/v2rayN/Views/ProfilesView.xaml.cs index d0b5c27dbc1..6bcdacc6659 100644 --- a/v2rayN/v2rayN/Views/ProfilesView.xaml.cs +++ b/v2rayN/v2rayN/Views/ProfilesView.xaml.cs @@ -10,10 +10,6 @@ using System.Windows.Media; using System.Windows.Threading; using v2rayN.Base; -using v2rayN.Enums; -using v2rayN.Handler; -using v2rayN.Models; -using v2rayN.Resx; using v2rayN.ViewModels; using Point = System.Windows.Point; @@ -294,7 +290,7 @@ private void LstProfiles_PreviewKeyDown(object sender, KeyEventArgs e) } else if (e.Key == Key.Escape) { - MessageBus.Current.SendMessage("true", Global.CommandStopSpeedTest); + ViewModel?.ServerSpeedtestStop(); } } } diff --git a/v2rayN/v2rayN/Views/QrcodeView.xaml b/v2rayN/v2rayN/Views/QrcodeView.xaml index 5a9868ffd42..602138efcda 100644 --- a/v2rayN/v2rayN/Views/QrcodeView.xaml +++ b/v2rayN/v2rayN/Views/QrcodeView.xaml @@ -5,7 +5,7 @@ xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" - xmlns:resx="clr-namespace:v2rayN.Resx" + xmlns:resx="clr-namespace:ServiceLib.Resx;assembly=ServiceLib" d:DesignHeight="300" d:DesignWidth="300" mc:Ignorable="d"> diff --git a/v2rayN/v2rayN/Views/RoutingRuleDetailsWindow.xaml b/v2rayN/v2rayN/Views/RoutingRuleDetailsWindow.xaml index e6b6c7fa36c..75307c9ff6b 100644 --- a/v2rayN/v2rayN/Views/RoutingRuleDetailsWindow.xaml +++ b/v2rayN/v2rayN/Views/RoutingRuleDetailsWindow.xaml @@ -6,8 +6,8 @@ xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" + xmlns:resx="clr-namespace:ServiceLib.Resx;assembly=ServiceLib" xmlns:conv="clr-namespace:v2rayN.Converters" - xmlns:resx="clr-namespace:v2rayN.Resx" xmlns:vms="clr-namespace:v2rayN.ViewModels" Title="{x:Static resx:ResUI.menuRoutingRuleDetailsSetting}" Width="900" diff --git a/v2rayN/v2rayN/Views/RoutingRuleDetailsWindow.xaml.cs b/v2rayN/v2rayN/Views/RoutingRuleDetailsWindow.xaml.cs index ce643ce2b74..903c06eef56 100644 --- a/v2rayN/v2rayN/Views/RoutingRuleDetailsWindow.xaml.cs +++ b/v2rayN/v2rayN/Views/RoutingRuleDetailsWindow.xaml.cs @@ -1,9 +1,6 @@ using ReactiveUI; using System.Reactive.Disposables; using System.Windows; -using v2rayN.Enums; -using v2rayN.Handler; -using v2rayN.Models; using v2rayN.ViewModels; namespace v2rayN.Views diff --git a/v2rayN/v2rayN/Views/RoutingRuleSettingWindow.xaml b/v2rayN/v2rayN/Views/RoutingRuleSettingWindow.xaml index 37f8a897c39..951b5ad006f 100644 --- a/v2rayN/v2rayN/Views/RoutingRuleSettingWindow.xaml +++ b/v2rayN/v2rayN/Views/RoutingRuleSettingWindow.xaml @@ -6,8 +6,8 @@ xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" + xmlns:resx="clr-namespace:ServiceLib.Resx;assembly=ServiceLib" xmlns:conv="clr-namespace:v2rayN.Converters" - xmlns:resx="clr-namespace:v2rayN.Resx" xmlns:vms="clr-namespace:v2rayN.ViewModels" Title="{x:Static resx:ResUI.menuRoutingRuleSetting}" Width="960" diff --git a/v2rayN/v2rayN/Views/RoutingRuleSettingWindow.xaml.cs b/v2rayN/v2rayN/Views/RoutingRuleSettingWindow.xaml.cs index acd027be87c..98208feb87d 100644 --- a/v2rayN/v2rayN/Views/RoutingRuleSettingWindow.xaml.cs +++ b/v2rayN/v2rayN/Views/RoutingRuleSettingWindow.xaml.cs @@ -2,10 +2,6 @@ using System.Reactive.Disposables; using System.Windows; using System.Windows.Input; -using v2rayN.Enums; -using v2rayN.Handler; -using v2rayN.Models; -using v2rayN.Resx; using v2rayN.ViewModels; namespace v2rayN.Views diff --git a/v2rayN/v2rayN/Views/RoutingSettingWindow.xaml b/v2rayN/v2rayN/Views/RoutingSettingWindow.xaml index e463d15dd74..36af5467949 100644 --- a/v2rayN/v2rayN/Views/RoutingSettingWindow.xaml +++ b/v2rayN/v2rayN/Views/RoutingSettingWindow.xaml @@ -7,7 +7,7 @@ xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:reactiveui="http://reactiveui.net" - xmlns:resx="clr-namespace:v2rayN.Resx" + xmlns:resx="clr-namespace:ServiceLib.Resx;assembly=ServiceLib" xmlns:vms="clr-namespace:v2rayN.ViewModels" Title="{x:Static resx:ResUI.menuRoutingSetting}" Width="990" diff --git a/v2rayN/v2rayN/Views/RoutingSettingWindow.xaml.cs b/v2rayN/v2rayN/Views/RoutingSettingWindow.xaml.cs index f74cdebc765..b8cfbd9980d 100644 --- a/v2rayN/v2rayN/Views/RoutingSettingWindow.xaml.cs +++ b/v2rayN/v2rayN/Views/RoutingSettingWindow.xaml.cs @@ -2,10 +2,6 @@ using System.Reactive.Disposables; using System.Windows; using System.Windows.Input; -using v2rayN.Enums; -using v2rayN.Handler; -using v2rayN.Models; -using v2rayN.Resx; using v2rayN.ViewModels; namespace v2rayN.Views diff --git a/v2rayN/v2rayN/Views/SubEditWindow.xaml b/v2rayN/v2rayN/Views/SubEditWindow.xaml index 75ce601d602..d231a2b6215 100644 --- a/v2rayN/v2rayN/Views/SubEditWindow.xaml +++ b/v2rayN/v2rayN/Views/SubEditWindow.xaml @@ -7,7 +7,7 @@ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:conv="clr-namespace:v2rayN.Converters" - xmlns:resx="clr-namespace:v2rayN.Resx" + xmlns:resx="clr-namespace:ServiceLib.Resx;assembly=ServiceLib" xmlns:vms="clr-namespace:v2rayN.ViewModels" Title="{x:Static resx:ResUI.menuSubSetting}" Width="700" diff --git a/v2rayN/v2rayN/Views/SubEditWindow.xaml.cs b/v2rayN/v2rayN/Views/SubEditWindow.xaml.cs index a8fed5b0183..8dd18a11b00 100644 --- a/v2rayN/v2rayN/Views/SubEditWindow.xaml.cs +++ b/v2rayN/v2rayN/Views/SubEditWindow.xaml.cs @@ -1,9 +1,6 @@ using ReactiveUI; using System.Reactive.Disposables; using System.Windows; -using v2rayN.Enums; -using v2rayN.Handler; -using v2rayN.Models; using v2rayN.ViewModels; namespace v2rayN.Views diff --git a/v2rayN/v2rayN/Views/SubSettingWindow.xaml b/v2rayN/v2rayN/Views/SubSettingWindow.xaml index 29455ea0460..ba388e25288 100644 --- a/v2rayN/v2rayN/Views/SubSettingWindow.xaml +++ b/v2rayN/v2rayN/Views/SubSettingWindow.xaml @@ -7,7 +7,7 @@ xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:reactiveui="http://reactiveui.net" - xmlns:resx="clr-namespace:v2rayN.Resx" + xmlns:resx="clr-namespace:ServiceLib.Resx;assembly=ServiceLib" xmlns:vms="clr-namespace:v2rayN.ViewModels" Title="{x:Static resx:ResUI.menuSubSetting}" Width="800" diff --git a/v2rayN/v2rayN/Views/SubSettingWindow.xaml.cs b/v2rayN/v2rayN/Views/SubSettingWindow.xaml.cs index 5e1a4ac9f9e..4205abd28a9 100644 --- a/v2rayN/v2rayN/Views/SubSettingWindow.xaml.cs +++ b/v2rayN/v2rayN/Views/SubSettingWindow.xaml.cs @@ -4,10 +4,6 @@ using System.Reactive.Disposables; using System.Windows; using System.Windows.Input; -using v2rayN.Enums; -using v2rayN.Handler; -using v2rayN.Models; -using v2rayN.Resx; using v2rayN.ViewModels; namespace v2rayN.Views diff --git a/v2rayN/v2rayN/Views/ThemeSettingView.xaml b/v2rayN/v2rayN/Views/ThemeSettingView.xaml index a274268afe9..a0882507f48 100644 --- a/v2rayN/v2rayN/Views/ThemeSettingView.xaml +++ b/v2rayN/v2rayN/Views/ThemeSettingView.xaml @@ -7,7 +7,7 @@ xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:reactiveui="http://reactiveui.net" - xmlns:resx="clr-namespace:v2rayN.Resx" + xmlns:resx="clr-namespace:ServiceLib.Resx;assembly=ServiceLib" xmlns:vms="clr-namespace:v2rayN.ViewModels" d:DesignHeight="450" d:DesignWidth="800" diff --git a/v2rayN/v2rayN/v2rayN.csproj b/v2rayN/v2rayN/v2rayN.csproj index 972307ef2a5..1570e984901 100644 --- a/v2rayN/v2rayN/v2rayN.csproj +++ b/v2rayN/v2rayN/v2rayN.csproj @@ -15,71 +15,18 @@ - - - - - - - - - Never - - - Never - - - Never - - - Never - - - Never - - - Never - - - Never - - - Never - - - Never - - - Never - - - Never - - - - Never - - - Never - - - Never - - - Never - Never @@ -93,34 +40,7 @@ - - - - - - True - True - ResUI.resx - - - - - - PublicResXFileCodeGenerator - ResUI.Designer.cs - - - PublicResXFileCodeGenerator - - - PublicResXFileCodeGenerator - - - PublicResXFileCodeGenerator - - - PublicResXFileCodeGenerator - +