|
| 1 | +using System; |
| 2 | +using System.Collections.Generic; |
| 3 | +using System.Collections.ObjectModel; |
| 4 | + |
| 5 | +namespace PSADT.AppManagement |
| 6 | +{ |
| 7 | + /// <summary> |
| 8 | + /// Represents an app package in the system. |
| 9 | + /// </summary> |
| 10 | + public sealed record AppxPackage |
| 11 | + { |
| 12 | + /// <summary> |
| 13 | + /// Initializes a new instance of the <see cref="AppxPackage"/> class. |
| 14 | + /// </summary> |
| 15 | + /// <param name="name">The display name of the app package.</param> |
| 16 | + /// <param name="publisher">The publisher of the app package.</param> |
| 17 | + /// <param name="publisherId">The publisher ID of the app package.</param> |
| 18 | + /// <param name="architecture">The architecture of the app package.</param> |
| 19 | + /// <param name="resourceId">The resource ID of the app package.</param> |
| 20 | + /// <param name="version">The version of the app package.</param> |
| 21 | + /// <param name="packageFamilyName">The package family name of the app package.</param> |
| 22 | + /// <param name="packageFullName">The full name of the app package.</param> |
| 23 | + /// <param name="installLocation">The install location of the app package.</param> |
| 24 | + /// <param name="isFramework">Indicates whether the app package is a framework.</param> |
| 25 | + /// <param name="packageUserInformation">The user information of the app package.</param> |
| 26 | + /// <param name="isResourcePackage">Indicates whether the app package is a resource package.</param> |
| 27 | + /// <param name="isBundle">Indicates whether the app package is a bundle.</param> |
| 28 | + /// <param name="isDevelopmentMode">Indicates whether the app package is in development mode.</param> |
| 29 | + /// <param name="nonRemovable">Indicates whether the app package is non-removable.</param> |
| 30 | + /// <param name="dependencies">The dependencies of the app package.</param> |
| 31 | + /// <param name="isPartiallyStaged">Indicates whether the app package is partially staged.</param> |
| 32 | + /// <param name="signatureKind">The signature kind of the app package.</param> |
| 33 | + /// <param name="status">The status of the app package.</param> |
| 34 | + public AppxPackage(string name, string publisher, string publisherId, PackageArchitecture architecture, string resourceId, Version version, string packageFamilyName, string packageFullName, string installLocation, bool isFramework, ReadOnlyCollection<PackageUserInformation> packageUserInformation, bool isResourcePackage, bool isBundle, bool isDevelopmentMode, bool nonRemovable, ReadOnlyCollection<AppxPackage> dependencies, bool isPartiallyStaged, PackageSignatureKind signatureKind, PackageStatus status) |
| 35 | + { |
| 36 | + ArgumentException.ThrowIfNullOrWhiteSpace(name); |
| 37 | + ArgumentException.ThrowIfNullOrWhiteSpace(publisher); |
| 38 | + ArgumentException.ThrowIfNullOrWhiteSpace(publisherId); |
| 39 | + ArgumentException.ThrowIfNullOrWhiteSpace(resourceId); |
| 40 | + ArgumentException.ThrowIfNullOrWhiteSpace(packageFamilyName); |
| 41 | + ArgumentException.ThrowIfNullOrWhiteSpace(packageFullName); |
| 42 | + ArgumentException.ThrowIfNullOrWhiteSpace(installLocation); |
| 43 | + DisplayName = name; |
| 44 | + Publisher = publisher; |
| 45 | + PublisherId = publisherId; |
| 46 | + Architecture = architecture; |
| 47 | + ResourceId = resourceId; |
| 48 | + Version = version; |
| 49 | + PackageFamilyName = packageFamilyName; |
| 50 | + PackageFullName = packageFullName; |
| 51 | + InstallLocation = installLocation; |
| 52 | + IsFramework = isFramework; |
| 53 | + PackageUserInformation = packageUserInformation; |
| 54 | + IsResourcePackage = isResourcePackage; |
| 55 | + IsBundle = isBundle; |
| 56 | + IsDevelopmentMode = isDevelopmentMode; |
| 57 | + NonRemovable = nonRemovable; |
| 58 | + Dependencies = dependencies; |
| 59 | + IsPartiallyStaged = isPartiallyStaged; |
| 60 | + SignatureKind = signatureKind; |
| 61 | + Status = status; |
| 62 | + } |
| 63 | + |
| 64 | + /// <summary> |
| 65 | + /// Gets the name of the package. |
| 66 | + /// </summary> |
| 67 | + public string DisplayName { get; } |
| 68 | + |
| 69 | + /// <summary> |
| 70 | + /// Gets the publisher of the app package. |
| 71 | + /// </summary> |
| 72 | + public string Publisher { get; } |
| 73 | + |
| 74 | + /// <summary> |
| 75 | + /// Gets the publisher ID of the app package. |
| 76 | + /// </summary> |
| 77 | + public string PublisherId { get; } |
| 78 | + |
| 79 | + /// <summary> |
| 80 | + /// Gets the architecture of the app package. |
| 81 | + /// </summary> |
| 82 | + public PackageArchitecture Architecture { get; } |
| 83 | + |
| 84 | + /// <summary> |
| 85 | + /// Gets the resource ID of the app package. |
| 86 | + /// </summary> |
| 87 | + public string ResourceId { get; } |
| 88 | + |
| 89 | + /// <summary> |
| 90 | + /// Gets the version of the app package. |
| 91 | + /// </summary> |
| 92 | + public Version Version { get; } |
| 93 | + |
| 94 | + /// <summary> |
| 95 | + /// Gets the package family name of the app package. |
| 96 | + /// </summary> |
| 97 | + public string PackageFamilyName { get; } |
| 98 | + |
| 99 | + /// <summary> |
| 100 | + /// Gets the full name of the app package. |
| 101 | + /// </summary> |
| 102 | + public string PackageFullName { get; } |
| 103 | + |
| 104 | + /// <summary> |
| 105 | + /// Gets the install location of the app package. |
| 106 | + /// </summary> |
| 107 | + public string InstallLocation { get; } |
| 108 | + |
| 109 | + /// <summary> |
| 110 | + /// Gets a value indicating whether the app package is a framework package. |
| 111 | + /// </summary> |
| 112 | + public bool IsFramework { get; } |
| 113 | + |
| 114 | + /// <summary> |
| 115 | + /// Gets the user information of the app package. |
| 116 | + /// </summary> |
| 117 | + public IReadOnlyList<PackageUserInformation> PackageUserInformation { get; } |
| 118 | + |
| 119 | + /// <summary> |
| 120 | + /// Gets a value indicating whether the app package is a resource package. |
| 121 | + /// </summary> |
| 122 | + public bool IsResourcePackage { get; } |
| 123 | + |
| 124 | + /// <summary> |
| 125 | + /// Gets a value indicating whether the app package is a bundle package. |
| 126 | + /// </summary> |
| 127 | + public bool IsBundle { get; } |
| 128 | + |
| 129 | + /// <summary> |
| 130 | + /// Gets a value indicating whether the app package is in development mode. |
| 131 | + /// </summary> |
| 132 | + public bool IsDevelopmentMode { get; } |
| 133 | + |
| 134 | + /// <summary> |
| 135 | + /// Gets a value indicating whether the app package is non-removable. |
| 136 | + /// </summary> |
| 137 | + public bool NonRemovable { get; } |
| 138 | + |
| 139 | + /// <summary> |
| 140 | + /// Gets the dependencies of the app package. |
| 141 | + /// </summary> |
| 142 | + public IReadOnlyList<AppxPackage> Dependencies { get; } |
| 143 | + |
| 144 | + /// <summary> |
| 145 | + /// Gets a value indicating whether the app package is partially staged. |
| 146 | + /// </summary> |
| 147 | + public bool IsPartiallyStaged { get; } |
| 148 | + |
| 149 | + /// <summary> |
| 150 | + /// Gets the signature kind of the app package. |
| 151 | + /// </summary> |
| 152 | + public PackageSignatureKind SignatureKind { get; } |
| 153 | + |
| 154 | + /// <summary> |
| 155 | + /// Gets the status of the app package. |
| 156 | + /// </summary> |
| 157 | + public PackageStatus Status { get; } |
| 158 | + } |
| 159 | +} |
0 commit comments