aboutsummaryrefslogtreecommitdiff
path: root/src/WixToolset.Data/Tuples/WixDependencyProviderTuple.cs
blob: 1953594e7e3c8e6e1f67f3e515948a5a64a2e2c0 (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
// 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 WixDependencyProvider = new IntermediateTupleDefinition(
            TupleDefinitionType.WixDependencyProvider.ToString(),
            new[]
            {
                new IntermediateFieldDefinition(nameof(WixDependencyProviderTupleFields.ComponentRef), IntermediateFieldType.String),
                new IntermediateFieldDefinition(nameof(WixDependencyProviderTupleFields.ProviderKey), IntermediateFieldType.String),
                new IntermediateFieldDefinition(nameof(WixDependencyProviderTupleFields.Version), IntermediateFieldType.String),
                new IntermediateFieldDefinition(nameof(WixDependencyProviderTupleFields.DisplayName), IntermediateFieldType.String),
                new IntermediateFieldDefinition(nameof(WixDependencyProviderTupleFields.Attributes), IntermediateFieldType.Number),
            },
            typeof(WixDependencyProviderTuple));
    }
}

namespace WixToolset.Data.Tuples
{
    using System;
    using WixToolset.Data;

    public enum WixDependencyProviderTupleFields
    {
        ComponentRef,
        ProviderKey,
        Version,
        DisplayName,
        Attributes,
    }

    [Flags]
    public enum WixDependencyProviderAttributes
    {
        ProvidesAttributesBundle = 0x10000
    }

    public class WixDependencyProviderTuple : IntermediateTuple
    {
        public WixDependencyProviderTuple() : base(TupleDefinitions.WixDependencyProvider, null, null)
        {
        }

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

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

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

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

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

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

        public WixDependencyProviderAttributes Attributes
        {
            get => (WixDependencyProviderAttributes)(int)this.Fields[(int)WixDependencyProviderTupleFields.Attributes];
            set => this.Set((int)WixDependencyProviderTupleFields.Attributes, (int)value);
        }

        public bool Bundle => (this.Attributes & WixDependencyProviderAttributes.ProvidesAttributesBundle) == WixDependencyProviderAttributes.ProvidesAttributesBundle;
    }
}