aboutsummaryrefslogtreecommitdiff
path: root/src/WixToolset.Data/Tuples/CustomActionTuple.cs
blob: b2b34df0622d966f0d43fb8f0a66f73fb62f4450 (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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
// 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 CustomAction = new IntermediateTupleDefinition(
            TupleDefinitionType.CustomAction,
            new[]
            {
                new IntermediateFieldDefinition(nameof(CustomActionTupleFields.ExecutionType), IntermediateFieldType.Number),
                new IntermediateFieldDefinition(nameof(CustomActionTupleFields.Source), IntermediateFieldType.String),
                new IntermediateFieldDefinition(nameof(CustomActionTupleFields.SourceType), IntermediateFieldType.Number),
                new IntermediateFieldDefinition(nameof(CustomActionTupleFields.Target), IntermediateFieldType.String),
                new IntermediateFieldDefinition(nameof(CustomActionTupleFields.TargetType), IntermediateFieldType.Number),
                new IntermediateFieldDefinition(nameof(CustomActionTupleFields.Async), IntermediateFieldType.Bool),
                new IntermediateFieldDefinition(nameof(CustomActionTupleFields.Hidden), IntermediateFieldType.Bool),
                new IntermediateFieldDefinition(nameof(CustomActionTupleFields.IgnoreResult), IntermediateFieldType.Bool),
                new IntermediateFieldDefinition(nameof(CustomActionTupleFields.Impersonate), IntermediateFieldType.Bool),
                new IntermediateFieldDefinition(nameof(CustomActionTupleFields.PatchUninstall), IntermediateFieldType.Bool),
                new IntermediateFieldDefinition(nameof(CustomActionTupleFields.TSAware), IntermediateFieldType.Bool),
                new IntermediateFieldDefinition(nameof(CustomActionTupleFields.Win64), IntermediateFieldType.Bool),
                new IntermediateFieldDefinition(nameof(CustomActionTupleFields.ScriptFile), IntermediateFieldType.Path),
            },
            typeof(CustomActionTuple));
    }
}

namespace WixToolset.Data.Tuples
{
    public enum CustomActionTupleFields
    {
        ExecutionType,
        Source,
        SourceType,
        Target,
        TargetType,
        Async,
        Hidden,
        IgnoreResult,
        Impersonate,
        PatchUninstall,
        TSAware,
        Win64,
        ScriptFile
    }

    public enum CustomActionExecutionType
    {
        Immediate,
        FirstSequence = 256,
        OncePerProcess = 512,
        ClientRepeat = 768,
        Deferred = 1024,
        Rollback = 1280,
        Commit = 1536,
    }

    public enum CustomActionSourceType
    {
        Binary,
        File = 0x10,
        Directory = 0x20,
        Property = 0x30,
    }

    public enum CustomActionTargetType
    {
        Dll = 1,
        Exe = 2,
        TextData = 3,
        JScript = 5,
        VBScript = 6,
    }

    public class CustomActionTuple : IntermediateTuple
    {
        public CustomActionTuple() : base(TupleDefinitions.CustomAction, null, null)
        {
        }

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

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

        public CustomActionExecutionType ExecutionType
        {
            get => (CustomActionExecutionType)this.Fields[(int)CustomActionTupleFields.ExecutionType].AsNumber();
            set => this.Set((int)CustomActionTupleFields.ExecutionType, (int)value);
        }

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

        public CustomActionSourceType SourceType
        {
            get => (CustomActionSourceType)this.Fields[(int)CustomActionTupleFields.SourceType].AsNumber();
            set => this.Set((int)CustomActionTupleFields.SourceType, (int)value);
        }

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

        public CustomActionTargetType TargetType
        {
            get => (CustomActionTargetType)this.Fields[(int)CustomActionTupleFields.TargetType].AsNumber();
            set => this.Set((int)CustomActionTupleFields.TargetType, (int)value);
        }

        public bool Async
        {
            get => this.Fields[(int)CustomActionTupleFields.Async].AsBool();
            set => this.Set((int)CustomActionTupleFields.Async, value);
        }

        public bool Hidden
        {
            get => this.Fields[(int)CustomActionTupleFields.Hidden].AsBool();
            set => this.Set((int)CustomActionTupleFields.Hidden, value);
        }

        public bool IgnoreResult
        {
            get => this.Fields[(int)CustomActionTupleFields.IgnoreResult].AsBool();
            set => this.Set((int)CustomActionTupleFields.IgnoreResult, value);
        }

        public bool Impersonate
        {
            get => this.Fields[(int)CustomActionTupleFields.Impersonate].AsBool();
            set => this.Set((int)CustomActionTupleFields.Impersonate, value);
        }

        public bool PatchUninstall
        {
            get => this.Fields[(int)CustomActionTupleFields.PatchUninstall].AsBool();
            set => this.Set((int)CustomActionTupleFields.PatchUninstall, value);
        }

        public bool TSAware
        {
            get => this.Fields[(int)CustomActionTupleFields.TSAware].AsBool();
            set => this.Set((int)CustomActionTupleFields.TSAware, value);
        }

        public bool Win64
        {
            get => this.Fields[(int)CustomActionTupleFields.Win64].AsBool();
            set => this.Set((int)CustomActionTupleFields.Win64, value);
        }

        public IntermediateFieldPathValue ScriptFile
        {
            get => this.Fields[(int)CustomActionTupleFields.ScriptFile].AsPath();
            set => this.Set((int)CustomActionTupleFields.ScriptFile, value);
        }
    }
}