|
| 1 | +using System; |
| 2 | +using PSADT.Interop; |
| 3 | + |
| 4 | +namespace PSADT.AppManagement |
| 5 | +{ |
| 6 | + /// <summary> |
| 7 | + /// Represents a provisioned package in the system. |
| 8 | + /// </summary> |
| 9 | + public sealed record AppxProvisionedPackage |
| 10 | + { |
| 11 | + /// <summary> |
| 12 | + /// Initializes a new instance of the <see cref="AppxProvisionedPackage"/> class. |
| 13 | + /// </summary> |
| 14 | + /// <param name="packageName">The package name of the provisioned package.</param> |
| 15 | + /// <param name="displayName">The display name of the provisioned package.</param> |
| 16 | + /// <param name="publisherId">The publisher ID of the provisioned package.</param> |
| 17 | + /// <param name="majorVersion">The major version of the provisioned package.</param> |
| 18 | + /// <param name="minorVersion">The minor version of the provisioned package.</param> |
| 19 | + /// <param name="build">The build number of the provisioned package.</param> |
| 20 | + /// <param name="revision">The revision number of the provisioned package.</param> |
| 21 | + /// <param name="architecture">The architecture of the provisioned package.</param> |
| 22 | + /// <param name="resourceId">The resource ID of the provisioned package.</param> |
| 23 | + /// <param name="installLocation">The install location of the provisioned package.</param> |
| 24 | + /// <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) |
| 26 | + { |
| 27 | + ArgumentException.ThrowIfNullOrWhiteSpace(packageName); |
| 28 | + ArgumentException.ThrowIfNullOrWhiteSpace(displayName); |
| 29 | + ArgumentException.ThrowIfNullOrWhiteSpace(publisherId); |
| 30 | + ArgumentException.ThrowIfNullOrWhiteSpace(resourceId); |
| 31 | + ArgumentException.ThrowIfNullOrWhiteSpace(installLocation); |
| 32 | + ArgumentException.ThrowIfNullOrWhiteSpace(regions); |
| 33 | + Version = new((int)majorVersion, (int)minorVersion, (int)build, (int)revision); |
| 34 | + PackageName = packageName; |
| 35 | + DisplayName = displayName; |
| 36 | + PublisherId = publisherId; |
| 37 | + Architecture = architecture; |
| 38 | + ResourceId = resourceId; |
| 39 | + InstallLocation = installLocation; |
| 40 | + Regions = regions; |
| 41 | + } |
| 42 | + |
| 43 | + /// <summary> |
| 44 | + /// Gets the package name of the provisioned package. |
| 45 | + /// </summary> |
| 46 | + public string PackageName { get; } |
| 47 | + |
| 48 | + /// <summary> |
| 49 | + /// Gets the display name of the provisioned package. |
| 50 | + /// </summary> |
| 51 | + public string DisplayName { get; } |
| 52 | + |
| 53 | + /// <summary> |
| 54 | + /// Gets the publisher ID of the provisioned package. |
| 55 | + /// </summary> |
| 56 | + public string PublisherId { get; } |
| 57 | + |
| 58 | + /// <summary> |
| 59 | + /// Gets the version of the provisioned package. |
| 60 | + /// </summary> |
| 61 | + public Version Version { get; } |
| 62 | + |
| 63 | + /// <summary> |
| 64 | + /// Gets the architecture of the provisioned package. |
| 65 | + /// </summary> |
| 66 | + public APPX_PACKAGE_ARCHITECTURE Architecture { get; } |
| 67 | + |
| 68 | + /// <summary> |
| 69 | + /// Gets the resource ID of the provisioned package. |
| 70 | + /// </summary> |
| 71 | + public string ResourceId { get; } |
| 72 | + |
| 73 | + /// <summary> |
| 74 | + /// Gets the install location of the provisioned package. |
| 75 | + /// </summary> |
| 76 | + public string InstallLocation { get; } |
| 77 | + |
| 78 | + /// <summary> |
| 79 | + /// Gets the regions where the provisioned package is available. |
| 80 | + /// </summary> |
| 81 | + public string Regions { get; } |
| 82 | + } |
| 83 | +} |
0 commit comments