Skip to content

Commit ca508ee

Browse files
committed
Move APPX_PACKAGE_ARCHITECTURE into AppManagement as PackageArchitecture.
We want to mutate this Win32 enum so that it has names that are more meaningful in the PowerShell output display.
1 parent 9cac88c commit ca508ee

4 files changed

Lines changed: 38 additions & 39 deletions

File tree

src/PSADT/PSADT.Interop/APPX_PACKAGE_ARCHITECTURE.cs

Lines changed: 0 additions & 34 deletions
This file was deleted.

src/PSADT/PSADT/AppManagement/AppxProvisionedPackage.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
using System;
2-
using PSADT.Interop;
32

43
namespace PSADT.AppManagement
54
{
@@ -22,7 +21,7 @@ public sealed record AppxProvisionedPackage
2221
/// <param name="resourceId">The resource ID of the provisioned package.</param>
2322
/// <param name="installLocation">The install location of the provisioned package.</param>
2423
/// <param name="regions">The regions where the provisioned package is available.</param>
25-
public AppxProvisionedPackage(string packageName, string displayName, string publisherId, uint majorVersion, uint minorVersion, uint build, uint revision, APPX_PACKAGE_ARCHITECTURE architecture, string resourceId, string installLocation, string regions)
24+
public AppxProvisionedPackage(string packageName, string displayName, string publisherId, uint majorVersion, uint minorVersion, uint build, uint revision, PackageArchitecture architecture, string resourceId, string installLocation, string regions)
2625
{
2726
ArgumentException.ThrowIfNullOrWhiteSpace(packageName);
2827
ArgumentException.ThrowIfNullOrWhiteSpace(displayName);
@@ -63,7 +62,7 @@ public AppxProvisionedPackage(string packageName, string displayName, string pub
6362
/// <summary>
6463
/// Gets the architecture of the provisioned package.
6564
/// </summary>
66-
public APPX_PACKAGE_ARCHITECTURE Architecture { get; }
65+
public PackageArchitecture Architecture { get; }
6766

6867
/// <summary>
6968
/// Gets the resource ID of the provisioned package.

src/PSADT/PSADT/AppManagement/ManifestInformation.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public static ManifestInformation Get(Uri packageUri)
3737
private ManifestInformation(IAppxManifestPackageId packageId, PackageType packageType)
3838
{
3939
Name = packageId.GetName().ToString();
40-
Architecture = (Interop.APPX_PACKAGE_ARCHITECTURE)packageId.GetArchitecture();
40+
Architecture = (PackageArchitecture)packageId.GetArchitecture();
4141
Publisher = packageId.GetPublisher().ToString();
4242
ulong versionValue = packageId.GetVersion();
4343
Version = new((int)(versionValue >> 48), (int)((versionValue >> 32) & 0xFFFF), (int)((versionValue >> 16) & 0xFFFF), (int)(versionValue & 0xFFFF));
@@ -55,7 +55,7 @@ private ManifestInformation(IAppxManifestPackageId packageId, PackageType packag
5555
/// <summary>
5656
/// Gets the processor architecture as defined in the manifest.
5757
/// </summary>
58-
public Interop.APPX_PACKAGE_ARCHITECTURE Architecture { get; }
58+
public PackageArchitecture Architecture { get; }
5959

6060
/// <summary>
6161
/// Gets the name of the package publisher as defined in the manifest.
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
namespace PSADT.AppManagement
2+
{
3+
/// <summary>
4+
/// Specifies the processor architectures supported by a package.
5+
/// </summary>
6+
[System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1712:Do not prefix enum values with type name", Justification = "This is how it's named in the Win32 API.")]
7+
public enum PackageArchitecture
8+
{
9+
/// <summary>
10+
/// The x86 processor architecture.
11+
/// </summary>
12+
x86 = Windows.Win32.Storage.Packaging.Appx.APPX_PACKAGE_ARCHITECTURE.APPX_PACKAGE_ARCHITECTURE_X86,
13+
14+
/// <summary>
15+
/// The ARM processor architecture.
16+
/// </summary>
17+
ARM = Windows.Win32.Storage.Packaging.Appx.APPX_PACKAGE_ARCHITECTURE.APPX_PACKAGE_ARCHITECTURE_ARM,
18+
19+
/// <summary>
20+
/// The x64 processor architecture.
21+
/// </summary>
22+
x64 = Windows.Win32.Storage.Packaging.Appx.APPX_PACKAGE_ARCHITECTURE.APPX_PACKAGE_ARCHITECTURE_X64,
23+
24+
/// <summary>
25+
/// Any processor architecture.
26+
/// </summary>
27+
Neutral = Windows.Win32.Storage.Packaging.Appx.APPX_PACKAGE_ARCHITECTURE.APPX_PACKAGE_ARCHITECTURE_NEUTRAL,
28+
29+
/// <summary>
30+
/// The 64-bit ARM processor architecture.
31+
/// </summary>
32+
ARM64 = Windows.Win32.Storage.Packaging.Appx.APPX_PACKAGE_ARCHITECTURE.APPX_PACKAGE_ARCHITECTURE_ARM64,
33+
}
34+
}

0 commit comments

Comments
 (0)