| 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.Data |
| 4 | { |
| 5 | using WixToolset.Data.Symbols; |
| 6 | |
| 7 | public static partial class SymbolDefinitions |
| 8 | { |
| 9 | public static readonly IntermediateSymbolDefinition WixBundlePackageExitCode = new IntermediateSymbolDefinition( |
| 10 | SymbolDefinitionType.WixBundlePackageExitCode, |
| 11 | new[] |
| 12 | { |
| 13 | new IntermediateFieldDefinition(nameof(WixBundlePackageExitCodeSymbolFields.ChainPackageId), IntermediateFieldType.String), |
| 14 | new IntermediateFieldDefinition(nameof(WixBundlePackageExitCodeSymbolFields.Code), IntermediateFieldType.Number), |
| 15 | new IntermediateFieldDefinition(nameof(WixBundlePackageExitCodeSymbolFields.Behavior), IntermediateFieldType.String), |
| 16 | }, |
| 17 | typeof(WixBundlePackageExitCodeSymbol)); |
| 18 | } |
| 19 | } |
| 20 | |
| 21 | namespace WixToolset.Data.Symbols |
| 22 | { |
| 23 | using System; |
| 24 | |
| 25 | public enum WixBundlePackageExitCodeSymbolFields |
| 26 | { |
| 27 | ChainPackageId, |
| 28 | Code, |
| 29 | Behavior, |
| 30 | } |
| 31 | |
| 32 | public enum ExitCodeBehaviorType |
| 33 | { |
| 34 | NotSet = -1, |
| 35 | Success = 1, |
| 36 | Error, |
| 37 | ScheduleReboot, |
| 38 | ForceReboot, |
| 39 | ErrorScheduleReboot, |
| 40 | ErrorForceReboot, |
| 41 | } |
| 42 | |
| 43 | public class WixBundlePackageExitCodeSymbol : IntermediateSymbol |
| 44 | { |
| 45 | public WixBundlePackageExitCodeSymbol() : base(SymbolDefinitions.WixBundlePackageExitCode, null, null) |
| 46 | { |
| 47 | } |
| 48 | |
| 49 | public WixBundlePackageExitCodeSymbol(SourceLineNumber sourceLineNumber, Identifier id = null) : base(SymbolDefinitions.WixBundlePackageExitCode, sourceLineNumber, id) |
| 50 | { |
| 51 | } |
| 52 | |
| 53 | public IntermediateField this[WixBundlePackageExitCodeSymbolFields index] => this.Fields[(int)index]; |
| 54 | |
| 55 | public string ChainPackageId |
| 56 | { |
| 57 | get => (string)this.Fields[(int)WixBundlePackageExitCodeSymbolFields.ChainPackageId]; |
| 58 | set => this.Set((int)WixBundlePackageExitCodeSymbolFields.ChainPackageId, value); |
| 59 | } |
| 60 | |
| 61 | public int? Code |
| 62 | { |
| 63 | get => (int?)this.Fields[(int)WixBundlePackageExitCodeSymbolFields.Code]; |
| 64 | set => this.Set((int)WixBundlePackageExitCodeSymbolFields.Code, value); |
| 65 | } |
| 66 | |
| 67 | public ExitCodeBehaviorType Behavior |
| 68 | { |
| 69 | get => Enum.TryParse((string)this.Fields[(int)WixBundlePackageExitCodeSymbolFields.Behavior], true, out ExitCodeBehaviorType value) ? value : ExitCodeBehaviorType.NotSet; |
| 70 | set => this.Set((int)WixBundlePackageExitCodeSymbolFields.Behavior, value.ToString()); |
| 71 | } |
| 72 | } |
| 73 | } |