| 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 WixRestartResource = new IntermediateSymbolDefinition( |
| 11 | UtilSymbolDefinitionType.WixRestartResource.ToString(), |
| 12 | new[] |
| 13 | { |
| 14 | new IntermediateFieldDefinition(nameof(WixRestartResourceSymbolFields.ComponentRef), IntermediateFieldType.String), |
| 15 | new IntermediateFieldDefinition(nameof(WixRestartResourceSymbolFields.Resource), IntermediateFieldType.String), |
| 16 | new IntermediateFieldDefinition(nameof(WixRestartResourceSymbolFields.Attributes), IntermediateFieldType.Number), |
| 17 | }, |
| 18 | typeof(WixRestartResourceSymbol)); |
| 19 | } |
| 20 | } |
| 21 | |
| 22 | namespace WixToolset.Util.Symbols |
| 23 | { |
| 24 | using WixToolset.Data; |
| 25 | |
| 26 | public enum WixRestartResourceSymbolFields |
| 27 | { |
| 28 | ComponentRef, |
| 29 | Resource, |
| 30 | Attributes, |
| 31 | } |
| 32 | |
| 33 | public enum WixRestartResourceAttributes |
| 34 | { |
| 35 | Filename = 1, |
| 36 | ProcessName, |
| 37 | ServiceName, |
| 38 | TypeMask = 0xf, |
| 39 | } |
| 40 | |
| 41 | public class WixRestartResourceSymbol : IntermediateSymbol |
| 42 | { |
| 43 | public WixRestartResourceSymbol() : base(UtilSymbolDefinitions.WixRestartResource, null, null) |
| 44 | { |
| 45 | } |
| 46 | |
| 47 | public WixRestartResourceSymbol(SourceLineNumber sourceLineNumber, Identifier id = null) : base(UtilSymbolDefinitions.WixRestartResource, sourceLineNumber, id) |
| 48 | { |
| 49 | } |
| 50 | |
| 51 | public IntermediateField this[WixRestartResourceSymbolFields index] => this.Fields[(int)index]; |
| 52 | |
| 53 | public string ComponentRef |
| 54 | { |
| 55 | get => this.Fields[(int)WixRestartResourceSymbolFields.ComponentRef].AsString(); |
| 56 | set => this.Set((int)WixRestartResourceSymbolFields.ComponentRef, value); |
| 57 | } |
| 58 | |
| 59 | public string Resource |
| 60 | { |
| 61 | get => this.Fields[(int)WixRestartResourceSymbolFields.Resource].AsString(); |
| 62 | set => this.Set((int)WixRestartResourceSymbolFields.Resource, value); |
| 63 | } |
| 64 | |
| 65 | public WixRestartResourceAttributes? Attributes |
| 66 | { |
| 67 | get => (WixRestartResourceAttributes?)this.Fields[(int)WixRestartResourceSymbolFields.Attributes].AsNullableNumber(); |
| 68 | set => this.Set((int)WixRestartResourceSymbolFields.Attributes, (int?)value); |
| 69 | } |
| 70 | } |
| 71 | } |