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:
|
jobs:
|
||||||
publish:
|
publish:
|
||||||
runs-on: windows-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout Repository
|
- name: Checkout Repository
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
<package xmlns="http://schemas.microsoft.com/packaging/2012/06/nuspec.xsd">
|
<package xmlns="http://schemas.microsoft.com/packaging/2012/06/nuspec.xsd">
|
||||||
<metadata>
|
<metadata>
|
||||||
<id>Snap.Hutao.Deployment.Runtime</id>
|
<id>Snap.Hutao.Deployment.Runtime</id>
|
||||||
<version>1.14.0</version>
|
<version>1.15.1</version>
|
||||||
<authors>DGP Studio</authors>
|
<authors>DGP Studio</authors>
|
||||||
<developmentDependency>true</developmentDependency>
|
<developmentDependency>true</developmentDependency>
|
||||||
<requireLicenseAcceptance>false</requireLicenseAcceptance>
|
<requireLicenseAcceptance>false</requireLicenseAcceptance>
|
||||||
|
|||||||
Binary file not shown.
@@ -5,6 +5,7 @@ using System.IO;
|
|||||||
using System.Net.Http;
|
using System.Net.Http;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using Windows.Security.Isolation;
|
||||||
|
|
||||||
namespace Snap.Hutao.Deployment;
|
namespace Snap.Hutao.Deployment;
|
||||||
|
|
||||||
@@ -55,7 +56,12 @@ internal sealed class HttpShardCopyWorker<TStatus> : IDisposable
|
|||||||
public Task CopyAsync(IProgress<TStatus> progress, CancellationToken token = default)
|
public Task CopyAsync(IProgress<TStatus> progress, CancellationToken token = default)
|
||||||
{
|
{
|
||||||
ShardProgress shardProgress = new(progress, statusFactory, contentLength);
|
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)
|
async ValueTask CopyShardAsync(Shard shard, IProgress<ShardStatus> progress, CancellationToken token)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ internal static partial class Invocation
|
|||||||
ArgumentException.ThrowIfNullOrEmpty(path);
|
ArgumentException.ThrowIfNullOrEmpty(path);
|
||||||
|
|
||||||
Console.WriteLine($"""
|
Console.WriteLine($"""
|
||||||
Snap Hutao Deployment Tool [1.14.0]
|
Snap Hutao Deployment Tool [1.15.1]
|
||||||
PackagePath: {path}
|
PackagePath: {path}
|
||||||
FamilyName: {name}
|
FamilyName: {name}
|
||||||
------------------------------------------------------------
|
------------------------------------------------------------
|
||||||
|
|||||||
@@ -20,8 +20,27 @@ internal static partial class WindowsAppSDKDependency
|
|||||||
public static async Task EnsureAsync(string packagePath)
|
public static async Task EnsureAsync(string packagePath)
|
||||||
{
|
{
|
||||||
using FileStream packageStream = File.OpenRead(packagePath);
|
using FileStream packageStream = File.OpenRead(packagePath);
|
||||||
using ZipArchive package = new(packageStream, ZipArchiveMode.Read);
|
ZipArchive package = default!;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
using (package)
|
||||||
|
{
|
||||||
(string packageName, string msixVersion) = await ExtractRuntimePackageNameAndMsixMinVersionFromAppManifestAsync(package).ConfigureAwait(false);
|
(string packageName, string msixVersion) = await ExtractRuntimePackageNameAndMsixMinVersionFromAppManifestAsync(package).ConfigureAwait(false);
|
||||||
if (string.IsNullOrEmpty(packageName) || string.IsNullOrEmpty(msixVersion))
|
if (string.IsNullOrEmpty(packageName) || string.IsNullOrEmpty(msixVersion))
|
||||||
{
|
{
|
||||||
@@ -44,6 +63,7 @@ internal static partial class WindowsAppSDKDependency
|
|||||||
|
|
||||||
Console.WriteLine("Start downloading SDK installer...");
|
Console.WriteLine("Start downloading SDK installer...");
|
||||||
await DownloadWindowsAppRuntimeInstallAndInstallAsync(sdkVersion).ConfigureAwait(false);
|
await DownloadWindowsAppRuntimeInstallAndInstallAsync(sdkVersion).ConfigureAwait(false);
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
private static async Task<string> ExtractSDKVersionFromDepsJsonAsync(ZipArchive package)
|
private static async Task<string> ExtractSDKVersionFromDepsJsonAsync(ZipArchive package)
|
||||||
|
|||||||
Reference in New Issue
Block a user