| 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 WixDependency = new IntermediateSymbolDefinition( |
| 10 | SymbolDefinitionType.WixDependency, |
| 11 | new[] |
| 12 | { |
| 13 | new IntermediateFieldDefinition(nameof(WixDependencySymbolFields.ProviderKey), IntermediateFieldType.String), |
| 14 | new IntermediateFieldDefinition(nameof(WixDependencySymbolFields.MinVersion), IntermediateFieldType.String), |
| 15 | new IntermediateFieldDefinition(nameof(WixDependencySymbolFields.MaxVersion), IntermediateFieldType.String), |
| 16 | new IntermediateFieldDefinition(nameof(WixDependencySymbolFields.Attributes), IntermediateFieldType.Number), |
| 17 | }, |
| 18 | typeof(WixDependencySymbol)); |
| 19 | } |
| 20 | } |
| 21 | |
| 22 | namespace WixToolset.Data.Symbols |
| 23 | { |
| 24 | using System; |
| 25 | |
| 26 | public enum WixDependencySymbolFields |
| 27 | { |
| 28 | ProviderKey, |
| 29 | MinVersion, |
| 30 | MaxVersion, |
| 31 | Attributes, |
| 32 | } |
| 33 | |
| 34 | [Flags] |
| 35 | public enum WixDependencySymbolAttributes : int |
| 36 | { |
| 37 | None = 0x0, |
| 38 | RequiresAttributesMinVersionInclusive = 0x100, |
| 39 | RequiresAttributesMaxVersionInclusive = 0x200, |
| 40 | } |
| 41 | |
| 42 | public class WixDependencySymbol : IntermediateSymbol |
| 43 | { |
| 44 | public WixDependencySymbol() : base(SymbolDefinitions.WixDependency, null, null) |
| 45 | { |
| 46 | } |
| 47 | |
| 48 | public WixDependencySymbol(SourceLineNumber sourceLineNumber, Identifier id = null) : base(SymbolDefinitions.WixDependency, sourceLineNumber, id) |
| 49 | { |
| 50 | } |
| 51 | |
| 52 | public IntermediateField this[WixDependencySymbolFields index] => this.Fields[(int)index]; |
| 53 | |
| 54 | public string ProviderKey |
| 55 | { |
| 56 | get => this.Fields[(int)WixDependencySymbolFields.ProviderKey].AsString(); |
| 57 | set => this.Set((int)WixDependencySymbolFields.ProviderKey, value); |
| 58 | } |
| 59 | |
| 60 | public string MinVersion |
| 61 | { |
| 62 | get => this.Fields[(int)WixDependencySymbolFields.MinVersion].AsString(); |
| 63 | set => this.Set((int)WixDependencySymbolFields.MinVersion, value); |
| 64 | } |
| 65 | |
| 66 | public string MaxVersion |
| 67 | { |
| 68 | get => this.Fields[(int)WixDependencySymbolFields.MaxVersion].AsString(); |
| 69 | set => this.Set((int)WixDependencySymbolFields.MaxVersion, value); |
| 70 | } |
| 71 | |
| 72 | public WixDependencySymbolAttributes Attributes |
| 73 | { |
| 74 | get => (WixDependencySymbolAttributes)this.Fields[(int)WixDependencySymbolFields.Attributes].AsNumber(); |
| 75 | set => this.Set((int)WixDependencySymbolFields.Attributes, (int)value); |
| 76 | } |
| 77 | |
| 78 | public bool RequiresAttributesMinVersionInclusive => (this.Attributes & WixDependencySymbolAttributes.RequiresAttributesMinVersionInclusive) == WixDependencySymbolAttributes.RequiresAttributesMinVersionInclusive; |
| 79 | |
| 80 | public bool RequiresAttributesMaxVersionInclusive => (this.Attributes & WixDependencySymbolAttributes.RequiresAttributesMaxVersionInclusive) == WixDependencySymbolAttributes.RequiresAttributesMaxVersionInclusive; |
| 81 | } |
| 82 | } |