aboutsummaryrefslogtreecommitdiff
path: root/src/WixToolset.Data/Tuples/PatchTuple.cs
blob: 5548a215638a693f3c992e67e095f9b46007e46f (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
// 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 Patch = new IntermediateTupleDefinition(
            TupleDefinitionType.Patch,
            new[]
            {
                new IntermediateFieldDefinition(nameof(PatchTupleFields.FileRef), IntermediateFieldType.String),
                new IntermediateFieldDefinition(nameof(PatchTupleFields.Sequence), IntermediateFieldType.Number),
                new IntermediateFieldDefinition(nameof(PatchTupleFields.PatchSize), IntermediateFieldType.Number),
                new IntermediateFieldDefinition(nameof(PatchTupleFields.Attributes), IntermediateFieldType.Number),
                new IntermediateFieldDefinition(nameof(PatchTupleFields.Header), IntermediateFieldType.Path),
                new IntermediateFieldDefinition(nameof(PatchTupleFields.StreamRef), IntermediateFieldType.String),
            },
            typeof(PatchTuple));
    }
}

namespace WixToolset.Data.Tuples
{
    public enum PatchTupleFields
    {
        FileRef,
        Sequence,
        PatchSize,
        Attributes,
        Header,
        StreamRef,
    }

    public class PatchTuple : IntermediateTuple
    {
        public PatchTuple() : base(TupleDefinitions.Patch, null, null)
        {
        }

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

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

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

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

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

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

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

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