| 1 | // 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. |
| 2 | |
| 3 | namespace WixToolset.Util |
| 4 | { |
| 5 | using WixToolset.Data; |
| 6 | using WixToolset.Util.Symbols; |
| 7 | |
| 8 | public static partial class UtilSymbolDefinitions |
| 9 | { |
| 10 | public static readonly IntermediateSymbolDefinition ServiceConfig = new IntermediateSymbolDefinition( |
| 11 | UtilSymbolDefinitionType.ServiceConfig.ToString(), |
| 12 | new[] |
| 13 | { |
| 14 | new IntermediateFieldDefinition(nameof(ServiceConfigSymbolFields.ServiceName), IntermediateFieldType.String), |
| 15 | new IntermediateFieldDefinition(nameof(ServiceConfigSymbolFields.ComponentRef), IntermediateFieldType.String), |
| 16 | new IntermediateFieldDefinition(nameof(ServiceConfigSymbolFields.NewService), IntermediateFieldType.Number), |
| 17 | new IntermediateFieldDefinition(nameof(ServiceConfigSymbolFields.FirstFailureActionType), IntermediateFieldType.String), |
| 18 | new IntermediateFieldDefinition(nameof(ServiceConfigSymbolFields.SecondFailureActionType), IntermediateFieldType.String), |
| 19 | new IntermediateFieldDefinition(nameof(ServiceConfigSymbolFields.ThirdFailureActionType), IntermediateFieldType.String), |
| 20 | new IntermediateFieldDefinition(nameof(ServiceConfigSymbolFields.ResetPeriodInDays), IntermediateFieldType.Number), |
| 21 | new IntermediateFieldDefinition(nameof(ServiceConfigSymbolFields.RestartServiceDelayInSeconds), IntermediateFieldType.Number), |
| 22 | new IntermediateFieldDefinition(nameof(ServiceConfigSymbolFields.ProgramCommandLine), IntermediateFieldType.String), |
| 23 | new IntermediateFieldDefinition(nameof(ServiceConfigSymbolFields.RebootMessage), IntermediateFieldType.String), |
| 24 | }, |
| 25 | typeof(ServiceConfigSymbol)); |
| 26 | } |
| 27 | } |
| 28 | |
| 29 | namespace WixToolset.Util.Symbols |
| 30 | { |
| 31 | using WixToolset.Data; |
| 32 | |
| 33 | public enum ServiceConfigSymbolFields |
| 34 | { |
| 35 | ServiceName, |
| 36 | ComponentRef, |
| 37 | NewService, |
| 38 | FirstFailureActionType, |
| 39 | SecondFailureActionType, |
| 40 | ThirdFailureActionType, |
| 41 | ResetPeriodInDays, |
| 42 | RestartServiceDelayInSeconds, |
| 43 | ProgramCommandLine, |
| 44 | RebootMessage, |
| 45 | } |
| 46 | |
| 47 | public class ServiceConfigSymbol : IntermediateSymbol |
| 48 | { |
| 49 | public ServiceConfigSymbol() : base(UtilSymbolDefinitions.ServiceConfig, null, null) |
| 50 | { |
| 51 | } |
| 52 | |
| 53 | public ServiceConfigSymbol(SourceLineNumber sourceLineNumber, Identifier id = null) : base(UtilSymbolDefinitions.ServiceConfig, sourceLineNumber, id) |
| 54 | { |
| 55 | } |
| 56 | |
| 57 | public IntermediateField this[ServiceConfigSymbolFields index] => this.Fields[(int)index]; |
| 58 | |
| 59 | public string ServiceName |
| 60 | { |
| 61 | get => this.Fields[(int)ServiceConfigSymbolFields.ServiceName].AsString(); |
| 62 | set => this.Set((int)ServiceConfigSymbolFields.ServiceName, value); |
| 63 | } |
| 64 | |
| 65 | public string ComponentRef |
| 66 | { |
| 67 | get => this.Fields[(int)ServiceConfigSymbolFields.ComponentRef].AsString(); |
| 68 | set => this.Set((int)ServiceConfigSymbolFields.ComponentRef, value); |
| 69 | } |
| 70 | |
| 71 | public int NewService |
| 72 | { |
| 73 | get => this.Fields[(int)ServiceConfigSymbolFields.NewService].AsNumber(); |
| 74 | set => this.Set((int)ServiceConfigSymbolFields.NewService, value); |
| 75 | } |
| 76 | |
| 77 | public string FirstFailureActionType |
| 78 | { |
| 79 | get => this.Fields[(int)ServiceConfigSymbolFields.FirstFailureActionType].AsString(); |
| 80 | set => this.Set((int)ServiceConfigSymbolFields.FirstFailureActionType, value); |
| 81 | } |
| 82 | |
| 83 | public string SecondFailureActionType |
| 84 | { |
| 85 | get => this.Fields[(int)ServiceConfigSymbolFields.SecondFailureActionType].AsString(); |
| 86 | set => this.Set((int)ServiceConfigSymbolFields.SecondFailureActionType, value); |
| 87 | } |
| 88 | |
| 89 | public string ThirdFailureActionType |
| 90 | { |
| 91 | get => this.Fields[(int)ServiceConfigSymbolFields.ThirdFailureActionType].AsString(); |
| 92 | set => this.Set((int)ServiceConfigSymbolFields.ThirdFailureActionType, value); |
| 93 | } |
| 94 | |
| 95 | public int? ResetPeriodInDays |
| 96 | { |
| 97 | get => this.Fields[(int)ServiceConfigSymbolFields.ResetPeriodInDays].AsNullableNumber(); |
| 98 | set => this.Set((int)ServiceConfigSymbolFields.ResetPeriodInDays, value); |
| 99 | } |
| 100 | |
| 101 | public int? RestartServiceDelayInSeconds |
| 102 | { |
| 103 | get => this.Fields[(int)ServiceConfigSymbolFields.RestartServiceDelayInSeconds].AsNullableNumber(); |
| 104 | set => this.Set((int)ServiceConfigSymbolFields.RestartServiceDelayInSeconds, value); |
| 105 | } |
| 106 | |
| 107 | public string ProgramCommandLine |
| 108 | { |
| 109 | get => this.Fields[(int)ServiceConfigSymbolFields.ProgramCommandLine].AsString(); |
| 110 | set => this.Set((int)ServiceConfigSymbolFields.ProgramCommandLine, value); |
| 111 | } |
| 112 | |
| 113 | public string RebootMessage |
| 114 | { |
| 115 | get => this.Fields[(int)ServiceConfigSymbolFields.RebootMessage].AsString(); |
| 116 | set => this.Set((int)ServiceConfigSymbolFields.RebootMessage, value); |
| 117 | } |
| 118 | } |
| 119 | } |