| 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 IniFile = new IntermediateSymbolDefinition( |
| 10 | SymbolDefinitionType.IniFile, |
| 11 | new[] |
| 12 | { |
| 13 | new IntermediateFieldDefinition(nameof(IniFileSymbolFields.FileName), IntermediateFieldType.String), |
| 14 | new IntermediateFieldDefinition(nameof(IniFileSymbolFields.ShortFileName), IntermediateFieldType.String), |
| 15 | new IntermediateFieldDefinition(nameof(IniFileSymbolFields.DirProperty), IntermediateFieldType.String), |
| 16 | new IntermediateFieldDefinition(nameof(IniFileSymbolFields.Section), IntermediateFieldType.String), |
| 17 | new IntermediateFieldDefinition(nameof(IniFileSymbolFields.Key), IntermediateFieldType.String), |
| 18 | new IntermediateFieldDefinition(nameof(IniFileSymbolFields.Value), IntermediateFieldType.String), |
| 19 | new IntermediateFieldDefinition(nameof(IniFileSymbolFields.Action), IntermediateFieldType.Number), |
| 20 | new IntermediateFieldDefinition(nameof(IniFileSymbolFields.ComponentRef), IntermediateFieldType.String), |
| 21 | }, |
| 22 | typeof(IniFileSymbol)); |
| 23 | } |
| 24 | } |
| 25 | |
| 26 | namespace WixToolset.Data.Symbols |
| 27 | { |
| 28 | public enum IniFileSymbolFields |
| 29 | { |
| 30 | FileName, |
| 31 | ShortFileName, |
| 32 | DirProperty, |
| 33 | Section, |
| 34 | Key, |
| 35 | Value, |
| 36 | Action, |
| 37 | ComponentRef, |
| 38 | } |
| 39 | |
| 40 | public class IniFileSymbol : IntermediateSymbol |
| 41 | { |
| 42 | public IniFileSymbol() : base(SymbolDefinitions.IniFile, null, null) |
| 43 | { |
| 44 | } |
| 45 | |
| 46 | public IniFileSymbol(SourceLineNumber sourceLineNumber, Identifier id = null) : base(SymbolDefinitions.IniFile, sourceLineNumber, id) |
| 47 | { |
| 48 | } |
| 49 | |
| 50 | public IntermediateField this[IniFileSymbolFields index] => this.Fields[(int)index]; |
| 51 | |
| 52 | public string FileName |
| 53 | { |
| 54 | get => (string)this.Fields[(int)IniFileSymbolFields.FileName]; |
| 55 | set => this.Set((int)IniFileSymbolFields.FileName, value); |
| 56 | } |
| 57 | |
| 58 | public string ShortFileName |
| 59 | { |
| 60 | get => (string)this.Fields[(int)IniFileSymbolFields.ShortFileName]; |
| 61 | set => this.Set((int)IniFileSymbolFields.ShortFileName, value); |
| 62 | } |
| 63 | |
| 64 | public string DirProperty |
| 65 | { |
| 66 | get => (string)this.Fields[(int)IniFileSymbolFields.DirProperty]; |
| 67 | set => this.Set((int)IniFileSymbolFields.DirProperty, value); |
| 68 | } |
| 69 | |
| 70 | public string Section |
| 71 | { |
| 72 | get => (string)this.Fields[(int)IniFileSymbolFields.Section]; |
| 73 | set => this.Set((int)IniFileSymbolFields.Section, value); |
| 74 | } |
| 75 | |
| 76 | public string Key |
| 77 | { |
| 78 | get => (string)this.Fields[(int)IniFileSymbolFields.Key]; |
| 79 | set => this.Set((int)IniFileSymbolFields.Key, value); |
| 80 | } |
| 81 | |
| 82 | public string Value |
| 83 | { |
| 84 | get => (string)this.Fields[(int)IniFileSymbolFields.Value]; |
| 85 | set => this.Set((int)IniFileSymbolFields.Value, value); |
| 86 | } |
| 87 | |
| 88 | public IniFileActionType Action |
| 89 | { |
| 90 | get => (IniFileActionType)this.Fields[(int)IniFileSymbolFields.Action]?.AsNumber(); |
| 91 | set => this.Set((int)IniFileSymbolFields.Action, (int)value); |
| 92 | } |
| 93 | |
| 94 | public string ComponentRef |
| 95 | { |
| 96 | get => (string)this.Fields[(int)IniFileSymbolFields.ComponentRef]; |
| 97 | set => this.Set((int)IniFileSymbolFields.ComponentRef, value); |
| 98 | } |
| 99 | } |
| 100 | } |