aboutsummaryrefslogtreecommitdiff
path: root/src/api/wix/WixToolset.Data/Symbols/IniFileSymbol.cs
blob: 051acdbb47e45d47fa21128c7c78ad90c4c6bfb4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
// 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.

namespace WixToolset.Data
{
    using WixToolset.Data.Symbols;

    public static partial class SymbolDefinitions
    {
        public static readonly IntermediateSymbolDefinition IniFile = new IntermediateSymbolDefinition(
            SymbolDefinitionType.IniFile,
            new[]
            {
                new IntermediateFieldDefinition(nameof(IniFileSymbolFields.FileName), IntermediateFieldType.String),
                new IntermediateFieldDefinition(nameof(IniFileSymbolFields.ShortFileName), IntermediateFieldType.String),
                new IntermediateFieldDefinition(nameof(IniFileSymbolFields.DirProperty), IntermediateFieldType.String),
                new IntermediateFieldDefinition(nameof(IniFileSymbolFields.Section), IntermediateFieldType.String),
                new IntermediateFieldDefinition(nameof(IniFileSymbolFields.Key), IntermediateFieldType.String),
                new IntermediateFieldDefinition(nameof(IniFileSymbolFields.Value), IntermediateFieldType.String),
                new IntermediateFieldDefinition(nameof(IniFileSymbolFields.Action), IntermediateFieldType.Number),
                new IntermediateFieldDefinition(nameof(IniFileSymbolFields.ComponentRef), IntermediateFieldType.String),
            },
            typeof(IniFileSymbol));
    }
}

namespace WixToolset.Data.Symbols
{
    public enum IniFileSymbolFields
    {
        FileName,
        ShortFileName,
        DirProperty,
        Section,
        Key,
        Value,
        Action,
        ComponentRef,
    }

    public class IniFileSymbol : IntermediateSymbol
    {
        public IniFileSymbol() : base(SymbolDefinitions.IniFile, null, null)
        {
        }

        public IniFileSymbol(SourceLineNumber sourceLineNumber, Identifier id = null) : base(SymbolDefinitions.IniFile, sourceLineNumber, id)
        {
        }

        public IntermediateField this[IniFileSymbolFields index] => this.Fields[(int)index];

        public string FileName
        {
            get => (string)this.Fields[(int)IniFileSymbolFields.FileName];
            set => this.Set((int)IniFileSymbolFields.FileName, value);
        }

        public string ShortFileName
        {
            get => (string)this.Fields[(int)IniFileSymbolFields.ShortFileName];
            set => this.Set((int)IniFileSymbolFields.ShortFileName, value);
        }

        public string DirProperty
        {
            get => (string)this.Fields[(int)IniFileSymbolFields.DirProperty];
            set => this.Set((int)IniFileSymbolFields.DirProperty, value);
        }

        public string Section
        {
            get => (string)this.Fields[(int)IniFileSymbolFields.Section];
            set => this.Set((int)IniFileSymbolFields.Section, value);
        }

        public string Key
        {
            get => (string)this.Fields[(int)IniFileSymbolFields.Key];
            set => this.Set((int)IniFileSymbolFields.Key, value);
        }

        public string Value
        {
            get => (string)this.Fields[(int)IniFileSymbolFields.Value];
            set => this.Set((int)IniFileSymbolFields.Value, value);
        }

        public IniFileActionType Action
        {
            get => (IniFileActionType)this.Fields[(int)IniFileSymbolFields.Action]?.AsNumber();
            set => this.Set((int)IniFileSymbolFields.Action, (int)value);
        }

        public string ComponentRef
        {
            get => (string)this.Fields[(int)IniFileSymbolFields.ComponentRef];
            set => this.Set((int)IniFileSymbolFields.ComponentRef, value);
        }
    }
}