| 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 File = new IntermediateSymbolDefinition( |
| 10 | SymbolDefinitionType.File, |
| 11 | new[] |
| 12 | { |
| 13 | new IntermediateFieldDefinition(nameof(FileSymbolFields.ComponentRef), IntermediateFieldType.String), |
| 14 | new IntermediateFieldDefinition(nameof(FileSymbolFields.Name), IntermediateFieldType.String), |
| 15 | new IntermediateFieldDefinition(nameof(FileSymbolFields.ShortName), IntermediateFieldType.String), |
| 16 | new IntermediateFieldDefinition(nameof(FileSymbolFields.FileSize), IntermediateFieldType.Number), |
| 17 | new IntermediateFieldDefinition(nameof(FileSymbolFields.Version), IntermediateFieldType.String), |
| 18 | new IntermediateFieldDefinition(nameof(FileSymbolFields.Language), IntermediateFieldType.String), |
| 19 | new IntermediateFieldDefinition(nameof(FileSymbolFields.Attributes), IntermediateFieldType.Number), |
| 20 | new IntermediateFieldDefinition(nameof(FileSymbolFields.DirectoryRef), IntermediateFieldType.String), |
| 21 | new IntermediateFieldDefinition(nameof(FileSymbolFields.DiskId), IntermediateFieldType.Number), |
| 22 | new IntermediateFieldDefinition(nameof(FileSymbolFields.Source), IntermediateFieldType.Path), |
| 23 | |
| 24 | new IntermediateFieldDefinition(nameof(FileSymbolFields.FontTitle), IntermediateFieldType.String), |
| 25 | new IntermediateFieldDefinition(nameof(FileSymbolFields.SelfRegCost), IntermediateFieldType.Number), |
| 26 | new IntermediateFieldDefinition(nameof(FileSymbolFields.BindPath), IntermediateFieldType.String), |
| 27 | |
| 28 | new IntermediateFieldDefinition(nameof(FileSymbolFields.Sequence), IntermediateFieldType.Number), |
| 29 | |
| 30 | new IntermediateFieldDefinition(nameof(FileSymbolFields.PatchGroup), IntermediateFieldType.Number), |
| 31 | new IntermediateFieldDefinition(nameof(FileSymbolFields.PatchAttributes), IntermediateFieldType.Number), |
| 32 | new IntermediateFieldDefinition(nameof(FileSymbolFields.DeltaPatchHeaderSource), IntermediateFieldType.String), |
| 33 | |
| 34 | new IntermediateFieldDefinition(nameof(FileSymbolFields.RetainLengths), IntermediateFieldType.String), |
| 35 | new IntermediateFieldDefinition(nameof(FileSymbolFields.IgnoreOffsets), IntermediateFieldType.String), |
| 36 | new IntermediateFieldDefinition(nameof(FileSymbolFields.IgnoreLengths), IntermediateFieldType.String), |
| 37 | new IntermediateFieldDefinition(nameof(FileSymbolFields.RetainOffsets), IntermediateFieldType.String), |
| 38 | new IntermediateFieldDefinition(nameof(FileSymbolFields.SymbolPaths), IntermediateFieldType.String), |
| 39 | }, |
| 40 | typeof(FileSymbol)); |
| 41 | } |
| 42 | } |
| 43 | |
| 44 | namespace WixToolset.Data.Symbols |
| 45 | { |
| 46 | using System; |
| 47 | |
| 48 | public enum FileSymbolFields |
| 49 | { |
| 50 | ComponentRef, |
| 51 | Name, |
| 52 | ShortName, |
| 53 | FileSize, |
| 54 | Version, |
| 55 | Language, |
| 56 | Attributes, |
| 57 | DirectoryRef, |
| 58 | DiskId, |
| 59 | Source, |
| 60 | |
| 61 | FontTitle, |
| 62 | SelfRegCost, |
| 63 | BindPath, |
| 64 | |
| 65 | Sequence, |
| 66 | |
| 67 | PatchGroup, |
| 68 | PatchAttributes, |
| 69 | DeltaPatchHeaderSource, |
| 70 | |
| 71 | RetainLengths, |
| 72 | IgnoreOffsets, |
| 73 | IgnoreLengths, |
| 74 | RetainOffsets, |
| 75 | SymbolPaths, |
| 76 | } |
| 77 | |
| 78 | [Flags] |
| 79 | public enum FileSymbolAttributes : int |
| 80 | { |
| 81 | None = 0x0, |
| 82 | ReadOnly = 0x1, |
| 83 | Hidden = 0x2, |
| 84 | System = 0x4, |
| 85 | Vital = 0x8, |
| 86 | Compressed = 0x10, |
| 87 | Uncompressed = 0x20, |
| 88 | Checksum = 0x40, |
| 89 | } |
| 90 | |
| 91 | /// <summary> |
| 92 | /// PatchAttribute values |
| 93 | /// </summary> |
| 94 | [Flags] |
| 95 | public enum PatchAttributeType |
| 96 | { |
| 97 | None = 0, |
| 98 | |
| 99 | /// <summary>Prevents the updating of the file that is in fact changed in the upgraded image relative to the target images.</summary> |
| 100 | Ignore = 1, |
| 101 | |
| 102 | /// <summary>Set if the entire file should be installed rather than creating a binary patch.</summary> |
| 103 | IncludeWholeFile = 2, |
| 104 | |
| 105 | /// <summary>Set to indicate that the patch is non-vital.</summary> |
| 106 | AllowIgnoreOnError = 4, |
| 107 | |
| 108 | /// <summary>Allowed bits.</summary> |
| 109 | Defined = Ignore | IncludeWholeFile | AllowIgnoreOnError |
| 110 | } |
| 111 | |
| 112 | public class FileSymbol : IntermediateSymbol |
| 113 | { |
| 114 | public FileSymbol() : base(SymbolDefinitions.File, null, null) |
| 115 | { |
| 116 | } |
| 117 | |
| 118 | public FileSymbol(SourceLineNumber sourceLineNumber, Identifier id = null) : base(SymbolDefinitions.File, sourceLineNumber, id) |
| 119 | { |
| 120 | } |
| 121 | |
| 122 | public IntermediateField this[FileSymbolFields index] => this.Fields[(int)index]; |
| 123 | |
| 124 | public string ComponentRef |
| 125 | { |
| 126 | get => (string)this.Fields[(int)FileSymbolFields.ComponentRef]; |
| 127 | set => this.Set((int)FileSymbolFields.ComponentRef, value); |
| 128 | } |
| 129 | |
| 130 | public string Name |
| 131 | { |
| 132 | get => (string)this.Fields[(int)FileSymbolFields.Name]; |
| 133 | set => this.Set((int)FileSymbolFields.Name, value); |
| 134 | } |
| 135 | |
| 136 | public string ShortName |
| 137 | { |
| 138 | get => (string)this.Fields[(int)FileSymbolFields.ShortName]; |
| 139 | set => this.Set((int)FileSymbolFields.ShortName, value); |
| 140 | } |
| 141 | |
| 142 | public int FileSize |
| 143 | { |
| 144 | get => (int)this.Fields[(int)FileSymbolFields.FileSize]; |
| 145 | set => this.Set((int)FileSymbolFields.FileSize, value); |
| 146 | } |
| 147 | |
| 148 | public string Version |
| 149 | { |
| 150 | get => (string)this.Fields[(int)FileSymbolFields.Version]; |
| 151 | set => this.Set((int)FileSymbolFields.Version, value); |
| 152 | } |
| 153 | |
| 154 | public string Language |
| 155 | { |
| 156 | get => (string)this.Fields[(int)FileSymbolFields.Language]; |
| 157 | set => this.Set((int)FileSymbolFields.Language, value); |
| 158 | } |
| 159 | |
| 160 | public FileSymbolAttributes Attributes |
| 161 | { |
| 162 | get => (FileSymbolAttributes)this.Fields[(int)FileSymbolFields.Attributes].AsNumber(); |
| 163 | set => this.Set((int)FileSymbolFields.Attributes, (int)value); |
| 164 | } |
| 165 | |
| 166 | public string DirectoryRef |
| 167 | { |
| 168 | get => (string)this.Fields[(int)FileSymbolFields.DirectoryRef]; |
| 169 | set => this.Set((int)FileSymbolFields.DirectoryRef, value); |
| 170 | } |
| 171 | |
| 172 | public int? DiskId |
| 173 | { |
| 174 | get => (int?)this.Fields[(int)FileSymbolFields.DiskId]; |
| 175 | set => this.Set((int)FileSymbolFields.DiskId, value); |
| 176 | } |
| 177 | |
| 178 | public IntermediateFieldPathValue Source |
| 179 | { |
| 180 | get => this.Fields[(int)FileSymbolFields.Source].AsPath(); |
| 181 | set => this.Set((int)FileSymbolFields.Source, value); |
| 182 | } |
| 183 | |
| 184 | public string FontTitle |
| 185 | { |
| 186 | get => (string)this.Fields[(int)FileSymbolFields.FontTitle]; |
| 187 | set => this.Set((int)FileSymbolFields.FontTitle, value); |
| 188 | } |
| 189 | |
| 190 | public int? SelfRegCost |
| 191 | { |
| 192 | get => (int?)this.Fields[(int)FileSymbolFields.SelfRegCost]; |
| 193 | set => this.Set((int)FileSymbolFields.SelfRegCost, value); |
| 194 | } |
| 195 | |
| 196 | public string BindPath |
| 197 | { |
| 198 | get => (string)this.Fields[(int)FileSymbolFields.BindPath]; |
| 199 | set => this.Set((int)FileSymbolFields.BindPath, value); |
| 200 | } |
| 201 | |
| 202 | public int Sequence |
| 203 | { |
| 204 | get => (int)this.Fields[(int)FileSymbolFields.Sequence]; |
| 205 | set => this.Set((int)FileSymbolFields.Sequence, value); |
| 206 | } |
| 207 | |
| 208 | public int? PatchGroup |
| 209 | { |
| 210 | get => (int?)this.Fields[(int)FileSymbolFields.PatchGroup]; |
| 211 | set => this.Set((int)FileSymbolFields.PatchGroup, value); |
| 212 | } |
| 213 | |
| 214 | public PatchAttributeType? PatchAttributes |
| 215 | { |
| 216 | get => (PatchAttributeType?)this.Fields[(int)FileSymbolFields.PatchAttributes].AsNullableNumber(); |
| 217 | set => this.Set((int)FileSymbolFields.PatchAttributes, (int?)value); |
| 218 | } |
| 219 | |
| 220 | public string DeltaPatchHeaderSource |
| 221 | { |
| 222 | get => (string)this.Fields[(int)FileSymbolFields.DeltaPatchHeaderSource]; |
| 223 | set => this.Set((int)FileSymbolFields.DeltaPatchHeaderSource, value); |
| 224 | } |
| 225 | |
| 226 | public string RetainLengths |
| 227 | { |
| 228 | get => (string)this.Fields[(int)FileSymbolFields.RetainLengths]; |
| 229 | set => this.Set((int)FileSymbolFields.RetainLengths, value); |
| 230 | } |
| 231 | |
| 232 | public string IgnoreOffsets |
| 233 | { |
| 234 | get => (string)this.Fields[(int)FileSymbolFields.IgnoreOffsets]; |
| 235 | set => this.Set((int)FileSymbolFields.IgnoreOffsets, value); |
| 236 | } |
| 237 | |
| 238 | public string IgnoreLengths |
| 239 | { |
| 240 | get => (string)this.Fields[(int)FileSymbolFields.IgnoreLengths]; |
| 241 | set => this.Set((int)FileSymbolFields.IgnoreLengths, value); |
| 242 | } |
| 243 | |
| 244 | public string RetainOffsets |
| 245 | { |
| 246 | get => (string)this.Fields[(int)FileSymbolFields.RetainOffsets]; |
| 247 | set => this.Set((int)FileSymbolFields.RetainOffsets, value); |
| 248 | } |
| 249 | |
| 250 | public string SymbolPaths |
| 251 | { |
| 252 | get => (string)this.Fields[(int)FileSymbolFields.SymbolPaths]; |
| 253 | set => this.Set((int)FileSymbolFields.SymbolPaths, value); |
| 254 | } |
| 255 | } |
| 256 | } |