| 1 | // Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. |
| 2 | |
| 3 | namespace WixToolset.Data |
| 4 | { |
| 5 | using WixToolset.Data.Symbols; |
| 6 | |
| 7 | public static partial class SymbolDefinitions |
| 8 | { |
| 9 | public static readonly IntermediateSymbolDefinition WixBundlePackage = new IntermediateSymbolDefinition( |
| 10 | SymbolDefinitionType.WixBundlePackage, |
| 11 | new[] |
| 12 | { |
| 13 | new IntermediateFieldDefinition(nameof(WixBundlePackageSymbolFields.Type), IntermediateFieldType.String), |
| 14 | new IntermediateFieldDefinition(nameof(WixBundlePackageSymbolFields.PayloadRef), IntermediateFieldType.String), |
| 15 | new IntermediateFieldDefinition(nameof(WixBundlePackageSymbolFields.Attributes), IntermediateFieldType.Number), |
| 16 | new IntermediateFieldDefinition(nameof(WixBundlePackageSymbolFields.InstallCondition), IntermediateFieldType.String), |
| 17 | new IntermediateFieldDefinition(nameof(WixBundlePackageSymbolFields.RepairCondition), IntermediateFieldType.String), |
| 18 | new IntermediateFieldDefinition(nameof(WixBundlePackageSymbolFields.Cache), IntermediateFieldType.String), |
| 19 | new IntermediateFieldDefinition(nameof(WixBundlePackageSymbolFields.CacheId), IntermediateFieldType.String), |
| 20 | new IntermediateFieldDefinition(nameof(WixBundlePackageSymbolFields.PerMachine), IntermediateFieldType.Bool), |
| 21 | new IntermediateFieldDefinition(nameof(WixBundlePackageSymbolFields.LogPathVariable), IntermediateFieldType.String), |
| 22 | new IntermediateFieldDefinition(nameof(WixBundlePackageSymbolFields.RollbackLogPathVariable), IntermediateFieldType.String), |
| 23 | new IntermediateFieldDefinition(nameof(WixBundlePackageSymbolFields.Size), IntermediateFieldType.LargeNumber), |
| 24 | new IntermediateFieldDefinition(nameof(WixBundlePackageSymbolFields.InstallSize), IntermediateFieldType.LargeNumber), |
| 25 | new IntermediateFieldDefinition(nameof(WixBundlePackageSymbolFields.Version), IntermediateFieldType.String), |
| 26 | new IntermediateFieldDefinition(nameof(WixBundlePackageSymbolFields.Language), IntermediateFieldType.Number), |
| 27 | new IntermediateFieldDefinition(nameof(WixBundlePackageSymbolFields.DisplayName), IntermediateFieldType.String), |
| 28 | new IntermediateFieldDefinition(nameof(WixBundlePackageSymbolFields.Description), IntermediateFieldType.String), |
| 29 | new IntermediateFieldDefinition(nameof(WixBundlePackageSymbolFields.RollbackBoundaryRef), IntermediateFieldType.String), |
| 30 | new IntermediateFieldDefinition(nameof(WixBundlePackageSymbolFields.RollbackBoundaryBackwardRef), IntermediateFieldType.String), |
| 31 | }, |
| 32 | typeof(WixBundlePackageSymbol)); |
| 33 | } |
| 34 | } |
| 35 | |
| 36 | namespace WixToolset.Data.Symbols |
| 37 | { |
| 38 | using System; |
| 39 | |
| 40 | public enum WixBundlePackageSymbolFields |
| 41 | { |
| 42 | Type, |
| 43 | PayloadRef, |
| 44 | Attributes, |
| 45 | InstallCondition, |
| 46 | RepairCondition, |
| 47 | Cache, |
| 48 | CacheId, |
| 49 | PerMachine, |
| 50 | LogPathVariable, |
| 51 | RollbackLogPathVariable, |
| 52 | Size, |
| 53 | InstallSize, |
| 54 | Version, |
| 55 | Language, |
| 56 | DisplayName, |
| 57 | Description, |
| 58 | RollbackBoundaryRef, |
| 59 | RollbackBoundaryBackwardRef, |
| 60 | } |
| 61 | |
| 62 | /// <summary> |
| 63 | /// Types of bundle packages. |
| 64 | /// </summary> |
| 65 | public enum WixBundlePackageType |
| 66 | { |
| 67 | NotSet = -1, |
| 68 | Bundle, |
| 69 | Exe, |
| 70 | Msi, |
| 71 | Msp, |
| 72 | Msu, |
| 73 | } |
| 74 | |
| 75 | [Flags] |
| 76 | public enum WixBundlePackageAttributes |
| 77 | { |
| 78 | None = 0x0, |
| 79 | Permanent = 0x1, |
| 80 | Visible = 0x2, |
| 81 | Win64 = 0x4, |
| 82 | Vital = 0x8, |
| 83 | } |
| 84 | |
| 85 | public class WixBundlePackageSymbol : IntermediateSymbol |
| 86 | { |
| 87 | public WixBundlePackageSymbol() : base(SymbolDefinitions.WixBundlePackage, null, null) |
| 88 | { |
| 89 | } |
| 90 | |
| 91 | public WixBundlePackageSymbol(SourceLineNumber sourceLineNumber, Identifier id = null) : base(SymbolDefinitions.WixBundlePackage, sourceLineNumber, id) |
| 92 | { |
| 93 | } |
| 94 | |
| 95 | public IntermediateField this[WixBundlePackageSymbolFields index] => this.Fields[(int)index]; |
| 96 | |
| 97 | public WixBundlePackageType Type |
| 98 | { |
| 99 | get |
| 100 | { |
| 101 | if (Enum.TryParse((string)this.Fields[(int)WixBundlePackageSymbolFields.Type], true, out WixBundlePackageType value)) |
| 102 | { |
| 103 | return value; |
| 104 | } |
| 105 | |
| 106 | return WixBundlePackageType.NotSet; |
| 107 | } |
| 108 | set => this.Set((int)WixBundlePackageSymbolFields.Type, value.ToString()); |
| 109 | } |
| 110 | |
| 111 | public string PayloadRef |
| 112 | { |
| 113 | get => (string)this.Fields[(int)WixBundlePackageSymbolFields.PayloadRef]; |
| 114 | set => this.Set((int)WixBundlePackageSymbolFields.PayloadRef, value); |
| 115 | } |
| 116 | |
| 117 | public WixBundlePackageAttributes Attributes |
| 118 | { |
| 119 | get => (WixBundlePackageAttributes)(int)this.Fields[(int)WixBundlePackageSymbolFields.Attributes]; |
| 120 | set => this.Set((int)WixBundlePackageSymbolFields.Attributes, (int)value); |
| 121 | } |
| 122 | |
| 123 | public string InstallCondition |
| 124 | { |
| 125 | get => (string)this.Fields[(int)WixBundlePackageSymbolFields.InstallCondition]; |
| 126 | set => this.Set((int)WixBundlePackageSymbolFields.InstallCondition, value); |
| 127 | } |
| 128 | |
| 129 | public string RepairCondition |
| 130 | { |
| 131 | get => (string)this.Fields[(int)WixBundlePackageSymbolFields.RepairCondition]; |
| 132 | set => this.Set((int)WixBundlePackageSymbolFields.RepairCondition, value); |
| 133 | } |
| 134 | |
| 135 | public BundleCacheType? Cache |
| 136 | { |
| 137 | get => Enum.TryParse((string)this.Fields[(int)WixBundlePackageSymbolFields.Cache], true, out BundleCacheType value) ? value : (BundleCacheType?)null; |
| 138 | set => this.Set((int)WixBundlePackageSymbolFields.Cache, value.ToString().ToLowerInvariant()); |
| 139 | } |
| 140 | |
| 141 | public string CacheId |
| 142 | { |
| 143 | get => (string)this.Fields[(int)WixBundlePackageSymbolFields.CacheId]; |
| 144 | set => this.Set((int)WixBundlePackageSymbolFields.CacheId, value); |
| 145 | } |
| 146 | |
| 147 | public bool? PerMachine |
| 148 | { |
| 149 | get => (bool?)this.Fields[(int)WixBundlePackageSymbolFields.PerMachine]; |
| 150 | set => this.Set((int)WixBundlePackageSymbolFields.PerMachine, value); |
| 151 | } |
| 152 | |
| 153 | public string LogPathVariable |
| 154 | { |
| 155 | get => (string)this.Fields[(int)WixBundlePackageSymbolFields.LogPathVariable]; |
| 156 | set => this.Set((int)WixBundlePackageSymbolFields.LogPathVariable, value); |
| 157 | } |
| 158 | |
| 159 | public string RollbackLogPathVariable |
| 160 | { |
| 161 | get => (string)this.Fields[(int)WixBundlePackageSymbolFields.RollbackLogPathVariable]; |
| 162 | set => this.Set((int)WixBundlePackageSymbolFields.RollbackLogPathVariable, value); |
| 163 | } |
| 164 | |
| 165 | public long Size |
| 166 | { |
| 167 | get => (long)this.Fields[(int)WixBundlePackageSymbolFields.Size]; |
| 168 | set => this.Set((int)WixBundlePackageSymbolFields.Size, value); |
| 169 | } |
| 170 | |
| 171 | public long? InstallSize |
| 172 | { |
| 173 | get => (long?)this.Fields[(int)WixBundlePackageSymbolFields.InstallSize]; |
| 174 | set => this.Set((int)WixBundlePackageSymbolFields.InstallSize, value); |
| 175 | } |
| 176 | |
| 177 | public string Version |
| 178 | { |
| 179 | get => (string)this.Fields[(int)WixBundlePackageSymbolFields.Version]; |
| 180 | set => this.Set((int)WixBundlePackageSymbolFields.Version, value); |
| 181 | } |
| 182 | |
| 183 | public int? Language |
| 184 | { |
| 185 | get => (int?)this.Fields[(int)WixBundlePackageSymbolFields.Language]; |
| 186 | set => this.Set((int)WixBundlePackageSymbolFields.Language, value); |
| 187 | } |
| 188 | |
| 189 | public string DisplayName |
| 190 | { |
| 191 | get => (string)this.Fields[(int)WixBundlePackageSymbolFields.DisplayName]; |
| 192 | set => this.Set((int)WixBundlePackageSymbolFields.DisplayName, value); |
| 193 | } |
| 194 | |
| 195 | public string Description |
| 196 | { |
| 197 | get => (string)this.Fields[(int)WixBundlePackageSymbolFields.Description]; |
| 198 | set => this.Set((int)WixBundlePackageSymbolFields.Description, value); |
| 199 | } |
| 200 | |
| 201 | public string RollbackBoundaryRef |
| 202 | { |
| 203 | get => (string)this.Fields[(int)WixBundlePackageSymbolFields.RollbackBoundaryRef]; |
| 204 | set => this.Set((int)WixBundlePackageSymbolFields.RollbackBoundaryRef, value); |
| 205 | } |
| 206 | |
| 207 | public string RollbackBoundaryBackwardRef |
| 208 | { |
| 209 | get => (string)this.Fields[(int)WixBundlePackageSymbolFields.RollbackBoundaryBackwardRef]; |
| 210 | set => this.Set((int)WixBundlePackageSymbolFields.RollbackBoundaryBackwardRef, value); |
| 211 | } |
| 212 | |
| 213 | public bool Permanent |
| 214 | { |
| 215 | get { return this.Attributes.HasFlag(WixBundlePackageAttributes.Permanent); } |
| 216 | set |
| 217 | { |
| 218 | if (value) |
| 219 | { |
| 220 | this.Attributes |= WixBundlePackageAttributes.Permanent; |
| 221 | } |
| 222 | else |
| 223 | { |
| 224 | this.Attributes &= ~WixBundlePackageAttributes.Permanent; |
| 225 | } |
| 226 | } |
| 227 | } |
| 228 | |
| 229 | public bool Visible |
| 230 | { |
| 231 | get { return this.Attributes.HasFlag(WixBundlePackageAttributes.Visible); } |
| 232 | set |
| 233 | { |
| 234 | if (value) |
| 235 | { |
| 236 | this.Attributes |= WixBundlePackageAttributes.Visible; |
| 237 | } |
| 238 | else |
| 239 | { |
| 240 | this.Attributes &= ~WixBundlePackageAttributes.Visible; |
| 241 | } |
| 242 | } |
| 243 | } |
| 244 | |
| 245 | public bool Win64 |
| 246 | { |
| 247 | get { return this.Attributes.HasFlag(WixBundlePackageAttributes.Win64); } |
| 248 | set |
| 249 | { |
| 250 | if (value) |
| 251 | { |
| 252 | this.Attributes |= WixBundlePackageAttributes.Win64; |
| 253 | } |
| 254 | else |
| 255 | { |
| 256 | this.Attributes &= ~WixBundlePackageAttributes.Win64; |
| 257 | } |
| 258 | } |
| 259 | } |
| 260 | |
| 261 | public bool Vital |
| 262 | { |
| 263 | get { return this.Attributes.HasFlag(WixBundlePackageAttributes.Vital); } |
| 264 | set |
| 265 | { |
| 266 | if (value) |
| 267 | { |
| 268 | this.Attributes |= WixBundlePackageAttributes.Vital; |
| 269 | } |
| 270 | else |
| 271 | { |
| 272 | this.Attributes &= ~WixBundlePackageAttributes.Vital; |
| 273 | } |
| 274 | } |
| 275 | } |
| 276 | } |
| 277 | } |