aboutsummaryrefslogtreecommitdiff
path: root/src/WixToolset.Data/Tuples/WixBundleContainerTuple.cs
blob: ed12a804a7267d4fcedeb9ce25c0a5c966db4148 (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
101
102
103
// 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 WixBundleContainer = new IntermediateTupleDefinition(
            TupleDefinitionType.WixBundleContainer,
            new[]
            {
                new IntermediateFieldDefinition(nameof(WixBundleContainerTupleFields.Name), IntermediateFieldType.String),
                new IntermediateFieldDefinition(nameof(WixBundleContainerTupleFields.Type), IntermediateFieldType.Number),
                new IntermediateFieldDefinition(nameof(WixBundleContainerTupleFields.DownloadUrl), IntermediateFieldType.String),
                new IntermediateFieldDefinition(nameof(WixBundleContainerTupleFields.Size), IntermediateFieldType.LargeNumber),
                new IntermediateFieldDefinition(nameof(WixBundleContainerTupleFields.Hash), IntermediateFieldType.String),
                new IntermediateFieldDefinition(nameof(WixBundleContainerTupleFields.AttachedContainerIndex), IntermediateFieldType.Number),
                new IntermediateFieldDefinition(nameof(WixBundleContainerTupleFields.WorkingPath), IntermediateFieldType.String),
            },
            typeof(WixBundleContainerTuple));
    }
}

namespace WixToolset.Data.Tuples
{
    using System;

    public enum WixBundleContainerTupleFields
    {
        Name,
        Type,
        DownloadUrl,
        Size,
        Hash,
        AttachedContainerIndex,
        WorkingPath,
    }

    /// <summary>
    /// Types of bundle packages.
    /// </summary>
    public enum ContainerType
    {
        Attached,
        Detached,
    }

    public class WixBundleContainerTuple : IntermediateTuple
    {
        public WixBundleContainerTuple() : base(TupleDefinitions.WixBundleContainer, null, null)
        {
        }

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

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

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

        public ContainerType Type
        {
            get => (ContainerType)this.Fields[(int)WixBundleContainerTupleFields.Type].AsNumber();
            set => this.Set((int)WixBundleContainerTupleFields.Type, (int)value);
        }

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

        public long Size
        {
            get => (long)this.Fields[(int)WixBundleContainerTupleFields.Size];
            set => this.Set((int)WixBundleContainerTupleFields.Size, value);
        }

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

        public int AttachedContainerIndex
        {
            get => (int)this.Fields[(int)WixBundleContainerTupleFields.AttachedContainerIndex];
            set => this.Set((int)WixBundleContainerTupleFields.AttachedContainerIndex, value);
        }

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