fix ERROR_MRM_MAP_NOT_FOUND

This commit is contained in:
Lightczx
2023-12-27 17:28:52 +08:00
parent 21618e5583
commit 9d71ac82b7
3 changed files with 16 additions and 4 deletions

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

View File

@@ -2,6 +2,7 @@
using System.CommandLine.Invocation; using System.CommandLine.Invocation;
using System.Diagnostics; using System.Diagnostics;
using System.IO; using System.IO;
using System.Runtime.InteropServices;
using System.Threading.Tasks; using System.Threading.Tasks;
using Windows.Management.Deployment; using Windows.Management.Deployment;
@@ -75,6 +76,8 @@ internal static class Invocation
Console.WriteLine("FamilyName not provided, enumerating packages."); Console.WriteLine("FamilyName not provided, enumerating packages.");
foreach (Windows.ApplicationModel.Package package in packageManager.FindPackages()) foreach (Windows.ApplicationModel.Package package in packageManager.FindPackages())
{
try
{ {
if (package is { DisplayName: "Snap Hutao", PublisherDisplayName: "DGP Studio" }) if (package is { DisplayName: "Snap Hutao", PublisherDisplayName: "DGP Studio" })
{ {
@@ -82,6 +85,15 @@ internal static class Invocation
Console.WriteLine($"Package found: {name}"); Console.WriteLine($"Package found: {name}");
} }
} }
catch (COMException ex)
{
// ERROR_MRM_MAP_NOT_FOUND
if (ex.HResult is not unchecked((int)0x80073B1F))
{
throw;
}
}
}
} }
Console.WriteLine("Starting app..."); Console.WriteLine("Starting app...");