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 (88%) rename v2rayN/{v2rayN => ServiceLib}/Enums/ECoreType.cs (91%) rename v2rayN/{v2rayN => ServiceLib}/Enums/EGirdOrientation.cs (75%) rename v2rayN/{v2rayN => ServiceLib}/Enums/EGlobalHotkey.cs (85%) rename v2rayN/{v2rayN => ServiceLib}/Enums/EInboundProtocol.cs (84%) rename v2rayN/{v2rayN => ServiceLib}/Enums/EMove.cs (80%) rename v2rayN/{v2rayN => ServiceLib}/Enums/ERuleMode.cs (79%) 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 (84%) 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 (96%) 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 (82%) rename v2rayN/{v2rayN => ServiceLib}/Models/ClashProxies.cs (95%) rename v2rayN/{v2rayN => ServiceLib}/Models/ClashProxyModel.cs (64%) rename v2rayN/{v2rayN => ServiceLib}/Models/ComboItem.cs (84%) 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 (79%) rename v2rayN/{v2rayN => ServiceLib}/Models/RulesItem.cs (94%) rename v2rayN/{v2rayN => ServiceLib}/Models/RulesItemModel.cs (88%) rename v2rayN/{v2rayN => ServiceLib}/Models/ServerSpeedItem.cs (94%) rename v2rayN/{v2rayN => ServiceLib}/Models/ServerStatItem.cs (94%) rename v2rayN/{v2rayN => ServiceLib}/Models/ServerTestItem.cs (77%) rename v2rayN/{v2rayN => ServiceLib}/Models/SingboxConfig.cs (99%) rename v2rayN/{v2rayN => ServiceLib}/Models/SpeedTestResult.cs (86%) rename v2rayN/{v2rayN => ServiceLib}/Models/SsSIP008.cs (92%) rename v2rayN/{v2rayN => ServiceLib}/Models/SubItem.cs (96%) rename v2rayN/{v2rayN => ServiceLib}/Models/SysProxyConfig.cs (85%) 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 ddfe3811..b4164039 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 b721f5db..39cfeb59 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 @@ namespace v2rayN } 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 60f9ad2b..dd730dbf 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 c25a2221..0cd623fb 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 ab81d41e..d7650d2c 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 ba5b97e7..c212fd17 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 113f2824..76767656 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 597ed970..ec4c4931 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 70beb810..9faa72ba 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 9a751ce9..008af348 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 c4fb551e..77587642 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.Security.Cryptography; 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 3a4f9387..7fd4c67e 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 88% rename from v2rayN/v2rayN/Enums/EConfigType.cs rename to v2rayN/ServiceLib/Enums/EConfigType.cs index 60ef796a..b7005e4a 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 54c07887..cfaffb9f 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 75% rename from v2rayN/v2rayN/Enums/EGirdOrientation.cs rename to v2rayN/ServiceLib/Enums/EGirdOrientation.cs index e7f9749f..1a62c7bb 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 85% rename from v2rayN/v2rayN/Enums/EGlobalHotkey.cs rename to v2rayN/ServiceLib/Enums/EGlobalHotkey.cs index f4a92bdb..328bf36e 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 84% rename from v2rayN/v2rayN/Enums/EInboundProtocol.cs rename to v2rayN/ServiceLib/Enums/EInboundProtocol.cs index 07cd1369..c1ff81ea 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 80% rename from v2rayN/v2rayN/Enums/EMove.cs rename to v2rayN/ServiceLib/Enums/EMove.cs index fcbc23dc..ced5a4e6 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 79% rename from v2rayN/v2rayN/Enums/ERuleMode.cs rename to v2rayN/ServiceLib/Enums/ERuleMode.cs index 59a01430..179384d5 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 453dbe88..448f4cdc 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 e0663d92..63f13919 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 b0857612..84beaffe 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 84% rename from v2rayN/v2rayN/Enums/ETransport.cs rename to v2rayN/ServiceLib/Enums/ETransport.cs index 349d68e7..f313db9c 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 b90682a1..3331cead 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 ed548b81..44720c71 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 @@ namespace v2rayN 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 00000000..5470f5eb --- /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 b749e2cd..a85b4b5c 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 8e8c0853..0d1d96ca 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 @@ namespace v2rayN.Handler 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 b29a571a..878e7d7c 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 b8aa4b40..21162aad 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 baa384c9..ba6fc69d 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 7a9a578f..9e092ae3 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 93652136..6eddc956 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 e0b83c8b..09e2d321 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 99ba06a6..1674232b 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 e13eadc4..5205067b 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 90d96749..f68c2474 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 af0cffe7..03e9bf96 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 f205861f..145a907e 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 3e523170..325cf9b6 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 495f0d50..98460640 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 c8221afe..c6d4ad78 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 ae99f3f8..de5ef5c8 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 71f23805..d32e1f56 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 f1c64cd9..2f473681 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 ed34c9a2..770166e1 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 b7451ca2..f4d3b570 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 7a04d56c..340ec04c 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 08af7262..571a38ab 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 3017466f..a8fd5b97 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 2d7fc932..460692af 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 3744417d..07636cb1 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 @@ namespace v2rayN.Handler } } + public void ExitLoop() + { + _exitLoop = true; + UpdateFunc("", ResUI.SpeedtestingStop); + } + private Task RunTcping() { try @@ -215,20 +213,9 @@ namespace v2rayN.Handler 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; @@ -288,20 +275,9 @@ namespace v2rayN.Handler 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 3b789c75..6ca0d4f3 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 e4860b16..b4627caf 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 331ccde1..55b15b30 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 96% rename from v2rayN/v2rayN/Handler/TaskHandler.cs rename to v2rayN/ServiceLib/Handler/TaskHandler.cs index e7657ccd..e7b9ad93 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 4f2e1be6..73492c30 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 @@ namespace v2rayN.Handler 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 @@ namespace v2rayN.Handler { 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 @@ namespace v2rayN.Handler } 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 @@ namespace v2rayN.Handler { 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 @@ namespace v2rayN.Handler } 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 @@ namespace v2rayN.Handler 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 @@ namespace v2rayN.Handler string fileName = Utils.GetTempPath(Utils.GetDownloadFileName(url)); if (File.Exists(fileName)) { - //Global.coreTypes.ForEach(it => - //{ - // 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 94911d58..5d987a01 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 439e3944..b5fb2fcf 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 82% rename from v2rayN/v2rayN/Models/ClashProviders.cs rename to v2rayN/ServiceLib/Models/ClashProviders.cs index 28e387d5..ca64e0d2 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 4e8560c8..b2fddeed 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 64% rename from v2rayN/v2rayN/Models/ClashProxyModel.cs rename to v2rayN/ServiceLib/Models/ClashProxyModel.cs index 13baeb1c..e648b85a 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 84% rename from v2rayN/v2rayN/Models/ComboItem.cs rename to v2rayN/ServiceLib/Models/ComboItem.cs index 836d88bd..f1b013ad 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 f7e78e61..062cd501 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 b7c9c46f..ec7f746a 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 ad773c8c..e1620953 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 944eea95..d40bad55 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 84520d14..804753d8 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 b572bd50..ba3f97c2 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 8fb05bad..8c9092c6 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 8208d576..750a8d91 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 de5cfb2a..6f51821e 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 79% rename from v2rayN/v2rayN/Models/RoutingItemModel.cs rename to v2rayN/ServiceLib/Models/RoutingItemModel.cs index 3e2fd4fc..28461612 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 94% rename from v2rayN/v2rayN/Models/RulesItem.cs rename to v2rayN/ServiceLib/Models/RulesItem.cs index 78c4e846..7581d435 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 88% rename from v2rayN/v2rayN/Models/RulesItemModel.cs rename to v2rayN/ServiceLib/Models/RulesItemModel.cs index fbe7c57a..adffb011 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 d5411d32..09c5e6ba 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 94% rename from v2rayN/v2rayN/Models/ServerStatItem.cs rename to v2rayN/ServiceLib/Models/ServerStatItem.cs index a24b78b0..16939d1f 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 77% rename from v2rayN/v2rayN/Models/ServerTestItem.cs rename to v2rayN/ServiceLib/Models/ServerTestItem.cs index 8faea95e..de5c2869 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 c0dd2b5f..12689a1a 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 08fc38fa..63016bfc 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 92% rename from v2rayN/v2rayN/Models/SsSIP008.cs rename to v2rayN/ServiceLib/Models/SsSIP008.cs index 3600a438..9e3d14a8 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 1f36bb9a..5c361d93 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 85% rename from v2rayN/v2rayN/Models/SysProxyConfig.cs rename to v2rayN/ServiceLib/Models/SysProxyConfig.cs index 95c2221b..6cc95824 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 b86f4720..1118a193 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 89158f19..98564415 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 e37d5c62..92f93bf3 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 9cab6ac7..e962417b 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 @@ namespace v2rayN.Resx { private static global::System.Globalization.CultureInfo resourceCulture; [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - internal ResUI() { + public ResUI() { } /// @@ -39,7 +39,7 @@ namespace v2rayN.Resx { 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 00000000..47b0750a --- /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 df0929a5..f4afd009 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 3b7aefee..04a602cb 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 73467ee3..f5b543c2 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 8464e1ee..b326c7cb 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 0e8fac70..37d17f82 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 00000000..42722976 --- /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 4dbe2ba4..d3010fa7 100644 --- a/v2rayN/v2rayN/Handler/HotkeyHandler.cs +++ b/v2rayN/v2rayN/Handler/HotkeyHandler.cs @@ -4,9 +4,6 @@ using System.Text; 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 af73e311..1efe3d76 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 4b6f62ba..736b8892 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 4cc62f35..97ea82e7 100644 --- a/v2rayN/v2rayN/ViewModels/AddServer2ViewModel.cs +++ b/v2rayN/v2rayN/ViewModels/AddServer2ViewModel.cs @@ -4,10 +4,7 @@ using Splat; 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 12c86f9c..c5502508 100644 --- a/v2rayN/v2rayN/ViewModels/AddServerViewModel.cs +++ b/v2rayN/v2rayN/ViewModels/AddServerViewModel.cs @@ -3,10 +3,7 @@ using ReactiveUI.Fody.Helpers; 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 5d29d2cf..529088ec 100644 --- a/v2rayN/v2rayN/ViewModels/ClashConnectionsViewModel.cs +++ b/v2rayN/v2rayN/ViewModels/ClashConnectionsViewModel.cs @@ -5,9 +5,6 @@ using ReactiveUI.Fody.Helpers; 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 3a74ca49..2a7fe3e5 100644 --- a/v2rayN/v2rayN/ViewModels/ClashProxiesViewModel.cs +++ b/v2rayN/v2rayN/ViewModels/ClashProxiesViewModel.cs @@ -6,12 +6,9 @@ using Splat; 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 @@ namespace v2rayN.ViewModels _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 ea3ce40d..571ff8d3 100644 --- a/v2rayN/v2rayN/ViewModels/DNSSettingViewModel.cs +++ b/v2rayN/v2rayN/ViewModels/DNSSettingViewModel.cs @@ -3,10 +3,7 @@ using ReactiveUI.Fody.Helpers; 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 e48577da..d9ca6b90 100644 --- a/v2rayN/v2rayN/ViewModels/MainWindowViewModel.cs +++ b/v2rayN/v2rayN/ViewModels/MainWindowViewModel.cs @@ -8,11 +8,7 @@ using System.Reactive; 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 @@ namespace v2rayN.ViewModels _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 286ef3aa..46f6bced 100644 --- a/v2rayN/v2rayN/ViewModels/OptionSettingViewModel.cs +++ b/v2rayN/v2rayN/ViewModels/OptionSettingViewModel.cs @@ -3,10 +3,7 @@ using ReactiveUI.Fody.Helpers; 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 0d395a16..d2d83daf 100644 --- a/v2rayN/v2rayN/ViewModels/ProfilesViewModel.cs +++ b/v2rayN/v2rayN/ViewModels/ProfilesViewModel.cs @@ -7,12 +7,7 @@ using System.Reactive; 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 @@ namespace v2rayN.ViewModels private string _serverFilter = string.Empty; private Dictionary _dicHeaderSort = new(); + private SpeedtestHandler? _speedtestHandler; #endregion private prop @@ -676,10 +672,15 @@ namespace v2rayN.ViewModels 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 087a9546..31ab1a0b 100644 --- a/v2rayN/v2rayN/ViewModels/RoutingRuleDetailsViewModel.cs +++ b/v2rayN/v2rayN/ViewModels/RoutingRuleDetailsViewModel.cs @@ -3,10 +3,7 @@ using ReactiveUI.Fody.Helpers; 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 2468a854..c60ca6ea 100644 --- a/v2rayN/v2rayN/ViewModels/RoutingRuleSettingViewModel.cs +++ b/v2rayN/v2rayN/ViewModels/RoutingRuleSettingViewModel.cs @@ -4,10 +4,7 @@ using ReactiveUI.Fody.Helpers; 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 30a9853e..d9426185 100644 --- a/v2rayN/v2rayN/ViewModels/RoutingSettingViewModel.cs +++ b/v2rayN/v2rayN/ViewModels/RoutingSettingViewModel.cs @@ -4,10 +4,7 @@ using ReactiveUI.Fody.Helpers; 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 8d243480..d74c5130 100644 --- a/v2rayN/v2rayN/ViewModels/SubEditViewModel.cs +++ b/v2rayN/v2rayN/ViewModels/SubEditViewModel.cs @@ -3,10 +3,7 @@ using ReactiveUI.Fody.Helpers; 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 e6f9b56d..3b716d58 100644 --- a/v2rayN/v2rayN/ViewModels/SubSettingViewModel.cs +++ b/v2rayN/v2rayN/ViewModels/SubSettingViewModel.cs @@ -5,10 +5,7 @@ using ReactiveUI.Fody.Helpers; 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 cc43c4e9..1e717bb5 100644 --- a/v2rayN/v2rayN/ViewModels/ThemeSettingViewModel.cs +++ b/v2rayN/v2rayN/ViewModels/ThemeSettingViewModel.cs @@ -12,8 +12,6 @@ using System.Windows; 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 0dba0738..06c74878 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 baea1153..a24ad37a 100644 --- a/v2rayN/v2rayN/Views/MsgView.xaml.cs +++ b/v2rayN/v2rayN/Views/MsgView.xaml.cs @@ -2,8 +2,6 @@ using ReactiveUI; 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 a516181a..d3bb85ae 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 01800f50..09bdbe4f 100644 --- a/v2rayN/v2rayN/Views/OptionSettingWindow.xaml.cs +++ b/v2rayN/v2rayN/Views/OptionSettingWindow.xaml.cs @@ -4,9 +4,6 @@ using System.IO; 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 a1f08a91..a8c03958 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 d0b5c27d..6bcdacc6 100644 --- a/v2rayN/v2rayN/Views/ProfilesView.xaml.cs +++ b/v2rayN/v2rayN/Views/ProfilesView.xaml.cs @@ -10,10 +10,6 @@ using System.Windows.Input; 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 @@ namespace v2rayN.Views } 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 5a9868ff..602138ef 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 e6b6c7fa..75307c9f 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 ce643ce2..903c06ee 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 37f8a897..951b5ad0 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 acd027be..98208feb 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 e463d15d..36af5467 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 f74cdebc..b8cfbd99 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 75ce601d..d231a2b6 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 a8fed5b0..8dd18a11 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 29455ea0..ba388e25 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 5e1a4ac9..4205abd2 100644 --- a/v2rayN/v2rayN/Views/SubSettingWindow.xaml.cs +++ b/v2rayN/v2rayN/Views/SubSettingWindow.xaml.cs @@ -4,10 +4,6 @@ using System.ComponentModel; 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 a274268a..a0882507 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 972307ef..1570e984 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 - +