| 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 CustomAction = new IntermediateSymbolDefinition( |
| 10 | SymbolDefinitionType.CustomAction, |
| 11 | new[] |
| 12 | { |
| 13 | new IntermediateFieldDefinition(nameof(CustomActionSymbolFields.ExecutionType), IntermediateFieldType.Number), |
| 14 | new IntermediateFieldDefinition(nameof(CustomActionSymbolFields.Source), IntermediateFieldType.String), |
| 15 | new IntermediateFieldDefinition(nameof(CustomActionSymbolFields.SourceType), IntermediateFieldType.Number), |
| 16 | new IntermediateFieldDefinition(nameof(CustomActionSymbolFields.Target), IntermediateFieldType.String), |
| 17 | new IntermediateFieldDefinition(nameof(CustomActionSymbolFields.TargetType), IntermediateFieldType.Number), |
| 18 | new IntermediateFieldDefinition(nameof(CustomActionSymbolFields.Async), IntermediateFieldType.Bool), |
| 19 | new IntermediateFieldDefinition(nameof(CustomActionSymbolFields.Hidden), IntermediateFieldType.Bool), |
| 20 | new IntermediateFieldDefinition(nameof(CustomActionSymbolFields.IgnoreResult), IntermediateFieldType.Bool), |
| 21 | new IntermediateFieldDefinition(nameof(CustomActionSymbolFields.Impersonate), IntermediateFieldType.Bool), |
| 22 | new IntermediateFieldDefinition(nameof(CustomActionSymbolFields.PatchUninstall), IntermediateFieldType.Bool), |
| 23 | new IntermediateFieldDefinition(nameof(CustomActionSymbolFields.TSAware), IntermediateFieldType.Bool), |
| 24 | new IntermediateFieldDefinition(nameof(CustomActionSymbolFields.Win64), IntermediateFieldType.Bool), |
| 25 | new IntermediateFieldDefinition(nameof(CustomActionSymbolFields.ScriptFile), IntermediateFieldType.Path), |
| 26 | }, |
| 27 | typeof(CustomActionSymbol)); |
| 28 | } |
| 29 | } |
| 30 | |
| 31 | namespace WixToolset.Data.Symbols |
| 32 | { |
| 33 | public enum CustomActionSymbolFields |
| 34 | { |
| 35 | ExecutionType, |
| 36 | Source, |
| 37 | SourceType, |
| 38 | Target, |
| 39 | TargetType, |
| 40 | Async, |
| 41 | Hidden, |
| 42 | IgnoreResult, |
| 43 | Impersonate, |
| 44 | PatchUninstall, |
| 45 | TSAware, |
| 46 | Win64, |
| 47 | ScriptFile |
| 48 | } |
| 49 | |
| 50 | public enum CustomActionExecutionType |
| 51 | { |
| 52 | Immediate, |
| 53 | FirstSequence = 256, |
| 54 | OncePerProcess = 512, |
| 55 | ClientRepeat = 768, |
| 56 | Deferred = 1024, |
| 57 | Rollback = 1280, |
| 58 | Commit = 1536, |
| 59 | } |
| 60 | |
| 61 | public enum CustomActionSourceType |
| 62 | { |
| 63 | Binary, |
| 64 | File = 0x10, |
| 65 | Directory = 0x20, |
| 66 | Property = 0x30, |
| 67 | } |
| 68 | |
| 69 | public enum CustomActionTargetType |
| 70 | { |
| 71 | Dll = 1, |
| 72 | Exe = 2, |
| 73 | TextData = 3, |
| 74 | JScript = 5, |
| 75 | VBScript = 6, |
| 76 | } |
| 77 | |
| 78 | public class CustomActionSymbol : IntermediateSymbol |
| 79 | { |
| 80 | public CustomActionSymbol() : base(SymbolDefinitions.CustomAction, null, null) |
| 81 | { |
| 82 | } |
| 83 | |
| 84 | public CustomActionSymbol(SourceLineNumber sourceLineNumber, Identifier id = null) : base(SymbolDefinitions.CustomAction, sourceLineNumber, id) |
| 85 | { |
| 86 | } |
| 87 | |
| 88 | public IntermediateField this[CustomActionSymbolFields index] => this.Fields[(int)index]; |
| 89 | |
| 90 | public CustomActionExecutionType ExecutionType |
| 91 | { |
| 92 | get => (CustomActionExecutionType)this.Fields[(int)CustomActionSymbolFields.ExecutionType].AsNumber(); |
| 93 | set => this.Set((int)CustomActionSymbolFields.ExecutionType, (int)value); |
| 94 | } |
| 95 | |
| 96 | public string Source |
| 97 | { |
| 98 | get => (string)this.Fields[(int)CustomActionSymbolFields.Source]; |
| 99 | set => this.Set((int)CustomActionSymbolFields.Source, value); |
| 100 | } |
| 101 | |
| 102 | public CustomActionSourceType SourceType |
| 103 | { |
| 104 | get => (CustomActionSourceType)this.Fields[(int)CustomActionSymbolFields.SourceType].AsNumber(); |
| 105 | set => this.Set((int)CustomActionSymbolFields.SourceType, (int)value); |
| 106 | } |
| 107 | |
| 108 | public string Target |
| 109 | { |
| 110 | get => (string)this.Fields[(int)CustomActionSymbolFields.Target]; |
| 111 | set => this.Set((int)CustomActionSymbolFields.Target, value); |
| 112 | } |
| 113 | |
| 114 | public CustomActionTargetType TargetType |
| 115 | { |
| 116 | get => (CustomActionTargetType)this.Fields[(int)CustomActionSymbolFields.TargetType].AsNumber(); |
| 117 | set => this.Set((int)CustomActionSymbolFields.TargetType, (int)value); |
| 118 | } |
| 119 | |
| 120 | public bool Async |
| 121 | { |
| 122 | get => this.Fields[(int)CustomActionSymbolFields.Async].AsBool(); |
| 123 | set => this.Set((int)CustomActionSymbolFields.Async, value); |
| 124 | } |
| 125 | |
| 126 | public bool Hidden |
| 127 | { |
| 128 | get => this.Fields[(int)CustomActionSymbolFields.Hidden].AsBool(); |
| 129 | set => this.Set((int)CustomActionSymbolFields.Hidden, value); |
| 130 | } |
| 131 | |
| 132 | public bool IgnoreResult |
| 133 | { |
| 134 | get => this.Fields[(int)CustomActionSymbolFields.IgnoreResult].AsBool(); |
| 135 | set => this.Set((int)CustomActionSymbolFields.IgnoreResult, value); |
| 136 | } |
| 137 | |
| 138 | public bool Impersonate |
| 139 | { |
| 140 | get => this.Fields[(int)CustomActionSymbolFields.Impersonate].AsBool(); |
| 141 | set => this.Set((int)CustomActionSymbolFields.Impersonate, value); |
| 142 | } |
| 143 | |
| 144 | public bool PatchUninstall |
| 145 | { |
| 146 | get => this.Fields[(int)CustomActionSymbolFields.PatchUninstall].AsBool(); |
| 147 | set => this.Set((int)CustomActionSymbolFields.PatchUninstall, value); |
| 148 | } |
| 149 | |
| 150 | public bool TSAware |
| 151 | { |
| 152 | get => this.Fields[(int)CustomActionSymbolFields.TSAware].AsBool(); |
| 153 | set => this.Set((int)CustomActionSymbolFields.TSAware, value); |
| 154 | } |
| 155 | |
| 156 | public bool Win64 |
| 157 | { |
| 158 | get => this.Fields[(int)CustomActionSymbolFields.Win64].AsBool(); |
| 159 | set => this.Set((int)CustomActionSymbolFields.Win64, value); |
| 160 | } |
| 161 | |
| 162 | public IntermediateFieldPathValue ScriptFile |
| 163 | { |
| 164 | get => this.Fields[(int)CustomActionSymbolFields.ScriptFile].AsPath(); |
| 165 | set => this.Set((int)CustomActionSymbolFields.ScriptFile, value); |
| 166 | } |
| 167 | } |
| 168 | } |