3 Commits

Author SHA1 Message Date
Lightczx
02dae0e199 Update Snap.Hutao.Deployment.exe 2024-01-31 13:49:18 +08:00
Lightczx
291c754deb update version 2024-01-31 13:48:46 +08:00
Lightczx
a4fd59df08 add msix corruted message 2024-01-31 13:32:55 +08:00
6 changed files with 47 additions and 21 deletions

View File

@@ -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

View File

@@ -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>

View File

@@ -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)
{ {

View File

@@ -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}
------------------------------------------------------------ ------------------------------------------------------------

View File

@@ -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)