diff --git a/src/BD.WTTS.Client.IPC/BD.WTTS.Client.IPC.csproj b/src/BD.WTTS.Client.IPC/BD.WTTS.Client.IPC.csproj
index c28768829..77a0b213e 100644
--- a/src/BD.WTTS.Client.IPC/BD.WTTS.Client.IPC.csproj
+++ b/src/BD.WTTS.Client.IPC/BD.WTTS.Client.IPC.csproj
@@ -26,9 +26,9 @@
Properties
-
+
Services
@@ -38,6 +38,9 @@
Services\UI\Widgets
+
+ Enums
+
@@ -46,6 +49,10 @@
+
+
+
+
diff --git a/src/BD.WTTS.Client.IPC/Services/IPCSubProcessService.cs b/src/BD.WTTS.Client.IPC/Services/IPCSubProcessService.cs
index 8f08309f6..1956ea196 100644
--- a/src/BD.WTTS.Client.IPC/Services/IPCSubProcessService.cs
+++ b/src/BD.WTTS.Client.IPC/Services/IPCSubProcessService.cs
@@ -1,5 +1,4 @@
using dotnetCampus.Ipc.Pipes;
-using ExitCode = BD.WTTS.Startup.CommandExitCode;
namespace BD.WTTS.Services;
@@ -44,15 +43,15 @@ public interface IPCSubProcessService : IDisposable
params string[] args)
{
if (args.Length < 2)
- return (int)ExitCode.EmptyArrayArgs;
+ return (int)CommandExitCode.EmptyArrayArgs;
var pipeName = args[0];
if (string.IsNullOrWhiteSpace(pipeName))
- return (int)ExitCode.EmptyPipeName;
+ return (int)CommandExitCode.EmptyPipeName;
if (!int.TryParse(args[1], out var pid))
- return (int)ExitCode.EmptyMainProcessId;
+ return (int)CommandExitCode.EmptyMainProcessId;
var mainProcess = Process.GetProcessById(pid);
if (mainProcess == null)
- return (int)ExitCode.NotFoundMainProcessId;
+ return (int)CommandExitCode.NotFoundMainProcessId;
TaskCompletionSource tcs = new();
mainProcess.EnableRaisingEvents = true;
diff --git a/src/BD.WTTS.Client.Plugins.Accelerator.ReverseProxy/BD.WTTS.Client.Plugins.Accelerator.ReverseProxy.csproj b/src/BD.WTTS.Client.Plugins.Accelerator.ReverseProxy/BD.WTTS.Client.Plugins.Accelerator.ReverseProxy.csproj
index fbda3d7c0..57e8f3c8b 100644
--- a/src/BD.WTTS.Client.Plugins.Accelerator.ReverseProxy/BD.WTTS.Client.Plugins.Accelerator.ReverseProxy.csproj
+++ b/src/BD.WTTS.Client.Plugins.Accelerator.ReverseProxy/BD.WTTS.Client.Plugins.Accelerator.ReverseProxy.csproj
@@ -31,6 +31,12 @@
Properties
+
+ Properties
+
+
+ Properties
+
diff --git a/src/BD.WTTS.Client.Plugins.Accelerator.ReverseProxy/Models/IReverseProxyConfig.GlobalListener.cs b/src/BD.WTTS.Client.Plugins.Accelerator.ReverseProxy/Models/Abstractions/IReverseProxyConfig.GlobalListener.cs
similarity index 98%
rename from src/BD.WTTS.Client.Plugins.Accelerator.ReverseProxy/Models/IReverseProxyConfig.GlobalListener.cs
rename to src/BD.WTTS.Client.Plugins.Accelerator.ReverseProxy/Models/Abstractions/IReverseProxyConfig.GlobalListener.cs
index 3158752ff..3e33d70c1 100644
--- a/src/BD.WTTS.Client.Plugins.Accelerator.ReverseProxy/Models/IReverseProxyConfig.GlobalListener.cs
+++ b/src/BD.WTTS.Client.Plugins.Accelerator.ReverseProxy/Models/Abstractions/IReverseProxyConfig.GlobalListener.cs
@@ -4,7 +4,7 @@
using System.Net.NetworkInformation;
// ReSharper disable once CheckNamespace
-namespace BD.WTTS.Models;
+namespace BD.WTTS.Models.Abstractions;
partial interface IReverseProxyConfig
{
diff --git a/src/BD.WTTS.Client.Plugins.Accelerator.ReverseProxy/Models/IReverseProxyConfig.cs b/src/BD.WTTS.Client.Plugins.Accelerator.ReverseProxy/Models/Abstractions/IReverseProxyConfig.cs
similarity index 97%
rename from src/BD.WTTS.Client.Plugins.Accelerator.ReverseProxy/Models/IReverseProxyConfig.cs
rename to src/BD.WTTS.Client.Plugins.Accelerator.ReverseProxy/Models/Abstractions/IReverseProxyConfig.cs
index fbdc7008e..84c6d5ea9 100644
--- a/src/BD.WTTS.Client.Plugins.Accelerator.ReverseProxy/Models/IReverseProxyConfig.cs
+++ b/src/BD.WTTS.Client.Plugins.Accelerator.ReverseProxy/Models/Abstractions/IReverseProxyConfig.cs
@@ -2,7 +2,7 @@
// https://github.com/dotnetcore/FastGithub/blob/2.1.4/FastGithub.Configuration/FastGithubConfig.cs
// ReSharper disable once CheckNamespace
-namespace BD.WTTS.Models;
+namespace BD.WTTS.Models.Abstractions;
public partial interface IReverseProxyConfig
{
diff --git a/src/BD.WTTS.Client.Plugins.Accelerator.ReverseProxy/Program.cs b/src/BD.WTTS.Client.Plugins.Accelerator.ReverseProxy/Program.cs
index 306b994b0..11914259e 100644
--- a/src/BD.WTTS.Client.Plugins.Accelerator.ReverseProxy/Program.cs
+++ b/src/BD.WTTS.Client.Plugins.Accelerator.ReverseProxy/Program.cs
@@ -3,6 +3,9 @@ using IHttpClientFactory_Common = System.Net.Http.Client.IHttpClientFactory;
using IHttpClientFactory_Extensions_Http = System.Net.Http.IHttpClientFactory;
const string moduleName = "Accelerator";
+#if DEBUG
+Console.WriteLine($"This: {moduleName} / Program.Start");
+#endif
try
{
var exitCode = await IPCSubProcessService.MainAsync(moduleName, ConfigureServices, static ipcProvider =>
diff --git a/src/BD.WTTS.Client.Plugins.Accelerator.ReverseProxy/Properties/ImplicitUsings.cs b/src/BD.WTTS.Client.Plugins.Accelerator.ReverseProxy/Properties/ImplicitUsings.cs
deleted file mode 100644
index 2604111bd..000000000
--- a/src/BD.WTTS.Client.Plugins.Accelerator.ReverseProxy/Properties/ImplicitUsings.cs
+++ /dev/null
@@ -1,10 +0,0 @@
-// C# 10 定义全局 using
-
-#pragma warning disable IDE0079 // 请删除不必要的忽略
-#pragma warning disable IDE0005
-#pragma warning disable SA1209 // Using alias directives should be placed after other using directives
-#pragma warning disable SA1211 // Using alias directives should be ordered alphabetically by alias name
-
-global using BD.WTTS.Enums;
-
-global using BD.WTTS.Models;
\ No newline at end of file
diff --git a/src/BD.WTTS.Client.Plugins.Accelerator.ReverseProxy/Services.Implementation/HttpServer/Certificates/CertService.cs b/src/BD.WTTS.Client.Plugins.Accelerator.ReverseProxy/Services.Implementation/HttpServer/Certificates/CertService.cs
index 17899253c..a63fd8f3b 100644
--- a/src/BD.WTTS.Client.Plugins.Accelerator.ReverseProxy/Services.Implementation/HttpServer/Certificates/CertService.cs
+++ b/src/BD.WTTS.Client.Plugins.Accelerator.ReverseProxy/Services.Implementation/HttpServer/Certificates/CertService.cs
@@ -13,7 +13,7 @@ sealed class CertService
readonly ILogger logger;
readonly IReverseProxyConfig reverseProxyConfig;
- IReverseProxyService ReverseProxyService => reverseProxyConfig.Service;
+ ReverseProxyServiceImpl ReverseProxyService => reverseProxyConfig.Service;
///
/// 获取 CER 证书文件路径
diff --git a/src/BD.WTTS.Client.Plugins.Accelerator.ReverseProxy/Services.Implementation/LazyReverseProxyServiceImpl.cs b/src/BD.WTTS.Client.Plugins.Accelerator.ReverseProxy/Services.Implementation/LazyReverseProxyServiceImpl.cs
index 172159f0f..60df75a22 100644
--- a/src/BD.WTTS.Client.Plugins.Accelerator.ReverseProxy/Services.Implementation/LazyReverseProxyServiceImpl.cs
+++ b/src/BD.WTTS.Client.Plugins.Accelerator.ReverseProxy/Services.Implementation/LazyReverseProxyServiceImpl.cs
@@ -9,7 +9,7 @@ sealed class LazyReverseProxyServiceImpl : IReverseProxyService
static IReverseProxyService instance() => Ioc.Get();
#pragma warning restore IDE1006 // 命名样式
- public ICertificateManager CertificateManager => instance().CertificateManager;
+ //public ICertificateManager CertificateManager => instance().CertificateManager;
public bool ProxyRunning => instance().ProxyRunning;
diff --git a/src/BD.WTTS.Client.Plugins.Accelerator.ReverseProxy/Services.Implementation/PacketIntercept/GitInterceptor.cs b/src/BD.WTTS.Client.Plugins.Accelerator.ReverseProxy/Services.Implementation/PacketIntercept/GitInterceptor.cs
index 9103fd5ed..517ef9a06 100644
--- a/src/BD.WTTS.Client.Plugins.Accelerator.ReverseProxy/Services.Implementation/PacketIntercept/GitInterceptor.cs
+++ b/src/BD.WTTS.Client.Plugins.Accelerator.ReverseProxy/Services.Implementation/PacketIntercept/GitInterceptor.cs
@@ -2,7 +2,7 @@
#if WINDOWS
-using static BD.WTTS.Models.IReverseProxyConfig;
+using static BD.WTTS.Models.Abstractions.IReverseProxyConfig;
// ReSharper disable once CheckNamespace
namespace BD.WTTS.Services.Implementation;
diff --git a/src/BD.WTTS.Client.Plugins.Accelerator.ReverseProxy/Services.Implementation/PacketIntercept/HttpInterceptor.cs b/src/BD.WTTS.Client.Plugins.Accelerator.ReverseProxy/Services.Implementation/PacketIntercept/HttpInterceptor.cs
index e34e2eb95..3d3871a91 100644
--- a/src/BD.WTTS.Client.Plugins.Accelerator.ReverseProxy/Services.Implementation/PacketIntercept/HttpInterceptor.cs
+++ b/src/BD.WTTS.Client.Plugins.Accelerator.ReverseProxy/Services.Implementation/PacketIntercept/HttpInterceptor.cs
@@ -2,7 +2,7 @@
#if WINDOWS
-using static BD.WTTS.Models.IReverseProxyConfig;
+using static BD.WTTS.Models.Abstractions.IReverseProxyConfig;
// ReSharper disable once CheckNamespace
namespace BD.WTTS.Services.Implementation;
diff --git a/src/BD.WTTS.Client.Plugins.Accelerator.ReverseProxy/Services.Implementation/PacketIntercept/HttpsInterceptor.cs b/src/BD.WTTS.Client.Plugins.Accelerator.ReverseProxy/Services.Implementation/PacketIntercept/HttpsInterceptor.cs
index 9725eb8eb..717dbb8bf 100644
--- a/src/BD.WTTS.Client.Plugins.Accelerator.ReverseProxy/Services.Implementation/PacketIntercept/HttpsInterceptor.cs
+++ b/src/BD.WTTS.Client.Plugins.Accelerator.ReverseProxy/Services.Implementation/PacketIntercept/HttpsInterceptor.cs
@@ -2,7 +2,7 @@
#if WINDOWS
-using static BD.WTTS.Models.IReverseProxyConfig;
+using static BD.WTTS.Models.Abstractions.IReverseProxyConfig;
// ReSharper disable once CheckNamespace
namespace BD.WTTS.Services.Implementation;
diff --git a/src/BD.WTTS.Client.Plugins.Accelerator.ReverseProxy/Services.Implementation/PacketIntercept/SshInterceptor.cs b/src/BD.WTTS.Client.Plugins.Accelerator.ReverseProxy/Services.Implementation/PacketIntercept/SshInterceptor.cs
index 2c6df84d2..253a85bd4 100644
--- a/src/BD.WTTS.Client.Plugins.Accelerator.ReverseProxy/Services.Implementation/PacketIntercept/SshInterceptor.cs
+++ b/src/BD.WTTS.Client.Plugins.Accelerator.ReverseProxy/Services.Implementation/PacketIntercept/SshInterceptor.cs
@@ -2,7 +2,7 @@
#if WINDOWS
-using static BD.WTTS.Models.IReverseProxyConfig;
+using static BD.WTTS.Models.Abstractions.IReverseProxyConfig;
// ReSharper disable once CheckNamespace
namespace BD.WTTS.Services.Implementation;
diff --git a/src/BD.WTTS.Client.Plugins.Accelerator.ReverseProxy/Services.Implementation/PacketIntercept/TcpInterceptHostedService.cs b/src/BD.WTTS.Client.Plugins.Accelerator.ReverseProxy/Services.Implementation/PacketIntercept/TcpInterceptHostedService.cs
index 9fa7e8cb9..13844a5f1 100644
--- a/src/BD.WTTS.Client.Plugins.Accelerator.ReverseProxy/Services.Implementation/PacketIntercept/TcpInterceptHostedService.cs
+++ b/src/BD.WTTS.Client.Plugins.Accelerator.ReverseProxy/Services.Implementation/PacketIntercept/TcpInterceptHostedService.cs
@@ -2,7 +2,7 @@
#if WINDOWS
-using static BD.WTTS.Models.IReverseProxyConfig;
+using static BD.WTTS.Models.Abstractions.IReverseProxyConfig;
// ReSharper disable once CheckNamespace
namespace BD.WTTS.Services.Implementation;
diff --git a/src/BD.WTTS.Client.Plugins.Accelerator.ReverseProxy/Services/IReverseProxyService.Constants.cs b/src/BD.WTTS.Client.Plugins.Accelerator.ReverseProxy/Services/IReverseProxyService.Constants.cs
index 21a84ef14..10dced25c 100644
--- a/src/BD.WTTS.Client.Plugins.Accelerator.ReverseProxy/Services/IReverseProxyService.Constants.cs
+++ b/src/BD.WTTS.Client.Plugins.Accelerator.ReverseProxy/Services/IReverseProxyService.Constants.cs
@@ -6,7 +6,7 @@ namespace BD.WTTS.Services;
///
/// 反向代理服务
///
-[IpcPublic(Timeout = 55000, IgnoresIpcException = false)]
+[IpcPublic(Timeout = 9000, IgnoresIpcException = false)]
public partial interface IReverseProxyService : IDisposable, IReverseProxySettings
{
///
@@ -52,6 +52,13 @@ public partial interface IReverseProxyService : IDisposable, IReverseProxySettin
///
///
ValueTask StopProxyAsync();
+
+#if DEBUG
+ string GetDebugString()
+ {
+ return $"Pid: {Environment.ProcessId}, Exe: {Environment.ProcessPath}, Asm: {Assembly.GetAssembly(GetType())?.FullName}";
+ }
+#endif
}
///
diff --git a/src/BD.WTTS.Client.Plugins.Accelerator.ReverseProxy/Services/IReverseProxyService.cs b/src/BD.WTTS.Client.Plugins.Accelerator.ReverseProxy/Services/IReverseProxyService.cs
index 9d96a64ab..6c136638f 100644
--- a/src/BD.WTTS.Client.Plugins.Accelerator.ReverseProxy/Services/IReverseProxyService.cs
+++ b/src/BD.WTTS.Client.Plugins.Accelerator.ReverseProxy/Services/IReverseProxyService.cs
@@ -3,8 +3,6 @@ namespace BD.WTTS.Services;
partial interface IReverseProxyService
{
- ICertificateManager CertificateManager { get; }
-
///
/// 将 PEM 证书公钥写入 GOG GALAXY
///
diff --git a/src/BD.WTTS.Client.Plugins.Accelerator/BD.WTTS.Client.Plugins.Accelerator.csproj b/src/BD.WTTS.Client.Plugins.Accelerator/BD.WTTS.Client.Plugins.Accelerator.csproj
index 83a0b87fc..3f6cb089f 100644
--- a/src/BD.WTTS.Client.Plugins.Accelerator/BD.WTTS.Client.Plugins.Accelerator.csproj
+++ b/src/BD.WTTS.Client.Plugins.Accelerator/BD.WTTS.Client.Plugins.Accelerator.csproj
@@ -71,6 +71,9 @@
Services
+
+ Services
+
Enums
diff --git a/src/BD.WTTS.Client.Plugins.Accelerator/Plugins/Plugin.cs b/src/BD.WTTS.Client.Plugins.Accelerator/Plugins/Plugin.cs
index 26f6e82d8..8e1891959 100644
--- a/src/BD.WTTS.Client.Plugins.Accelerator/Plugins/Plugin.cs
+++ b/src/BD.WTTS.Client.Plugins.Accelerator/Plugins/Plugin.cs
@@ -70,6 +70,17 @@ sealed class Plugin : PluginBase
// 从子进程中获取 IPC 远程服务
reverseProxyService = await ipc.GetServiceAsync(moduleName);
+#if DEBUG
+ try
+ {
+ var debugStringIPC = $"Pid: {Environment.ProcessId}, Exe: {Environment.ProcessPath}, Asm: {Assembly.GetAssembly(GetType())?.FullName}{Environment.NewLine}{reverseProxyService?.GetDebugString()}";
+ Console.WriteLine($"DebugString/IReverseProxyService: {debugStringIPC}");
+ }
+ catch (Exception ex)
+ {
+ Console.WriteLine(ex);
+ }
+#endif
if (ResourceService.IsChineseSimplified)
{
diff --git a/src/BD.WTTS.Client/BD.WTTS.Client.csproj b/src/BD.WTTS.Client/BD.WTTS.Client.csproj
index e5112e8c5..1de8d76f5 100644
--- a/src/BD.WTTS.Client/BD.WTTS.Client.csproj
+++ b/src/BD.WTTS.Client/BD.WTTS.Client.csproj
@@ -34,6 +34,9 @@
Properties
+
+ Properties
+
Properties
diff --git a/src/BD.WTTS.Client/Enums/CommandExitCode.cs b/src/BD.WTTS.Client/Enums/CommandExitCode.cs
new file mode 100644
index 000000000..4711785b9
--- /dev/null
+++ b/src/BD.WTTS.Client/Enums/CommandExitCode.cs
@@ -0,0 +1,56 @@
+namespace BD.WTTS.Enums;
+
+public enum CommandExitCode
+{
+ #region 100 ~ 5xx HttpStatusCode
+
+ ///
+ HttpStatusCodeOk = 200,
+
+ ///
+ HttpStatusBadRequest = 400,
+
+ ///
+ HttpStatusCodeInternalServerError = 500,
+
+ #endregion
+
+ #region xxxx 4 位数通用错误码
+
+ ///
+ /// 参数不能为空数组
+ ///
+ EmptyArrayArgs = 4001,
+
+ ///
+ /// IPC 管道名称不能为空
+ ///
+ EmptyPipeName = 4002,
+
+ ///
+ /// 主进程 Id 不能为空
+ ///
+ EmptyMainProcessId = 4003,
+
+ ///
+ /// 主进程 Id 找不到
+ ///
+ NotFoundMainProcessId = 4004,
+
+ ///
+ /// 获取一组插件失败
+ ///
+ GetPluginsFail = 4040,
+
+ ///
+ /// 获取单个插件失败
+ ///
+ GetPluginFail = 4041,
+
+ ///
+ /// 获取子进程启动配置失败
+ ///
+ GetSubProcessBootConfigurationFail = 4042,
+
+ #endregion
+}
\ No newline at end of file
diff --git a/src/BD.WTTS.Client/Plugins/Abstractions/PluginBase.cs b/src/BD.WTTS.Client/Plugins/Abstractions/PluginBase.cs
index 36d293256..1f4c8ac0d 100644
--- a/src/BD.WTTS.Client/Plugins/Abstractions/PluginBase.cs
+++ b/src/BD.WTTS.Client/Plugins/Abstractions/PluginBase.cs
@@ -93,7 +93,7 @@ public abstract class PluginBase : IPlugin where TPlugin : PluginBase
{
- var process = await WindowsPlatformServiceImpl.StartAsAdministrator(processPath, arguments);
- return process;
+ return await Policy.HandleResult(x => x == null)
+ .RetryAsync(3)
+ .ExecuteAsync(async () =>
+ {
+ var process = await WindowsPlatformServiceImpl.StartAsAdministrator(processPath, arguments);
+ return process;
+ });
});
await IPlatformService.IPCRoot.SetIPC(this);
});
diff --git a/src/BD.WTTS.Client/Services.Implementation/Net/HostsFileServiceImpl.cs b/src/BD.WTTS.Client/Services.Implementation/Net/HostsFileServiceImpl.cs
index 893829e62..89d4bd709 100644
--- a/src/BD.WTTS.Client/Services.Implementation/Net/HostsFileServiceImpl.cs
+++ b/src/BD.WTTS.Client/Services.Implementation/Net/HostsFileServiceImpl.cs
@@ -497,7 +497,7 @@ internal sealed class HostsFileServiceImpl
{
try
{
- s.WriteDefaultHostsContent(new FileStream(s.HostsFilePath, FileMode.OpenOrCreate));
+ s.WriteDefaultHostsContent();
Toast.Show(AppResources.CommunityFix_ResetHostsFileOk);
}
catch (Exception e)
diff --git a/src/BD.WTTS.Client/Services.Implementation/Platform/Windows/WindowsPlatformServiceImpl.BypassUAC.cs b/src/BD.WTTS.Client/Services.Implementation/Platform/Windows/WindowsPlatformServiceImpl.BypassUAC.cs
index e2175f46e..403712cdf 100644
--- a/src/BD.WTTS.Client/Services.Implementation/Platform/Windows/WindowsPlatformServiceImpl.BypassUAC.cs
+++ b/src/BD.WTTS.Client/Services.Implementation/Platform/Windows/WindowsPlatformServiceImpl.BypassUAC.cs
@@ -148,14 +148,22 @@ partial class WindowsPlatformServiceImpl
if (process != null)
return process;
- ProcessStartInfo psi = new()
+ try
{
- FileName = fileName,
- Arguments = arguments,
- UseShellExecute = true,
- Verb = "runas",
- };
- return Process.Start(psi);
+ ProcessStartInfo psi = new()
+ {
+ FileName = fileName,
+ Arguments = arguments,
+ UseShellExecute = true,
+ Verb = "runas",
+ };
+ var process_runas = Process.Start(psi);
+ return process_runas;
+ }
+ catch
+ {
+ return null;
+ }
}
}
#endif
\ No newline at end of file
diff --git a/src/BD.WTTS.Client/Services/Platform/IPC/IPCPlatformService.cs b/src/BD.WTTS.Client/Services/Platform/IPC/IPCPlatformService.cs
index 61afde338..59da0f251 100644
--- a/src/BD.WTTS.Client/Services/Platform/IPC/IPCPlatformService.cs
+++ b/src/BD.WTTS.Client/Services/Platform/IPC/IPCPlatformService.cs
@@ -6,8 +6,13 @@ namespace BD.WTTS.Services;
///
/// 用于 IPC 的平台实现的服务
///
-[IpcPublic(Timeout = 55000, IgnoresIpcException = false)]
+[IpcPublic(Timeout = 9000, IgnoresIpcException = false)]
public partial interface IPCPlatformService
{
-
+#if DEBUG
+ string GetDebugString()
+ {
+ return $"Pid: {Environment.ProcessId}, Exe: {Environment.ProcessPath}, Asm: {Assembly.GetAssembly(GetType())?.FullName}";
+ }
+#endif
}
\ No newline at end of file
diff --git a/src/BD.WTTS.Client/Services/Platform/IPlatformService.Net.Hosts.cs b/src/BD.WTTS.Client/Services/Platform/IPlatformService.Net.Hosts.cs
index 731af0cbc..bcc39cc16 100644
--- a/src/BD.WTTS.Client/Services/Platform/IPlatformService.Net.Hosts.cs
+++ b/src/BD.WTTS.Client/Services/Platform/IPlatformService.Net.Hosts.cs
@@ -27,6 +27,18 @@ partial interface IPlatformService
[Obsolete("use WriteDefaultHostsContent(Stream", true)]
string DefaultHostsContent => string.Empty;
+ ///
+ /// 写入默认 hosts 文件内容
+ ///
+ void WriteDefaultHostsContent()
+ {
+ var fileStream = new FileStream(HostsFilePath,
+ FileMode.OpenOrCreate,
+ FileAccess.Write,
+ FileShare.ReadWrite | FileShare.Delete);
+ WriteDefaultHostsContent(fileStream);
+ }
+
///
/// 写入默认 hosts 文件内容
///
diff --git a/src/BD.WTTS.Client/Services/Platform/IPlatformService.cs b/src/BD.WTTS.Client/Services/Platform/IPlatformService.cs
index 472e9fcdc..637198cfd 100644
--- a/src/BD.WTTS.Client/Services/Platform/IPlatformService.cs
+++ b/src/BD.WTTS.Client/Services/Platform/IPlatformService.cs
@@ -33,6 +33,17 @@ public partial interface IPlatformService : IPCPlatformService
{
var iPCPlatformService = await ipc.GetServiceAsync(moduleName);
iPCPlatformService.ThrowIsNull();
+#if DEBUG
+ try
+ {
+ var debugStringIPC = $"Pid: {Environment.ProcessId}, Exe: {Environment.ProcessPath}, Asm: {Assembly.GetAssembly(typeof(IPlatformService))?.FullName}{Environment.NewLine}{iPCPlatformService.GetDebugString()}";
+ Console.WriteLine($"DebugString/IPCPlatformService: {debugStringIPC}");
+ }
+ catch (Exception ex)
+ {
+ Console.WriteLine(ex);
+ }
+#endif
tcs.TrySetResult(iPCPlatformService);
}
catch (Exception ex)
diff --git a/src/BD.WTTS.Client/Startup/Startup.Commands.cs b/src/BD.WTTS.Client/Startup/Startup.Commands.cs
index 551dbc62c..a059cc0ed 100644
--- a/src/BD.WTTS.Client/Startup/Startup.Commands.cs
+++ b/src/BD.WTTS.Client/Startup/Startup.Commands.cs
@@ -453,59 +453,4 @@ partial class Startup // 自定义控制台命令参数
rootCommand.AddCommand(types);
}
#endif
-
- public enum CommandExitCode
- {
- #region 100 ~ 5xx HttpStatusCode
-
- ///
- HttpStatusCodeOk = 200,
-
- ///
- HttpStatusBadRequest = 400,
-
- ///
- HttpStatusCodeInternalServerError = 500,
-
- #endregion
-
- #region xxxx 4 位数通用错误码
-
- ///
- /// 参数不能为空数组
- ///
- EmptyArrayArgs = 4001,
-
- ///
- /// IPC 管道名称不能为空
- ///
- EmptyPipeName = 4002,
-
- ///
- /// 主进程 Id 不能为空
- ///
- EmptyMainProcessId = 4003,
-
- ///
- /// 主进程 Id 找不到
- ///
- NotFoundMainProcessId = 4004,
-
- ///
- /// 获取一组插件失败
- ///
- GetPluginsFail = 4040,
-
- ///
- /// 获取单个插件失败
- ///
- GetPluginFail = 4041,
-
- ///
- /// 获取子进程启动配置失败
- ///
- GetSubProcessBootConfigurationFail = 4042,
-
- #endregion
- }
}
\ No newline at end of file