mirror of
https://jihulab.com/DGP-Studio/Snap.Hutao.Deployment.git
synced 2025-11-19 21:08:45 +08:00
Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
02dae0e199 | ||
|
|
291c754deb | ||
|
|
a4fd59df08 |
2
.github/workflows/Publish.yml
vendored
2
.github/workflows/Publish.yml
vendored
@@ -7,7 +7,7 @@ on:
|
||||
|
||||
jobs:
|
||||
publish:
|
||||
runs-on: windows-latest
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout Repository
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<package xmlns="http://schemas.microsoft.com/packaging/2012/06/nuspec.xsd">
|
||||
<metadata>
|
||||
<id>Snap.Hutao.Deployment.Runtime</id>
|
||||
<version>1.14.0</version>
|
||||
<version>1.15.1</version>
|
||||
<authors>DGP Studio</authors>
|
||||
<developmentDependency>true</developmentDependency>
|
||||
<requireLicenseAcceptance>false</requireLicenseAcceptance>
|
||||
|
||||
Binary file not shown.
@@ -5,6 +5,7 @@ using System.IO;
|
||||
using System.Net.Http;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Windows.Security.Isolation;
|
||||
|
||||
namespace Snap.Hutao.Deployment;
|
||||
|
||||
@@ -55,7 +56,12 @@ internal sealed class HttpShardCopyWorker<TStatus> : IDisposable
|
||||
public Task CopyAsync(IProgress<TStatus> progress, CancellationToken token = default)
|
||||
{
|
||||
ShardProgress shardProgress = new(progress, statusFactory, contentLength);
|
||||
return Parallel.ForEachAsync(shards, token, (shard, token) => CopyShardAsync(shard, shardProgress, token));
|
||||
ParallelOptions options = new()
|
||||
{
|
||||
MaxDegreeOfParallelism = Math.Clamp(2, Environment.ProcessorCount, 6),
|
||||
CancellationToken = token,
|
||||
};
|
||||
return Parallel.ForEachAsync(shards, options, (shard, token) => CopyShardAsync(shard, shardProgress, token));
|
||||
|
||||
async ValueTask CopyShardAsync(Shard shard, IProgress<ShardStatus> progress, CancellationToken token)
|
||||
{
|
||||
|
||||
@@ -24,7 +24,7 @@ internal static partial class Invocation
|
||||
ArgumentException.ThrowIfNullOrEmpty(path);
|
||||
|
||||
Console.WriteLine($"""
|
||||
Snap Hutao Deployment Tool [1.14.0]
|
||||
Snap Hutao Deployment Tool [1.15.1]
|
||||
PackagePath: {path}
|
||||
FamilyName: {name}
|
||||
------------------------------------------------------------
|
||||
|
||||
@@ -20,30 +20,50 @@ internal static partial class WindowsAppSDKDependency
|
||||
public static async Task EnsureAsync(string packagePath)
|
||||
{
|
||||
using FileStream packageStream = File.OpenRead(packagePath);
|
||||
using ZipArchive package = new(packageStream, ZipArchiveMode.Read);
|
||||
|
||||
(string packageName, string msixVersion) = await ExtractRuntimePackageNameAndMsixMinVersionFromAppManifestAsync(package).ConfigureAwait(false);
|
||||
if (string.IsNullOrEmpty(packageName) || string.IsNullOrEmpty(msixVersion))
|
||||
ZipArchive package = default!;
|
||||
try
|
||||
{
|
||||
Console.WriteLine("No Windows App Runtime version found in Msix/AppxManifest.xml");
|
||||
return;
|
||||
package = new(packageStream, ZipArchiveMode.Read);
|
||||
}
|
||||
catch (InvalidDataException)
|
||||
{
|
||||
Console.WriteLine("Msix Package corrupted, please re-launch Deployment and try again");
|
||||
try
|
||||
{
|
||||
File.Delete(packagePath);
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
|
||||
throw;
|
||||
}
|
||||
|
||||
if (await CheckRuntimeInstalledAndVerifyAsync(packageName, msixVersion).ConfigureAwait(false))
|
||||
using (package)
|
||||
{
|
||||
return;
|
||||
}
|
||||
(string packageName, string msixVersion) = await ExtractRuntimePackageNameAndMsixMinVersionFromAppManifestAsync(package).ConfigureAwait(false);
|
||||
if (string.IsNullOrEmpty(packageName) || string.IsNullOrEmpty(msixVersion))
|
||||
{
|
||||
Console.WriteLine("No Windows App Runtime version found in Msix/AppxManifest.xml");
|
||||
return;
|
||||
}
|
||||
|
||||
string sdkVersion = await ExtractSDKVersionFromDepsJsonAsync(package).ConfigureAwait(false);
|
||||
if (await CheckRuntimeInstalledAndVerifyAsync(packageName, msixVersion).ConfigureAwait(false))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(sdkVersion))
|
||||
{
|
||||
Console.WriteLine("No Windows App SDK version found in Msix/Snap.Hutao.deps.json");
|
||||
return;
|
||||
}
|
||||
string sdkVersion = await ExtractSDKVersionFromDepsJsonAsync(package).ConfigureAwait(false);
|
||||
|
||||
Console.WriteLine("Start downloading SDK installer...");
|
||||
await DownloadWindowsAppRuntimeInstallAndInstallAsync(sdkVersion).ConfigureAwait(false);
|
||||
if (string.IsNullOrEmpty(sdkVersion))
|
||||
{
|
||||
Console.WriteLine("No Windows App SDK version found in Msix/Snap.Hutao.deps.json");
|
||||
return;
|
||||
}
|
||||
|
||||
Console.WriteLine("Start downloading SDK installer...");
|
||||
await DownloadWindowsAppRuntimeInstallAndInstallAsync(sdkVersion).ConfigureAwait(false);
|
||||
};
|
||||
}
|
||||
|
||||
private static async Task<string> ExtractSDKVersionFromDepsJsonAsync(ZipArchive package)
|
||||
|
||||
Reference in New Issue
Block a user