summaryrefslogtreecommitdiff
path: root/src/ext/Util/wixext/Symbols/ServiceConfigSymbol.cs
blob: 3a877f9b936e7c802658c44c7dc9af10e6c25c9a (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
// 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.Util
{
    using WixToolset.Data;
    using WixToolset.Util.Symbols;

    public static partial class UtilSymbolDefinitions
    {
        public static readonly IntermediateSymbolDefinition ServiceConfig = new IntermediateSymbolDefinition(
            UtilSymbolDefinitionType.ServiceConfig.ToString(),
            new[]
            {
                new IntermediateFieldDefinition(nameof(ServiceConfigSymbolFields.ServiceName), IntermediateFieldType.String),
                new IntermediateFieldDefinition(nameof(ServiceConfigSymbolFields.ComponentRef), IntermediateFieldType.String),
                new IntermediateFieldDefinition(nameof(ServiceConfigSymbolFields.NewService), IntermediateFieldType.Number),
                new IntermediateFieldDefinition(nameof(ServiceConfigSymbolFields.FirstFailureActionType), IntermediateFieldType.String),
                new IntermediateFieldDefinition(nameof(ServiceConfigSymbolFields.SecondFailureActionType), IntermediateFieldType.String),
                new IntermediateFieldDefinition(nameof(ServiceConfigSymbolFields.ThirdFailureActionType), IntermediateFieldType.String),
                new IntermediateFieldDefinition(nameof(ServiceConfigSymbolFields.ResetPeriodInDays), IntermediateFieldType.Number),
                new IntermediateFieldDefinition(nameof(ServiceConfigSymbolFields.RestartServiceDelayInSeconds), IntermediateFieldType.Number),
                new IntermediateFieldDefinition(nameof(ServiceConfigSymbolFields.ProgramCommandLine), IntermediateFieldType.String),
                new IntermediateFieldDefinition(nameof(ServiceConfigSymbolFields.RebootMessage), IntermediateFieldType.String),
            },
            typeof(ServiceConfigSymbol));
    }
}

namespace WixToolset.Util.Symbols
{
    using WixToolset.Data;

    public enum ServiceConfigSymbolFields
    {
        ServiceName,
        ComponentRef,
        NewService,
        FirstFailureActionType,
        SecondFailureActionType,
        ThirdFailureActionType,
        ResetPeriodInDays,
        RestartServiceDelayInSeconds,
        ProgramCommandLine,
        RebootMessage,
    }

    public class ServiceConfigSymbol : IntermediateSymbol
    {
        public ServiceConfigSymbol() : base(UtilSymbolDefinitions.ServiceConfig, null, null)
        {
        }

        public ServiceConfigSymbol(SourceLineNumber sourceLineNumber, Identifier id = null) : base(UtilSymbolDefinitions.ServiceConfig, sourceLineNumber, id)
        {
        }

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

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

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

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

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

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

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

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

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

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

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