aboutsummaryrefslogtreecommitdiff
path: root/src/WixToolset.Data/Tuples/WixGroupTuple.cs
blob: be6bf7a434c249dab6624e9bfac47080ac5b2769 (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
// 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.Tuples;

    public static partial class TupleDefinitions
    {
        public static readonly IntermediateTupleDefinition WixGroup = new IntermediateTupleDefinition(
            TupleDefinitionType.WixGroup,
            new[]
            {
                new IntermediateFieldDefinition(nameof(WixGroupTupleFields.ParentId), IntermediateFieldType.String),
                new IntermediateFieldDefinition(nameof(WixGroupTupleFields.ParentType), IntermediateFieldType.String),
                new IntermediateFieldDefinition(nameof(WixGroupTupleFields.ChildId), IntermediateFieldType.String),
                new IntermediateFieldDefinition(nameof(WixGroupTupleFields.ChildType), IntermediateFieldType.String),
            },
            typeof(WixGroupTuple));
    }
}

namespace WixToolset.Data.Tuples
{
    using System;

    public enum WixGroupTupleFields
    {
        ParentId,
        ParentType,
        ChildId,
        ChildType,
    }

    public class WixGroupTuple : IntermediateTuple
    {
        public WixGroupTuple() : base(TupleDefinitions.WixGroup, null, null)
        {
        }

        public WixGroupTuple(SourceLineNumber sourceLineNumber, Identifier id = null) : base(TupleDefinitions.WixGroup, sourceLineNumber, id)
        {
        }

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

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

        public ComplexReferenceParentType ParentType
        {
            get => (ComplexReferenceParentType)Enum.Parse(typeof(ComplexReferenceParentType), (string)this.Fields[(int)WixGroupTupleFields.ParentType]?.Value, true);
            set => this.Set((int)WixGroupTupleFields.ParentType, value.ToString());
        }

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

        public ComplexReferenceChildType ChildType
        {
            get => (ComplexReferenceChildType)Enum.Parse(typeof(ComplexReferenceChildType), (string)this.Fields[(int)WixGroupTupleFields.ChildType]?.Value, true);
            set => this.Set((int)WixGroupTupleFields.ChildType, value.ToString());
        }
    }
}