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