| 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 WixBundleExePackage = new IntermediateSymbolDefinition( |
| 10 | SymbolDefinitionType.WixBundleExePackage, |
| 11 | new[] |
| 12 | { |
| 13 | new IntermediateFieldDefinition(nameof(WixBundleExePackageSymbolFields.Attributes), IntermediateFieldType.Number), |
| 14 | new IntermediateFieldDefinition(nameof(WixBundleExePackageSymbolFields.DetectCondition), IntermediateFieldType.String), |
| 15 | new IntermediateFieldDefinition(nameof(WixBundleExePackageSymbolFields.InstallCommand), IntermediateFieldType.String), |
| 16 | new IntermediateFieldDefinition(nameof(WixBundleExePackageSymbolFields.RepairCommand), IntermediateFieldType.String), |
| 17 | new IntermediateFieldDefinition(nameof(WixBundleExePackageSymbolFields.UninstallCommand), IntermediateFieldType.String), |
| 18 | new IntermediateFieldDefinition(nameof(WixBundleExePackageSymbolFields.ExeProtocol), IntermediateFieldType.String), |
| 19 | new IntermediateFieldDefinition(nameof(WixBundleExePackageSymbolFields.DetectionType), IntermediateFieldType.Number), |
| 20 | new IntermediateFieldDefinition(nameof(WixBundleExePackageSymbolFields.ArpId), IntermediateFieldType.String), |
| 21 | new IntermediateFieldDefinition(nameof(WixBundleExePackageSymbolFields.ArpDisplayVersion), IntermediateFieldType.String), |
| 22 | }, |
| 23 | typeof(WixBundleExePackageSymbol)); |
| 24 | } |
| 25 | } |
| 26 | |
| 27 | namespace WixToolset.Data.Symbols |
| 28 | { |
| 29 | using System; |
| 30 | |
| 31 | public enum WixBundleExePackageSymbolFields |
| 32 | { |
| 33 | Attributes, |
| 34 | DetectCondition, |
| 35 | InstallCommand, |
| 36 | RepairCommand, |
| 37 | UninstallCommand, |
| 38 | ExeProtocol, |
| 39 | DetectionType, |
| 40 | ArpId, |
| 41 | ArpDisplayVersion, |
| 42 | } |
| 43 | |
| 44 | /// <summary> |
| 45 | /// How Burn will detect the ExePackage. |
| 46 | /// </summary> |
| 47 | public enum WixBundleExePackageDetectionType |
| 48 | { |
| 49 | None, |
| 50 | Condition, |
| 51 | Arp, |
| 52 | } |
| 53 | |
| 54 | [Flags] |
| 55 | public enum WixBundleExePackageAttributes |
| 56 | { |
| 57 | None = 0, |
| 58 | Bundle = 1, |
| 59 | ArpWin64 = 2, |
| 60 | ArpUseUninstallString = 4, |
| 61 | } |
| 62 | |
| 63 | public class WixBundleExePackageSymbol : IntermediateSymbol |
| 64 | { |
| 65 | public WixBundleExePackageSymbol() : base(SymbolDefinitions.WixBundleExePackage, null, null) |
| 66 | { |
| 67 | } |
| 68 | |
| 69 | public WixBundleExePackageSymbol(SourceLineNumber sourceLineNumber, Identifier id = null) : base(SymbolDefinitions.WixBundleExePackage, sourceLineNumber, id) |
| 70 | { |
| 71 | } |
| 72 | |
| 73 | public IntermediateField this[WixBundleExePackageSymbolFields index] => this.Fields[(int)index]; |
| 74 | |
| 75 | public WixBundleExePackageAttributes Attributes |
| 76 | { |
| 77 | get => (WixBundleExePackageAttributes)(int)this.Fields[(int)WixBundleExePackageSymbolFields.Attributes]; |
| 78 | set => this.Set((int)WixBundleExePackageSymbolFields.Attributes, (int)value); |
| 79 | } |
| 80 | |
| 81 | public string DetectCondition |
| 82 | { |
| 83 | get => (string)this.Fields[(int)WixBundleExePackageSymbolFields.DetectCondition]; |
| 84 | set => this.Set((int)WixBundleExePackageSymbolFields.DetectCondition, value); |
| 85 | } |
| 86 | |
| 87 | public string InstallCommand |
| 88 | { |
| 89 | get => (string)this.Fields[(int)WixBundleExePackageSymbolFields.InstallCommand]; |
| 90 | set => this.Set((int)WixBundleExePackageSymbolFields.InstallCommand, value); |
| 91 | } |
| 92 | |
| 93 | public string RepairCommand |
| 94 | { |
| 95 | get => (string)this.Fields[(int)WixBundleExePackageSymbolFields.RepairCommand]; |
| 96 | set => this.Set((int)WixBundleExePackageSymbolFields.RepairCommand, value); |
| 97 | } |
| 98 | |
| 99 | public string UninstallCommand |
| 100 | { |
| 101 | get => (string)this.Fields[(int)WixBundleExePackageSymbolFields.UninstallCommand]; |
| 102 | set => this.Set((int)WixBundleExePackageSymbolFields.UninstallCommand, value); |
| 103 | } |
| 104 | |
| 105 | public string ExeProtocol |
| 106 | { |
| 107 | get => (string)this.Fields[(int)WixBundleExePackageSymbolFields.ExeProtocol]; |
| 108 | set => this.Set((int)WixBundleExePackageSymbolFields.ExeProtocol, value); |
| 109 | } |
| 110 | |
| 111 | public WixBundleExePackageDetectionType DetectionType |
| 112 | { |
| 113 | get => (WixBundleExePackageDetectionType)this.Fields[(int)WixBundleExePackageSymbolFields.DetectionType].AsNumber(); |
| 114 | set => this.Set((int)WixBundleExePackageSymbolFields.DetectionType, (int)value); |
| 115 | } |
| 116 | |
| 117 | public string ArpId |
| 118 | { |
| 119 | get => (string)this.Fields[(int)WixBundleExePackageSymbolFields.ArpId]; |
| 120 | set => this.Set((int)WixBundleExePackageSymbolFields.ArpId, value); |
| 121 | } |
| 122 | |
| 123 | public string ArpDisplayVersion |
| 124 | { |
| 125 | get => (string)this.Fields[(int)WixBundleExePackageSymbolFields.ArpDisplayVersion]; |
| 126 | set => this.Set((int)WixBundleExePackageSymbolFields.ArpDisplayVersion, value); |
| 127 | } |
| 128 | |
| 129 | public bool IsBundle |
| 130 | { |
| 131 | get { return this.Attributes.HasFlag(WixBundleExePackageAttributes.Bundle); } |
| 132 | set |
| 133 | { |
| 134 | if (value) |
| 135 | { |
| 136 | this.Attributes |= WixBundleExePackageAttributes.Bundle; |
| 137 | } |
| 138 | else |
| 139 | { |
| 140 | this.Attributes &= ~WixBundleExePackageAttributes.Bundle; |
| 141 | } |
| 142 | } |
| 143 | } |
| 144 | |
| 145 | public bool ArpWin64 |
| 146 | { |
| 147 | get { return this.Attributes.HasFlag(WixBundleExePackageAttributes.ArpWin64); } |
| 148 | set |
| 149 | { |
| 150 | if (value) |
| 151 | { |
| 152 | this.Attributes |= WixBundleExePackageAttributes.ArpWin64; |
| 153 | } |
| 154 | else |
| 155 | { |
| 156 | this.Attributes &= ~WixBundleExePackageAttributes.ArpWin64; |
| 157 | } |
| 158 | } |
| 159 | } |
| 160 | |
| 161 | public bool ArpUseUninstallString |
| 162 | { |
| 163 | get { return this.Attributes.HasFlag(WixBundleExePackageAttributes.ArpUseUninstallString); } |
| 164 | set |
| 165 | { |
| 166 | if (value) |
| 167 | { |
| 168 | this.Attributes |= WixBundleExePackageAttributes.ArpUseUninstallString; |
| 169 | } |
| 170 | else |
| 171 | { |
| 172 | this.Attributes &= ~WixBundleExePackageAttributes.ArpUseUninstallString; |
| 173 | } |
| 174 | } |
| 175 | } |
| 176 | |
| 177 | public bool Repairable => this.RepairCommand != null; |
| 178 | |
| 179 | public bool Uninstallable => this.UninstallCommand != null; |
| 180 | } |
| 181 | } |