aboutsummaryrefslogtreecommitdiff
path: root/src/WixToolset.Data/Tuples/WixBundlePackageExitCodeTuple.cs
blob: c585011dc28cc52c5d0bd83c1ae29c6670956b32 (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
// 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 WixBundlePackageExitCode = new IntermediateTupleDefinition(
            TupleDefinitionType.WixBundlePackageExitCode,
            new[]
            {
                new IntermediateFieldDefinition(nameof(WixBundlePackageExitCodeTupleFields.ChainPackageId), IntermediateFieldType.String),
                new IntermediateFieldDefinition(nameof(WixBundlePackageExitCodeTupleFields.Code), IntermediateFieldType.Number),
                new IntermediateFieldDefinition(nameof(WixBundlePackageExitCodeTupleFields.Behavior), IntermediateFieldType.String),
            },
            typeof(WixBundlePackageExitCodeTuple));
    }
}

namespace WixToolset.Data.Tuples
{
    using System;

    public enum WixBundlePackageExitCodeTupleFields
    {
        ChainPackageId,
        Code,
        Behavior,
    }

    public enum ExitCodeBehaviorType
    {
        NotSet = -1,
        Success,
        Error,
        ScheduleReboot,
        ForceReboot,
    }

    public class WixBundlePackageExitCodeTuple : IntermediateTuple
    {
        public WixBundlePackageExitCodeTuple() : base(TupleDefinitions.WixBundlePackageExitCode, null, null)
        {
        }

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

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

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

        public int? Code
        {
            get => (int?)this.Fields[(int)WixBundlePackageExitCodeTupleFields.Code];
            set => this.Set((int)WixBundlePackageExitCodeTupleFields.Code, value);
        }

        public ExitCodeBehaviorType Behavior
        {
            get => Enum.TryParse((string)this.Fields[(int)WixBundlePackageExitCodeTupleFields.Behavior], true, out ExitCodeBehaviorType value) ? value : ExitCodeBehaviorType.NotSet;
            set => this.Set((int)WixBundlePackageExitCodeTupleFields.Behavior, value.ToString());
        }
    }
}