| 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 WixBundleRollbackBoundary = new IntermediateSymbolDefinition( |
| 10 | SymbolDefinitionType.WixBundleRollbackBoundary, |
| 11 | new[] |
| 12 | { |
| 13 | new IntermediateFieldDefinition(nameof(WixBundleSymbolFields.Attributes), IntermediateFieldType.Number), |
| 14 | new IntermediateFieldDefinition(nameof(WixBundlePackageSymbolFields.LogPathVariable), IntermediateFieldType.String), |
| 15 | }, |
| 16 | typeof(WixBundleRollbackBoundarySymbol)); |
| 17 | } |
| 18 | } |
| 19 | |
| 20 | namespace WixToolset.Data.Symbols |
| 21 | { |
| 22 | using System; |
| 23 | |
| 24 | public enum WixBundleRollbackBoundarySymbolFields |
| 25 | { |
| 26 | Attributes, |
| 27 | LogPathVariable, |
| 28 | } |
| 29 | |
| 30 | [Flags] |
| 31 | public enum WixBundleRollbackBoundaryAttributes |
| 32 | { |
| 33 | None = 0x0, |
| 34 | Vital = 0x1, |
| 35 | Transaction = 0x2, |
| 36 | } |
| 37 | |
| 38 | public class WixBundleRollbackBoundarySymbol : IntermediateSymbol |
| 39 | { |
| 40 | public WixBundleRollbackBoundarySymbol() : base(SymbolDefinitions.WixBundleRollbackBoundary, null, null) |
| 41 | { |
| 42 | } |
| 43 | |
| 44 | public WixBundleRollbackBoundarySymbol(SourceLineNumber sourceLineNumber, Identifier id = null) : base(SymbolDefinitions.WixBundleRollbackBoundary, sourceLineNumber, id) |
| 45 | { |
| 46 | } |
| 47 | |
| 48 | public IntermediateField this[WixBundleRollbackBoundarySymbolFields index] => this.Fields[(int)index]; |
| 49 | |
| 50 | public WixBundleRollbackBoundaryAttributes Attributes |
| 51 | { |
| 52 | get => (WixBundleRollbackBoundaryAttributes)this.Fields[(int)WixBundleRollbackBoundarySymbolFields.Attributes].AsNumber(); |
| 53 | set => this.Set((int)WixBundleRollbackBoundarySymbolFields.Attributes, (int)value); |
| 54 | } |
| 55 | |
| 56 | public string LogPathVariable |
| 57 | { |
| 58 | get => (string)this.Fields[(int)WixBundleRollbackBoundarySymbolFields.LogPathVariable]; |
| 59 | set => this.Set((int)WixBundleRollbackBoundarySymbolFields.LogPathVariable, value); |
| 60 | } |
| 61 | |
| 62 | public bool Vital |
| 63 | { |
| 64 | get { return this.Attributes.HasFlag(WixBundleRollbackBoundaryAttributes.Vital); } |
| 65 | set |
| 66 | { |
| 67 | if (value) |
| 68 | { |
| 69 | this.Attributes |= WixBundleRollbackBoundaryAttributes.Vital; |
| 70 | } |
| 71 | else |
| 72 | { |
| 73 | this.Attributes &= ~WixBundleRollbackBoundaryAttributes.Vital; |
| 74 | } |
| 75 | } |
| 76 | } |
| 77 | |
| 78 | public bool Transaction |
| 79 | { |
| 80 | get { return this.Attributes.HasFlag(WixBundleRollbackBoundaryAttributes.Transaction); } |
| 81 | set |
| 82 | { |
| 83 | if (value) |
| 84 | { |
| 85 | this.Attributes |= WixBundleRollbackBoundaryAttributes.Transaction; |
| 86 | } |
| 87 | else |
| 88 | { |
| 89 | this.Attributes &= ~WixBundleRollbackBoundaryAttributes.Transaction; |
| 90 | } |
| 91 | } |
| 92 | } |
| 93 | } |
| 94 | } |