add msix corruted message

This commit is contained in:
Lightczx
2024-01-31 13:32:55 +08:00
parent 39ccb73e2f
commit a4fd59df08
4 changed files with 39 additions and 19 deletions

View File

@@ -7,7 +7,7 @@ on:
jobs:
publish:
runs-on: windows-latest
runs-on: ubuntu-latest
steps:
- name: Checkout Repository

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.14.0</version>
<version>1.15.0</version>
<authors>DGP Studio</authors>
<developmentDependency>true</developmentDependency>
<requireLicenseAcceptance>false</requireLicenseAcceptance>

View File

@@ -20,8 +20,27 @@ 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);
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);
if (string.IsNullOrEmpty(packageName) || string.IsNullOrEmpty(msixVersion))
{
@@ -44,6 +63,7 @@ internal static partial class WindowsAppSDKDependency
Console.WriteLine("Start downloading SDK installer...");
await DownloadWindowsAppRuntimeInstallAndInstallAsync(sdkVersion).ConfigureAwait(false);
};
}
private static async Task<string> ExtractSDKVersionFromDepsJsonAsync(ZipArchive package)