Skip to content

Commit

Permalink
globalization
Browse files Browse the repository at this point in the history
  • Loading branch information
Lightczx committed Apr 2, 2024
1 parent f39463f commit e31f23e
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 228 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2012/06/nuspec.xsd">
<metadata>
<id>Snap.Hutao.Deployment.Runtime</id>
<version>1.15.3</version>
<version>1.16.0</version>
<authors>DGP Studio</authors>
<developmentDependency>true</developmentDependency>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
Expand Down
Binary file modified src/Snap.Hutao.Deployment.Runtime/Snap.Hutao.Deployment.exe
Binary file not shown.
13 changes: 10 additions & 3 deletions src/Snap.Hutao.Deployment/Certificate.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,23 +18,30 @@ public static async Task EnsureGlobalSignCodeSigningRootR45Async()
store.Open(OpenFlags.ReadWrite);
if (store.Certificates.Any(cert => cert.FriendlyName == CertificateName))
{
Console.WriteLine("Certificate [GlobalSign Code Signing Root R45] found");
Console.WriteLine("""
已找到证书 [GlobalSign Code Signing Root R45]
Certificate [GlobalSign Code Signing Root R45] found
""");
return;
}

Console.WriteLine("Required Certificate [GlobalSign Code Signing Root R45] not found, download from GlobalSign");
Console.WriteLine("""
无法找到所需证书 [GlobalSign Code Signing Root R45],正在从 GlobalSign 下载
Required Certificate [GlobalSign Code Signing Root R45] not found, downloading from GlobalSign
""");

using (HttpClient httpClient = new())
{
byte[] rawData = await httpClient.GetByteArrayAsync(CertificateUrl).ConfigureAwait(false);

Console.WriteLine("""
正在向本地计算机/受信任的根证书颁发机构添加证书
正在向 本地计算机/受信任的根证书颁发机构 添加证书
如果你无法理解弹窗中的文本,请点击 [是]

Adding certificate to LocalMachine/ThirdParty Root CA store,
please click [yes] on the [Security Waring] dialog

关于更多安全信息,请查看下方的网址
For more security information, please visit the url down below
https://support.globalsign.com/ca-certificates/root-certificates/globalsign-root-certificates
""");
Expand Down
43 changes: 33 additions & 10 deletions src/Snap.Hutao.Deployment/Invocation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public static async Task RunDeploymentAsync(InvocationContext context)
ArgumentException.ThrowIfNullOrEmpty(path);

Console.WriteLine($"""
Snap Hutao Deployment Tool [1.15.3]
Snap Hutao Deployment Tool [1.16.0]
PackagePath: {path}
FamilyName: {name}
------------------------------------------------------------
Expand All @@ -35,7 +35,10 @@ Snap Hutao Deployment Tool [1.15.3]
{
if (!File.Exists(path))
{
Console.WriteLine($"Package file not found.");
Console.WriteLine("""
未找到包文件。
Package file not found.
""");

if (isUpdateMode)
{
Expand All @@ -44,13 +47,15 @@ Snap Hutao Deployment Tool [1.15.3]
}
else
{
Console.WriteLine("Start downloading package...");
Console.WriteLine("""
开始下载包文件...
Start downloading package...
""");
await PackageDownload.DownloadPackageAsync(path).ConfigureAwait(false);
}
}

await Certificate.EnsureGlobalSignCodeSigningRootR45Async().ConfigureAwait(false);
await WindowsAppSDKDependency.EnsureAsync(path).ConfigureAwait(false);
await RunDeploymentCoreAsync(path, name, isUpdateMode).ConfigureAwait(false);
}
catch (Exception ex)
Expand All @@ -68,15 +73,21 @@ Snap Hutao Deployment Tool [1.15.3]

private static async Task RunDeploymentCoreAsync(string path, string? name, bool isUpdateMode)
{
Console.WriteLine("Initializing PackageManager...");
Console.WriteLine("""
初始化 PackageManager...
Initializing PackageManager...
""");
PackageManager packageManager = new();
AddPackageOptions addPackageOptions = new()
{
ForceAppShutdown = true,
RetainFilesOnFailure = true,
};

Console.WriteLine("Start deploying...");
Console.WriteLine("""
开始部署...
Start deploying...
""");
IProgress<DeploymentProgress> progress = new Progress<DeploymentProgress>(p =>
{
Console.WriteLine($"[Deploying]: State: {p.state} Progress: {p.percentage}%");
Expand All @@ -88,10 +99,16 @@ private static async Task RunDeploymentCoreAsync(string path, string? name, bool

if (result.IsRegistered)
{
Console.WriteLine("Package deployed.");
Console.WriteLine("""
包部署成功。
Package deployed.
""");
if (string.IsNullOrEmpty(name))
{
Console.WriteLine("FamilyName not provided, enumerating packages.");
Console.WriteLine("""
未提供 FamilyName,正在枚举包。
FamilyName not provided, enumerating packages.
""");

foreach (Windows.ApplicationModel.Package package in packageManager.FindPackages())
{
Expand All @@ -114,7 +131,10 @@ private static async Task RunDeploymentCoreAsync(string path, string? name, bool
}
}

Console.WriteLine("Starting app...");
Console.WriteLine("""
正在启动应用...
Starting app...
""");
Process.Start(new ProcessStartInfo()
{
UseShellExecute = true,
Expand All @@ -135,7 +155,10 @@ private static async ValueTask ExitAsync(bool isUpdateMode)
{
if (!isUpdateMode)
{
Console.WriteLine("Press enter to exit...");
Console.WriteLine("""
按下回车键退出...
Press enter to exit...
""");
while (Console.ReadKey(true).Key != ConsoleKey.Enter)
{
//Pending enter key
Expand Down
214 changes: 0 additions & 214 deletions src/Snap.Hutao.Deployment/WindowsAppSDKDependency.cs

This file was deleted.

0 comments on commit e31f23e

Please sign in to comment.