5 Commits

Author SHA1 Message Date
DismissedLight
80584305db Update Snap.Hutao.Deployment.Runtime.nuspec 2024-01-16 21:23:02 +08:00
DismissedLight
5a830c21cf code style 2024-01-16 21:09:59 +08:00
qhy040404
ab96c9be33 更新 Snap.Hutao.Deployment.csproj 2024-01-15 23:56:48 +08:00
qhy040404
d6f15608d9 更新 WindowsAppSDKDependency.cs 2024-01-15 23:55:23 +08:00
qhy040404
6867e5e914 更新 Snap.Hutao.Deployment.csproj 2024-01-15 23:42:58 +08:00
7 changed files with 25 additions and 47 deletions

View File

@@ -7,7 +7,7 @@ on:
jobs:
publish:
runs-on: ubuntu-latest
runs-on: windows-latest
steps:
- name: Checkout Repository
@@ -18,6 +18,9 @@ jobs:
with:
dotnet-version: '8.x'
- name: Build Tool
run: dotnet publish src/Snap.Hutao.Deployment/Snap.Hutao.Deployment.csproj
- name: Pack
run: dotnet pack src/Snap.Hutao.Deployment.Runtime/Snap.Hutao.Deployment.Runtime.csproj

View File

@@ -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.2</version>
<version>1.12.0</version>
<authors>DGP Studio</authors>
<developmentDependency>true</developmentDependency>
<requireLicenseAcceptance>false</requireLicenseAcceptance>

View File

@@ -55,12 +55,7 @@ internal sealed class HttpShardCopyWorker<TStatus> : IDisposable
public Task CopyAsync(IProgress<TStatus> progress, CancellationToken token = default)
{
ShardProgress shardProgress = new(progress, statusFactory, contentLength);
ParallelOptions options = new()
{
MaxDegreeOfParallelism = Math.Clamp(Environment.ProcessorCount, 2, 6),
CancellationToken = token,
};
return Parallel.ForEachAsync(shards, options, (shard, token) => CopyShardAsync(shard, shardProgress, token));
return Parallel.ForEachAsync(shards, token, (shard, token) => CopyShardAsync(shard, shardProgress, token));
async ValueTask CopyShardAsync(Shard shard, IProgress<ShardStatus> progress, CancellationToken token)
{

View File

@@ -24,7 +24,6 @@ internal static partial class Invocation
ArgumentException.ThrowIfNullOrEmpty(path);
Console.WriteLine($"""
Snap Hutao Deployment Tool [1.15.2]
PackagePath: {path}
FamilyName: {name}
------------------------------------------------------------

View File

@@ -1,4 +1,5 @@
using System.CommandLine;
using System.Runtime.InteropServices;
using System.Threading.Tasks;
namespace Snap.Hutao.Deployment;

View File

@@ -20,27 +20,8 @@ internal static partial class WindowsAppSDKDependency
public static async Task EnsureAsync(string packagePath)
{
using FileStream packageStream = File.OpenRead(packagePath);
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
{
}
using ZipArchive package = new(packageStream, ZipArchiveMode.Read);
throw;
}
using (package)
{
(string packageName, string msixVersion) = await ExtractRuntimePackageNameAndMsixMinVersionFromAppManifestAsync(package).ConfigureAwait(false);
if (string.IsNullOrEmpty(packageName) || string.IsNullOrEmpty(msixVersion))
{
@@ -63,7 +44,6 @@ internal static partial class WindowsAppSDKDependency
Console.WriteLine("Start downloading SDK installer...");
await DownloadWindowsAppRuntimeInstallAndInstallAsync(sdkVersion).ConfigureAwait(false);
};
}
private static async Task<string> ExtractSDKVersionFromDepsJsonAsync(ZipArchive package)
@@ -101,7 +81,7 @@ internal static partial class WindowsAppSDKDependency
}
}
return results.Count > 0 && results.Aggregate((result, element) => result || element);
return results.Aggregate((result, element) => result || element);
}
private static async Task DownloadWindowsAppRuntimeInstallAndInstallAsync(string version)