mirror of
https://github.com/BeyondDimension/SteamTools.git
synced 2026-10-25 19:49:43 +08:00
try fix macos Accountchange
This commit is contained in:
@@ -34,6 +34,32 @@ namespace System.Application.Services.Implementation
|
||||
p.Close();
|
||||
}
|
||||
|
||||
|
||||
void IDesktopPlatformService.OpenProcess(string name)
|
||||
{
|
||||
var pInfo = new ProcessStartInfo
|
||||
{
|
||||
FileName = "open",
|
||||
Arguments = $"{name}",
|
||||
};
|
||||
pInfo.UseShellExecute = true;
|
||||
var p = Process.Start(pInfo);
|
||||
if (p == null) throw new FileNotFoundException(name);
|
||||
p.Close();
|
||||
}
|
||||
|
||||
void IDesktopPlatformService.OpenProcess(string name, string arguments)
|
||||
{
|
||||
var pInfo = new ProcessStartInfo
|
||||
{
|
||||
FileName = "open",
|
||||
Arguments = $"{name} \"{arguments}\"",
|
||||
};
|
||||
pInfo.UseShellExecute = true;
|
||||
var p = Process.Start(pInfo);
|
||||
if (p == null) throw new FileNotFoundException(name);
|
||||
p.Close();
|
||||
}
|
||||
public void SetSystemSessionEnding(Action action)
|
||||
{
|
||||
|
||||
@@ -72,7 +98,11 @@ namespace System.Application.Services.Implementation
|
||||
|
||||
public string? GetSteamProgramPath()
|
||||
{
|
||||
return null;
|
||||
var value = string.Format(
|
||||
"{0}{1}{0}Application{0}Steam.app",
|
||||
Path.DirectorySeparatorChar,
|
||||
Environment.UserName);
|
||||
return value;
|
||||
}
|
||||
|
||||
public string GetLastSteamLoginUserName() => string.Empty;
|
||||
|
||||
@@ -43,6 +43,10 @@ namespace System.Application.Services
|
||||
/// <exception cref="IO.FileNotFoundException"></exception>
|
||||
void StartProcess(string name, string filePath) => Process.Start(name, $"\"{filePath}\"");
|
||||
|
||||
void OpenProcess(string name, string arguments) => Process.Start(name, arguments);
|
||||
|
||||
void OpenProcess(string name) => Process.Start(name);
|
||||
|
||||
/// <summary>
|
||||
/// 使用文本阅读器打开文件
|
||||
/// </summary>
|
||||
|
||||
@@ -42,7 +42,7 @@ namespace System.Application.Services.Implementation
|
||||
readonly IDesktopPlatformService platformService;
|
||||
readonly string? mSteamDirPath;
|
||||
readonly string? mSteamProgramPath;
|
||||
readonly string[] steamProcess = new[] { "steam", "steamservice", "steamwebhelper" };
|
||||
readonly string[] steamProcess = new[] { "steam","steam_osx", "steamservice", "steamwebhelper" };
|
||||
readonly Lazy<IHttpService> _http = new(() => DI.Get<IHttpService>());
|
||||
IHttpService Http => _http.Value;
|
||||
|
||||
@@ -78,13 +78,13 @@ namespace System.Application.Services.Implementation
|
||||
{
|
||||
foreach (var p in steamProcess)
|
||||
{
|
||||
var process = Process.GetProcessesByName(p).FirstOrDefault();
|
||||
if (process != null)
|
||||
var process = Process.GetProcessesByName(p);
|
||||
foreach (var item in process)
|
||||
{
|
||||
if (process.HasExited == false)
|
||||
if (item.HasExited == false)
|
||||
{
|
||||
process.Kill();
|
||||
process.WaitForExit();
|
||||
item.Kill();
|
||||
item.WaitForExit();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -128,9 +128,9 @@ namespace System.Application.Services.Implementation
|
||||
if (!string.IsNullOrEmpty(SteamProgramPath))
|
||||
{
|
||||
if (!string.IsNullOrEmpty(arguments))
|
||||
Process.Start(SteamProgramPath, arguments);
|
||||
DI.Get<IDesktopPlatformService>().OpenProcess(SteamProgramPath, arguments);
|
||||
else
|
||||
Process.Start(SteamProgramPath);
|
||||
DI.Get<IDesktopPlatformService>().OpenProcess(SteamProgramPath);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -314,12 +314,13 @@ namespace System.Application.Services.Implementation
|
||||
Toast.Show(SR.CreateCertificateFaild);
|
||||
return false;
|
||||
}
|
||||
proxyServer.CertificateManager.RootCertificate.SaveCerCertificateFile(Path.Combine(IOPath.AppDataDirectory, $@"{CertificateName}.Certificate.cer"));
|
||||
var filePath = Path.Combine(IOPath.AppDataDirectory, $@"{CertificateName}.Certificate.cer");
|
||||
proxyServer.CertificateManager.RootCertificate.SaveCerCertificateFile(filePath);
|
||||
|
||||
proxyServer.CertificateManager.TrustRootCertificate();
|
||||
|
||||
proxyServer.CertificateManager.EnsureRootCertificate();
|
||||
|
||||
|
||||
return IsCertificateInstalled(proxyServer.CertificateManager.RootCertificate);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user