mirror of
https://jihulab.com/DGP-Studio/Snap.Hutao.Deployment.git
synced 2025-11-19 21:08:45 +08:00
Compare commits
5 Commits
1.15.3
...
qhy040404-
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
80584305db | ||
|
|
5a830c21cf | ||
|
|
ab96c9be33 | ||
|
|
d6f15608d9 | ||
|
|
6867e5e914 |
5
.github/workflows/Publish.yml
vendored
5
.github/workflows/Publish.yml
vendored
@@ -7,7 +7,7 @@ on:
|
|||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
publish:
|
publish:
|
||||||
runs-on: ubuntu-latest
|
runs-on: windows-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout Repository
|
- name: Checkout Repository
|
||||||
@@ -18,6 +18,9 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
dotnet-version: '8.x'
|
dotnet-version: '8.x'
|
||||||
|
|
||||||
|
- name: Build Tool
|
||||||
|
run: dotnet publish src/Snap.Hutao.Deployment/Snap.Hutao.Deployment.csproj
|
||||||
|
|
||||||
- name: Pack
|
- name: Pack
|
||||||
run: dotnet pack src/Snap.Hutao.Deployment.Runtime/Snap.Hutao.Deployment.Runtime.csproj
|
run: dotnet pack src/Snap.Hutao.Deployment.Runtime/Snap.Hutao.Deployment.Runtime.csproj
|
||||||
|
|
||||||
|
|||||||
@@ -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.15.2</version>
|
<version>1.12.0</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.
@@ -55,12 +55,7 @@ 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);
|
||||||
ParallelOptions options = new()
|
return Parallel.ForEachAsync(shards, token, (shard, token) => CopyShardAsync(shard, shardProgress, token));
|
||||||
{
|
|
||||||
MaxDegreeOfParallelism = Math.Clamp(Environment.ProcessorCount, 2, 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,6 @@ internal static partial class Invocation
|
|||||||
ArgumentException.ThrowIfNullOrEmpty(path);
|
ArgumentException.ThrowIfNullOrEmpty(path);
|
||||||
|
|
||||||
Console.WriteLine($"""
|
Console.WriteLine($"""
|
||||||
Snap Hutao Deployment Tool [1.15.2]
|
|
||||||
PackagePath: {path}
|
PackagePath: {path}
|
||||||
FamilyName: {name}
|
FamilyName: {name}
|
||||||
------------------------------------------------------------
|
------------------------------------------------------------
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using System.CommandLine;
|
using System.CommandLine;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace Snap.Hutao.Deployment;
|
namespace Snap.Hutao.Deployment;
|
||||||
|
|||||||
@@ -20,50 +20,30 @@ 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);
|
||||||
ZipArchive package = default!;
|
using ZipArchive package = new(packageStream, ZipArchiveMode.Read);
|
||||||
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;
|
(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;
|
||||||
}
|
}
|
||||||
|
|
||||||
using (package)
|
if (await CheckRuntimeInstalledAndVerifyAsync(packageName, msixVersion).ConfigureAwait(false))
|
||||||
{
|
{
|
||||||
(string packageName, string msixVersion) = await ExtractRuntimePackageNameAndMsixMinVersionFromAppManifestAsync(package).ConfigureAwait(false);
|
return;
|
||||||
if (string.IsNullOrEmpty(packageName) || string.IsNullOrEmpty(msixVersion))
|
}
|
||||||
{
|
|
||||||
Console.WriteLine("No Windows App Runtime version found in Msix/AppxManifest.xml");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (await CheckRuntimeInstalledAndVerifyAsync(packageName, msixVersion).ConfigureAwait(false))
|
string sdkVersion = await ExtractSDKVersionFromDepsJsonAsync(package).ConfigureAwait(false);
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
string sdkVersion = await ExtractSDKVersionFromDepsJsonAsync(package).ConfigureAwait(false);
|
if (string.IsNullOrEmpty(sdkVersion))
|
||||||
|
{
|
||||||
|
Console.WriteLine("No Windows App SDK version found in Msix/Snap.Hutao.deps.json");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (string.IsNullOrEmpty(sdkVersion))
|
Console.WriteLine("Start downloading SDK installer...");
|
||||||
{
|
await DownloadWindowsAppRuntimeInstallAndInstallAsync(sdkVersion).ConfigureAwait(false);
|
||||||
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)
|
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)
|
private static async Task DownloadWindowsAppRuntimeInstallAndInstallAsync(string version)
|
||||||
|
|||||||
Reference in New Issue
Block a user