diff options
| author | Rob Mensching <rob@firegiant.com> | 2021-04-02 14:28:56 -0700 |
|---|---|---|
| committer | Rob Mensching <rob@firegiant.com> | 2021-04-02 14:46:29 -0700 |
| commit | 4bb99d4a7521f3182b3d8ea9833038dc067db118 (patch) | |
| tree | 031c917bfc0fd3c513579646e92c3e9f823efba3 /src | |
| parent | a0dd2bc561ee6aa6b7aebedcff76c8a11e14bc9f (diff) | |
| download | wix-4bb99d4a7521f3182b3d8ea9833038dc067db118.tar.gz wix-4bb99d4a7521f3182b3d8ea9833038dc067db118.tar.bz2 wix-4bb99d4a7521f3182b3d8ea9833038dc067db118.zip | |
Move codepage from section and to package, module, patch symbols
Contributes to wixtoolset/issues#5801
Diffstat (limited to 'src')
| -rw-r--r-- | src/WixToolset.Data/IntermediateSection.cs | 16 | ||||
| -rw-r--r-- | src/WixToolset.Data/Localization.cs | 29 | ||||
| -rw-r--r-- | src/WixToolset.Data/Symbols/ModuleSignatureSymbol.cs | 60 | ||||
| -rw-r--r-- | src/WixToolset.Data/Symbols/SymbolDefinitions.cs | 14 | ||||
| -rw-r--r-- | src/WixToolset.Data/Symbols/WixModuleSymbol.cs | 68 | ||||
| -rw-r--r-- | src/WixToolset.Data/Symbols/WixPackageSymbol.cs | 111 | ||||
| -rw-r--r-- | src/WixToolset.Data/Symbols/WixPatchIdSymbol.cs | 90 | ||||
| -rw-r--r-- | src/WixToolset.Data/Symbols/WixPatchSymbol.cs | 98 | ||||
| -rw-r--r-- | src/WixToolset.Data/WindowsInstaller/WindowsInstallerTableDefinitions.cs | 2 | ||||
| -rw-r--r-- | src/test/WixToolsetTest.Data/SerializeFixture.cs | 18 |
10 files changed, 321 insertions, 185 deletions
diff --git a/src/WixToolset.Data/IntermediateSection.cs b/src/WixToolset.Data/IntermediateSection.cs index 86aa0c89..b9157875 100644 --- a/src/WixToolset.Data/IntermediateSection.cs +++ b/src/WixToolset.Data/IntermediateSection.cs | |||
| @@ -18,13 +18,11 @@ namespace WixToolset.Data | |||
| 18 | /// </summary> | 18 | /// </summary> |
| 19 | /// <param name="id">Identifier for section.</param> | 19 | /// <param name="id">Identifier for section.</param> |
| 20 | /// <param name="type">Type of section.</param> | 20 | /// <param name="type">Type of section.</param> |
| 21 | /// <param name="codepage">Codepage for resulting database.</param> | ||
| 22 | /// <param name="compilationId">Optional compilation identifier</param> | 21 | /// <param name="compilationId">Optional compilation identifier</param> |
| 23 | public IntermediateSection(string id, SectionType type, int codepage, string compilationId = null) | 22 | public IntermediateSection(string id, SectionType type, string compilationId = null) |
| 24 | { | 23 | { |
| 25 | this.Id = id; | 24 | this.Id = id; |
| 26 | this.Type = type; | 25 | this.Type = type; |
| 27 | this.Codepage = codepage; | ||
| 28 | this.CompilationId = compilationId; | 26 | this.CompilationId = compilationId; |
| 29 | this.symbols = new List<IntermediateSymbol>(); | 27 | this.symbols = new List<IntermediateSymbol>(); |
| 30 | } | 28 | } |
| @@ -42,12 +40,6 @@ namespace WixToolset.Data | |||
| 42 | public SectionType Type { get; } | 40 | public SectionType Type { get; } |
| 43 | 41 | ||
| 44 | /// <summary> | 42 | /// <summary> |
| 45 | /// Gets the codepage for the section. | ||
| 46 | /// </summary> | ||
| 47 | /// <value>Codepage for the section.</value> | ||
| 48 | public int Codepage { get; } | ||
| 49 | |||
| 50 | /// <summary> | ||
| 51 | /// Gets and sets the identifier of the compilation of the source file containing the section. | 43 | /// Gets and sets the identifier of the compilation of the source file containing the section. |
| 52 | /// </summary> | 44 | /// </summary> |
| 53 | public string CompilationId { get; } | 45 | public string CompilationId { get; } |
| @@ -98,7 +90,6 @@ namespace WixToolset.Data | |||
| 98 | /// </summary> | 90 | /// </summary> |
| 99 | internal static IntermediateSection Deserialize(ISymbolDefinitionCreator creator, Uri baseUri, JsonObject jsonObject) | 91 | internal static IntermediateSection Deserialize(ISymbolDefinitionCreator creator, Uri baseUri, JsonObject jsonObject) |
| 100 | { | 92 | { |
| 101 | var codepage = jsonObject.GetValueOrDefault("codepage", 0); | ||
| 102 | var id = jsonObject.GetValueOrDefault<string>("id"); | 93 | var id = jsonObject.GetValueOrDefault<string>("id"); |
| 103 | var type = jsonObject.GetEnumOrDefault("type", SectionType.Unknown); | 94 | var type = jsonObject.GetEnumOrDefault("type", SectionType.Unknown); |
| 104 | 95 | ||
| @@ -107,7 +98,7 @@ namespace WixToolset.Data | |||
| 107 | throw new ArgumentException("JSON object is not a valid section, unknown section type", nameof(type)); | 98 | throw new ArgumentException("JSON object is not a valid section, unknown section type", nameof(type)); |
| 108 | } | 99 | } |
| 109 | 100 | ||
| 110 | var section = new IntermediateSection(id, type, codepage); | 101 | var section = new IntermediateSection(id, type); |
| 111 | 102 | ||
| 112 | var symbolsJson = jsonObject.GetValueOrDefault<JsonArray>("symbols"); | 103 | var symbolsJson = jsonObject.GetValueOrDefault<JsonArray>("symbols"); |
| 113 | 104 | ||
| @@ -124,8 +115,7 @@ namespace WixToolset.Data | |||
| 124 | { | 115 | { |
| 125 | var jsonObject = new JsonObject | 116 | var jsonObject = new JsonObject |
| 126 | { | 117 | { |
| 127 | { "type", this.Type.ToString().ToLowerInvariant() }, | 118 | { "type", this.Type.ToString().ToLowerInvariant() } |
| 128 | { "codepage", this.Codepage } | ||
| 129 | }; | 119 | }; |
| 130 | 120 | ||
| 131 | if (!String.IsNullOrEmpty(this.Id)) | 121 | if (!String.IsNullOrEmpty(this.Id)) |
diff --git a/src/WixToolset.Data/Localization.cs b/src/WixToolset.Data/Localization.cs index 7ce765f4..70c096de 100644 --- a/src/WixToolset.Data/Localization.cs +++ b/src/WixToolset.Data/Localization.cs | |||
| @@ -18,9 +18,10 @@ namespace WixToolset.Data | |||
| 18 | /// <summary> | 18 | /// <summary> |
| 19 | /// Instantiates a new localization object. | 19 | /// Instantiates a new localization object. |
| 20 | /// </summary> | 20 | /// </summary> |
| 21 | public Localization(int codepage, string culture, IDictionary<string, BindVariable> variables, IDictionary<string, LocalizedControl> localizedControls) | 21 | public Localization(int? codepage, int? summaryInformationCodepage, string culture, IDictionary<string, BindVariable> variables, IDictionary<string, LocalizedControl> localizedControls) |
| 22 | { | 22 | { |
| 23 | this.Codepage = codepage; | 23 | this.Codepage = codepage; |
| 24 | this.SummaryInformationCodepage = summaryInformationCodepage; | ||
| 24 | this.Culture = culture?.ToLowerInvariant() ?? String.Empty; | 25 | this.Culture = culture?.ToLowerInvariant() ?? String.Empty; |
| 25 | this.variables = new Dictionary<string, BindVariable>(variables); | 26 | this.variables = new Dictionary<string, BindVariable>(variables); |
| 26 | this.localizedControls = new Dictionary<string, LocalizedControl>(localizedControls); | 27 | this.localizedControls = new Dictionary<string, LocalizedControl>(localizedControls); |
| @@ -30,7 +31,13 @@ namespace WixToolset.Data | |||
| 30 | /// Gets the codepage. | 31 | /// Gets the codepage. |
| 31 | /// </summary> | 32 | /// </summary> |
| 32 | /// <value>The codepage.</value> | 33 | /// <value>The codepage.</value> |
| 33 | public int Codepage { get; private set; } | 34 | public int? Codepage { get; private set; } |
| 35 | |||
| 36 | /// <summary> | ||
| 37 | /// Gets the summary information codepage. | ||
| 38 | /// </summary> | ||
| 39 | /// <value>The summary information codepage.</value> | ||
| 40 | public int? SummaryInformationCodepage { get; private set; } | ||
| 34 | 41 | ||
| 35 | /// <summary> | 42 | /// <summary> |
| 36 | /// Gets the culture. | 43 | /// Gets the culture. |
| @@ -52,10 +59,17 @@ namespace WixToolset.Data | |||
| 52 | 59 | ||
| 53 | internal JsonObject Serialize() | 60 | internal JsonObject Serialize() |
| 54 | { | 61 | { |
| 55 | var jsonObject = new JsonObject | 62 | var jsonObject = new JsonObject(); |
| 63 | |||
| 64 | if (this.Codepage.HasValue) | ||
| 56 | { | 65 | { |
| 57 | { "codepage", this.Codepage }, | 66 | jsonObject.Add("codepage", this.Codepage.Value); |
| 58 | }; | 67 | } |
| 68 | |||
| 69 | if (this.SummaryInformationCodepage.HasValue) | ||
| 70 | { | ||
| 71 | jsonObject.Add("summaryCodepage", this.SummaryInformationCodepage.Value); | ||
| 72 | } | ||
| 59 | 73 | ||
| 60 | jsonObject.AddIsNotNullOrEmpty("culture", this.Culture); | 74 | jsonObject.AddIsNotNullOrEmpty("culture", this.Culture); |
| 61 | 75 | ||
| @@ -94,7 +108,8 @@ namespace WixToolset.Data | |||
| 94 | 108 | ||
| 95 | internal static Localization Deserialize(JsonObject jsonObject) | 109 | internal static Localization Deserialize(JsonObject jsonObject) |
| 96 | { | 110 | { |
| 97 | var codepage = jsonObject.GetValueOrDefault("codepage", 0); | 111 | var codepage = jsonObject.GetValueOrDefault("codepage", null); |
| 112 | var summaryCodepage = jsonObject.GetValueOrDefault("summaryCodepage", null); | ||
| 98 | var culture = jsonObject.GetValueOrDefault<string>("culture"); | 113 | var culture = jsonObject.GetValueOrDefault<string>("culture"); |
| 99 | 114 | ||
| 100 | var variables = new Dictionary<string, BindVariable>(); | 115 | var variables = new Dictionary<string, BindVariable>(); |
| @@ -116,7 +131,7 @@ namespace WixToolset.Data | |||
| 116 | } | 131 | } |
| 117 | } | 132 | } |
| 118 | 133 | ||
| 119 | return new Localization(codepage, culture, variables, controls); | 134 | return new Localization(codepage, summaryCodepage, culture, variables, controls); |
| 120 | } | 135 | } |
| 121 | } | 136 | } |
| 122 | } | 137 | } |
diff --git a/src/WixToolset.Data/Symbols/ModuleSignatureSymbol.cs b/src/WixToolset.Data/Symbols/ModuleSignatureSymbol.cs deleted file mode 100644 index 5f6ded09..00000000 --- a/src/WixToolset.Data/Symbols/ModuleSignatureSymbol.cs +++ /dev/null | |||
| @@ -1,60 +0,0 @@ | |||
| 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 ModuleSignature = new IntermediateSymbolDefinition( | ||
| 10 | SymbolDefinitionType.ModuleSignature, | ||
| 11 | new[] | ||
| 12 | { | ||
| 13 | new IntermediateFieldDefinition(nameof(ModuleSignatureSymbolFields.ModuleID), IntermediateFieldType.String), | ||
| 14 | new IntermediateFieldDefinition(nameof(ModuleSignatureSymbolFields.Language), IntermediateFieldType.Number), | ||
| 15 | new IntermediateFieldDefinition(nameof(ModuleSignatureSymbolFields.Version), IntermediateFieldType.String), | ||
| 16 | }, | ||
| 17 | typeof(ModuleSignatureSymbol)); | ||
| 18 | } | ||
| 19 | } | ||
| 20 | |||
| 21 | namespace WixToolset.Data.Symbols | ||
| 22 | { | ||
| 23 | public enum ModuleSignatureSymbolFields | ||
| 24 | { | ||
| 25 | ModuleID, | ||
| 26 | Language, | ||
| 27 | Version, | ||
| 28 | } | ||
| 29 | |||
| 30 | public class ModuleSignatureSymbol : IntermediateSymbol | ||
| 31 | { | ||
| 32 | public ModuleSignatureSymbol() : base(SymbolDefinitions.ModuleSignature, null, null) | ||
| 33 | { | ||
| 34 | } | ||
| 35 | |||
| 36 | public ModuleSignatureSymbol(SourceLineNumber sourceLineNumber, Identifier id = null) : base(SymbolDefinitions.ModuleSignature, sourceLineNumber, id) | ||
| 37 | { | ||
| 38 | } | ||
| 39 | |||
| 40 | public IntermediateField this[ModuleSignatureSymbolFields index] => this.Fields[(int)index]; | ||
| 41 | |||
| 42 | public string ModuleID | ||
| 43 | { | ||
| 44 | get => (string)this.Fields[(int)ModuleSignatureSymbolFields.ModuleID]; | ||
| 45 | set => this.Set((int)ModuleSignatureSymbolFields.ModuleID, value); | ||
| 46 | } | ||
| 47 | |||
| 48 | public int Language | ||
| 49 | { | ||
| 50 | get => (int)this.Fields[(int)ModuleSignatureSymbolFields.Language]; | ||
| 51 | set => this.Set((int)ModuleSignatureSymbolFields.Language, value); | ||
| 52 | } | ||
| 53 | |||
| 54 | public string Version | ||
| 55 | { | ||
| 56 | get => (string)this.Fields[(int)ModuleSignatureSymbolFields.Version]; | ||
| 57 | set => this.Set((int)ModuleSignatureSymbolFields.Version, value); | ||
| 58 | } | ||
| 59 | } | ||
| 60 | } \ No newline at end of file | ||
diff --git a/src/WixToolset.Data/Symbols/SymbolDefinitions.cs b/src/WixToolset.Data/Symbols/SymbolDefinitions.cs index 54deb87f..0ed0a4ec 100644 --- a/src/WixToolset.Data/Symbols/SymbolDefinitions.cs +++ b/src/WixToolset.Data/Symbols/SymbolDefinitions.cs | |||
| @@ -56,7 +56,7 @@ namespace WixToolset.Data | |||
| 56 | ModuleDependency, | 56 | ModuleDependency, |
| 57 | ModuleExclusion, | 57 | ModuleExclusion, |
| 58 | ModuleIgnoreTable, | 58 | ModuleIgnoreTable, |
| 59 | ModuleSignature, | 59 | WixModule, |
| 60 | ModuleSubstitution, | 60 | ModuleSubstitution, |
| 61 | MoveFile, | 61 | MoveFile, |
| 62 | Assembly, | 62 | Assembly, |
| @@ -172,9 +172,10 @@ namespace WixToolset.Data | |||
| 172 | WixMediaTemplate, | 172 | WixMediaTemplate, |
| 173 | WixMerge, | 173 | WixMerge, |
| 174 | WixOrdering, | 174 | WixOrdering, |
| 175 | WixPackage, | ||
| 175 | WixPatchBaseline, | 176 | WixPatchBaseline, |
| 176 | WixPatchFamilyGroup, | 177 | WixPatchFamilyGroup, |
| 177 | WixPatchId, | 178 | WixPatch, |
| 178 | WixPatchRef, | 179 | WixPatchRef, |
| 179 | WixPatchTarget, | 180 | WixPatchTarget, |
| 180 | WixProductSearch, | 181 | WixProductSearch, |
| @@ -362,8 +363,8 @@ namespace WixToolset.Data | |||
| 362 | case SymbolDefinitionType.ModuleIgnoreTable: | 363 | case SymbolDefinitionType.ModuleIgnoreTable: |
| 363 | return SymbolDefinitions.ModuleIgnoreTable; | 364 | return SymbolDefinitions.ModuleIgnoreTable; |
| 364 | 365 | ||
| 365 | case SymbolDefinitionType.ModuleSignature: | 366 | case SymbolDefinitionType.WixModule: |
| 366 | return SymbolDefinitions.ModuleSignature; | 367 | return SymbolDefinitions.WixModule; |
| 367 | 368 | ||
| 368 | case SymbolDefinitionType.ModuleSubstitution: | 369 | case SymbolDefinitionType.ModuleSubstitution: |
| 369 | return SymbolDefinitions.ModuleSubstitution; | 370 | return SymbolDefinitions.ModuleSubstitution; |
| @@ -707,13 +708,16 @@ namespace WixToolset.Data | |||
| 707 | case SymbolDefinitionType.WixOrdering: | 708 | case SymbolDefinitionType.WixOrdering: |
| 708 | return SymbolDefinitions.WixOrdering; | 709 | return SymbolDefinitions.WixOrdering; |
| 709 | 710 | ||
| 711 | case SymbolDefinitionType.WixPackage: | ||
| 712 | return SymbolDefinitions.WixPackage; | ||
| 713 | |||
| 710 | case SymbolDefinitionType.WixPatchBaseline: | 714 | case SymbolDefinitionType.WixPatchBaseline: |
| 711 | return SymbolDefinitions.WixPatchBaseline; | 715 | return SymbolDefinitions.WixPatchBaseline; |
| 712 | 716 | ||
| 713 | case SymbolDefinitionType.WixPatchFamilyGroup: | 717 | case SymbolDefinitionType.WixPatchFamilyGroup: |
| 714 | return SymbolDefinitions.WixPatchFamilyGroup; | 718 | return SymbolDefinitions.WixPatchFamilyGroup; |
| 715 | 719 | ||
| 716 | case SymbolDefinitionType.WixPatchId: | 720 | case SymbolDefinitionType.WixPatch: |
| 717 | return SymbolDefinitions.WixPatchId; | 721 | return SymbolDefinitions.WixPatchId; |
| 718 | 722 | ||
| 719 | case SymbolDefinitionType.WixPatchRef: | 723 | case SymbolDefinitionType.WixPatchRef: |
diff --git a/src/WixToolset.Data/Symbols/WixModuleSymbol.cs b/src/WixToolset.Data/Symbols/WixModuleSymbol.cs new file mode 100644 index 00000000..fbb16764 --- /dev/null +++ b/src/WixToolset.Data/Symbols/WixModuleSymbol.cs | |||
| @@ -0,0 +1,68 @@ | |||
| 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 WixModule = new IntermediateSymbolDefinition( | ||
| 10 | SymbolDefinitionType.WixModule, | ||
| 11 | new[] | ||
| 12 | { | ||
| 13 | new IntermediateFieldDefinition(nameof(WixModuleSymbolFields.ModuleId), IntermediateFieldType.String), | ||
| 14 | new IntermediateFieldDefinition(nameof(WixModuleSymbolFields.Language), IntermediateFieldType.String), | ||
| 15 | new IntermediateFieldDefinition(nameof(WixModuleSymbolFields.Version), IntermediateFieldType.String), | ||
| 16 | new IntermediateFieldDefinition(nameof(WixModuleSymbolFields.Codepage), IntermediateFieldType.String), | ||
| 17 | }, | ||
| 18 | typeof(WixModuleSymbol)); | ||
| 19 | } | ||
| 20 | } | ||
| 21 | |||
| 22 | namespace WixToolset.Data.Symbols | ||
| 23 | { | ||
| 24 | public enum WixModuleSymbolFields | ||
| 25 | { | ||
| 26 | ModuleId, | ||
| 27 | Language, | ||
| 28 | Version, | ||
| 29 | Codepage, | ||
| 30 | } | ||
| 31 | |||
| 32 | public class WixModuleSymbol : IntermediateSymbol | ||
| 33 | { | ||
| 34 | public WixModuleSymbol() : base(SymbolDefinitions.WixModule, null, null) | ||
| 35 | { | ||
| 36 | } | ||
| 37 | |||
| 38 | public WixModuleSymbol(SourceLineNumber sourceLineNumber, Identifier id = null) : base(SymbolDefinitions.WixModule, sourceLineNumber, id) | ||
| 39 | { | ||
| 40 | } | ||
| 41 | |||
| 42 | public IntermediateField this[WixModuleSymbolFields index] => this.Fields[(int)index]; | ||
| 43 | |||
| 44 | public string ModuleId | ||
| 45 | { | ||
| 46 | get => (string)this.Fields[(int)WixModuleSymbolFields.ModuleId]; | ||
| 47 | set => this.Set((int)WixModuleSymbolFields.ModuleId, value); | ||
| 48 | } | ||
| 49 | |||
| 50 | public string Language | ||
| 51 | { | ||
| 52 | get => (string)this.Fields[(int)WixModuleSymbolFields.Language]; | ||
| 53 | set => this.Set((int)WixModuleSymbolFields.Language, value); | ||
| 54 | } | ||
| 55 | |||
| 56 | public string Version | ||
| 57 | { | ||
| 58 | get => (string)this.Fields[(int)WixModuleSymbolFields.Version]; | ||
| 59 | set => this.Set((int)WixModuleSymbolFields.Version, value); | ||
| 60 | } | ||
| 61 | |||
| 62 | public string Codepage | ||
| 63 | { | ||
| 64 | get => (string)this.Fields[(int)WixModuleSymbolFields.Codepage]; | ||
| 65 | set => this.Set((int)WixModuleSymbolFields.Codepage, value); | ||
| 66 | } | ||
| 67 | } | ||
| 68 | } | ||
diff --git a/src/WixToolset.Data/Symbols/WixPackageSymbol.cs b/src/WixToolset.Data/Symbols/WixPackageSymbol.cs new file mode 100644 index 00000000..e1720033 --- /dev/null +++ b/src/WixToolset.Data/Symbols/WixPackageSymbol.cs | |||
| @@ -0,0 +1,111 @@ | |||
| 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 WixPackage = new IntermediateSymbolDefinition( | ||
| 10 | SymbolDefinitionType.WixPackage, | ||
| 11 | new[] | ||
| 12 | { | ||
| 13 | new IntermediateFieldDefinition(nameof(WixPackageSymbolFields.PackageId), IntermediateFieldType.String), | ||
| 14 | new IntermediateFieldDefinition(nameof(WixPackageSymbolFields.UpgradeCode), IntermediateFieldType.String), | ||
| 15 | new IntermediateFieldDefinition(nameof(WixPackageSymbolFields.Name), IntermediateFieldType.String), | ||
| 16 | new IntermediateFieldDefinition(nameof(WixPackageSymbolFields.Language), IntermediateFieldType.String), | ||
| 17 | new IntermediateFieldDefinition(nameof(WixPackageSymbolFields.Version), IntermediateFieldType.String), | ||
| 18 | new IntermediateFieldDefinition(nameof(WixPackageSymbolFields.Manufacturer), IntermediateFieldType.String), | ||
| 19 | new IntermediateFieldDefinition(nameof(WixPackageSymbolFields.Attributes), IntermediateFieldType.Number), | ||
| 20 | new IntermediateFieldDefinition(nameof(WixPackageSymbolFields.Codepage), IntermediateFieldType.String), | ||
| 21 | }, | ||
| 22 | typeof(WixPackageSymbol)); | ||
| 23 | } | ||
| 24 | } | ||
| 25 | |||
| 26 | namespace WixToolset.Data.Symbols | ||
| 27 | { | ||
| 28 | using System; | ||
| 29 | |||
| 30 | public enum WixPackageSymbolFields | ||
| 31 | { | ||
| 32 | PackageId, | ||
| 33 | UpgradeCode, | ||
| 34 | Name, | ||
| 35 | Language, | ||
| 36 | Version, | ||
| 37 | Manufacturer, | ||
| 38 | Attributes, | ||
| 39 | Codepage, | ||
| 40 | } | ||
| 41 | |||
| 42 | [Flags] | ||
| 43 | public enum WixPackageAttributes | ||
| 44 | { | ||
| 45 | None = 0x0, | ||
| 46 | PerMachine = 0x1, | ||
| 47 | } | ||
| 48 | |||
| 49 | public class WixPackageSymbol : IntermediateSymbol | ||
| 50 | { | ||
| 51 | public WixPackageSymbol() : base(SymbolDefinitions.WixPackage, null, null) | ||
| 52 | { | ||
| 53 | } | ||
| 54 | |||
| 55 | public WixPackageSymbol(SourceLineNumber sourceLineNumber, Identifier id = null) : base(SymbolDefinitions.WixPackage, sourceLineNumber, id) | ||
| 56 | { | ||
| 57 | } | ||
| 58 | |||
| 59 | public IntermediateField this[WixPackageSymbolFields index] => this.Fields[(int)index]; | ||
| 60 | |||
| 61 | public string PackageId | ||
| 62 | { | ||
| 63 | get => (string)this.Fields[(int)WixPackageSymbolFields.PackageId]; | ||
| 64 | set => this.Set((int)WixPackageSymbolFields.PackageId, value); | ||
| 65 | } | ||
| 66 | |||
| 67 | public string UpgradeCode | ||
| 68 | { | ||
| 69 | get => (string)this.Fields[(int)WixPackageSymbolFields.UpgradeCode]; | ||
| 70 | set => this.Set((int)WixPackageSymbolFields.UpgradeCode, value); | ||
| 71 | } | ||
| 72 | |||
| 73 | public string Name | ||
| 74 | { | ||
| 75 | get => (string)this.Fields[(int)WixPackageSymbolFields.Name]; | ||
| 76 | set => this.Set((int)WixPackageSymbolFields.Name, value); | ||
| 77 | } | ||
| 78 | |||
| 79 | public string Language | ||
| 80 | { | ||
| 81 | get => (string)this.Fields[(int)WixPackageSymbolFields.Language]; | ||
| 82 | set => this.Set((int)WixPackageSymbolFields.Language, value); | ||
| 83 | } | ||
| 84 | |||
| 85 | public string Version | ||
| 86 | { | ||
| 87 | get => (string)this.Fields[(int)WixPackageSymbolFields.Version]; | ||
| 88 | set => this.Set((int)WixPackageSymbolFields.Version, value); | ||
| 89 | } | ||
| 90 | |||
| 91 | public string Manufacturer | ||
| 92 | { | ||
| 93 | get => (string)this.Fields[(int)WixPackageSymbolFields.Manufacturer]; | ||
| 94 | set => this.Set((int)WixPackageSymbolFields.Manufacturer, value); | ||
| 95 | } | ||
| 96 | |||
| 97 | public WixPackageAttributes Attributes | ||
| 98 | { | ||
| 99 | get => (WixPackageAttributes)this.Fields[(int)WixPackageSymbolFields.Attributes].AsNumber(); | ||
| 100 | set => this.Set((int)WixPackageSymbolFields.Attributes, (int)value); | ||
| 101 | } | ||
| 102 | |||
| 103 | public string Codepage | ||
| 104 | { | ||
| 105 | get => (string)this.Fields[(int)WixPackageSymbolFields.Codepage]; | ||
| 106 | set => this.Set((int)WixPackageSymbolFields.Codepage, value); | ||
| 107 | } | ||
| 108 | |||
| 109 | public bool PerMachine => (this.Attributes & WixPackageAttributes.PerMachine) == WixPackageAttributes.PerMachine; | ||
| 110 | } | ||
| 111 | } | ||
diff --git a/src/WixToolset.Data/Symbols/WixPatchIdSymbol.cs b/src/WixToolset.Data/Symbols/WixPatchIdSymbol.cs deleted file mode 100644 index 344fc058..00000000 --- a/src/WixToolset.Data/Symbols/WixPatchIdSymbol.cs +++ /dev/null | |||
| @@ -1,90 +0,0 @@ | |||
| 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 WixPatchId = new IntermediateSymbolDefinition( | ||
| 10 | SymbolDefinitionType.WixPatchId, | ||
| 11 | new[] | ||
| 12 | { | ||
| 13 | new IntermediateFieldDefinition(nameof(WixPatchIdSymbolFields.ClientPatchId), IntermediateFieldType.String), | ||
| 14 | new IntermediateFieldDefinition(nameof(WixPatchIdSymbolFields.OptimizePatchSizeForLargeFiles), IntermediateFieldType.Bool), | ||
| 15 | new IntermediateFieldDefinition(nameof(WixPatchIdSymbolFields.ApiPatchingSymbolFlags), IntermediateFieldType.Number), | ||
| 16 | }, | ||
| 17 | typeof(WixPatchIdSymbol)); | ||
| 18 | } | ||
| 19 | } | ||
| 20 | |||
| 21 | namespace WixToolset.Data.Symbols | ||
| 22 | { | ||
| 23 | using System; | ||
| 24 | |||
| 25 | public enum WixPatchIdSymbolFields | ||
| 26 | { | ||
| 27 | ClientPatchId, | ||
| 28 | OptimizePatchSizeForLargeFiles, | ||
| 29 | ApiPatchingSymbolFlags, | ||
| 30 | } | ||
| 31 | |||
| 32 | /// <summary> | ||
| 33 | /// The following flags are used with PATCH_OPTION_DATA SymbolOptionFlags: | ||
| 34 | /// </summary> | ||
| 35 | [Flags] | ||
| 36 | [CLSCompliant(false)] | ||
| 37 | public enum PatchSymbolFlags : uint | ||
| 38 | { | ||
| 39 | /// <summary> | ||
| 40 | /// Don't use imagehlp.dll | ||
| 41 | /// </summary> | ||
| 42 | PatchSymbolNoImagehlp = 0x00000001, | ||
| 43 | |||
| 44 | /// <summary> | ||
| 45 | /// Don't fail patch due to imagehlp failures. | ||
| 46 | /// </summary> | ||
| 47 | PatchSymbolNoFailures = 0x00000002, | ||
| 48 | |||
| 49 | /// <summary> | ||
| 50 | /// After matching decorated symbols, try to match remaining by undecorated names. | ||
| 51 | /// </summary> | ||
| 52 | PatchSymbolUndecoratedToo = 0x00000004, | ||
| 53 | |||
| 54 | /// <summary> | ||
| 55 | /// (used internally) | ||
| 56 | /// </summary> | ||
| 57 | PatchSymbolReserved = 0x80000000, | ||
| 58 | } | ||
| 59 | |||
| 60 | public class WixPatchIdSymbol : IntermediateSymbol | ||
| 61 | { | ||
| 62 | public WixPatchIdSymbol() : base(SymbolDefinitions.WixPatchId, null, null) | ||
| 63 | { | ||
| 64 | } | ||
| 65 | |||
| 66 | public WixPatchIdSymbol(SourceLineNumber sourceLineNumber, Identifier id = null) : base(SymbolDefinitions.WixPatchId, sourceLineNumber, id) | ||
| 67 | { | ||
| 68 | } | ||
| 69 | |||
| 70 | public IntermediateField this[WixPatchIdSymbolFields index] => this.Fields[(int)index]; | ||
| 71 | |||
| 72 | public string ClientPatchId | ||
| 73 | { | ||
| 74 | get => (string)this.Fields[(int)WixPatchIdSymbolFields.ClientPatchId]; | ||
| 75 | set => this.Set((int)WixPatchIdSymbolFields.ClientPatchId, value); | ||
| 76 | } | ||
| 77 | |||
| 78 | public bool? OptimizePatchSizeForLargeFiles | ||
| 79 | { | ||
| 80 | get => (bool?)this.Fields[(int)WixPatchIdSymbolFields.OptimizePatchSizeForLargeFiles]; | ||
| 81 | set => this.Set((int)WixPatchIdSymbolFields.OptimizePatchSizeForLargeFiles, value); | ||
| 82 | } | ||
| 83 | |||
| 84 | public int? ApiPatchingSymbolFlags | ||
| 85 | { | ||
| 86 | get => (int?)this.Fields[(int)WixPatchIdSymbolFields.ApiPatchingSymbolFlags]; | ||
| 87 | set => this.Set((int)WixPatchIdSymbolFields.ApiPatchingSymbolFlags, value); | ||
| 88 | } | ||
| 89 | } | ||
| 90 | } \ No newline at end of file | ||
diff --git a/src/WixToolset.Data/Symbols/WixPatchSymbol.cs b/src/WixToolset.Data/Symbols/WixPatchSymbol.cs new file mode 100644 index 00000000..3f1f20bb --- /dev/null +++ b/src/WixToolset.Data/Symbols/WixPatchSymbol.cs | |||
| @@ -0,0 +1,98 @@ | |||
| 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 WixPatchId = new IntermediateSymbolDefinition( | ||
| 10 | SymbolDefinitionType.WixPatch, | ||
| 11 | new[] | ||
| 12 | { | ||
| 13 | new IntermediateFieldDefinition(nameof(WixPatchSymbolFields.ClientPatchId), IntermediateFieldType.String), | ||
| 14 | new IntermediateFieldDefinition(nameof(WixPatchSymbolFields.OptimizePatchSizeForLargeFiles), IntermediateFieldType.Bool), | ||
| 15 | new IntermediateFieldDefinition(nameof(WixPatchSymbolFields.ApiPatchingSymbolFlags), IntermediateFieldType.Number), | ||
| 16 | new IntermediateFieldDefinition(nameof(WixPatchSymbolFields.Codepage), IntermediateFieldType.String), | ||
| 17 | }, | ||
| 18 | typeof(WixPatchSymbol)); | ||
| 19 | } | ||
| 20 | } | ||
| 21 | |||
| 22 | namespace WixToolset.Data.Symbols | ||
| 23 | { | ||
| 24 | using System; | ||
| 25 | |||
| 26 | public enum WixPatchSymbolFields | ||
| 27 | { | ||
| 28 | ClientPatchId, | ||
| 29 | OptimizePatchSizeForLargeFiles, | ||
| 30 | ApiPatchingSymbolFlags, | ||
| 31 | Codepage, | ||
| 32 | } | ||
| 33 | |||
| 34 | /// <summary> | ||
| 35 | /// The following flags are used with PATCH_OPTION_DATA SymbolOptionFlags: | ||
| 36 | /// </summary> | ||
| 37 | [Flags] | ||
| 38 | [CLSCompliant(false)] | ||
| 39 | public enum PatchSymbolFlags : uint | ||
| 40 | { | ||
| 41 | /// <summary> | ||
| 42 | /// Don't use imagehlp.dll | ||
| 43 | /// </summary> | ||
| 44 | PatchSymbolNoImagehlp = 0x00000001, | ||
| 45 | |||
| 46 | /// <summary> | ||
| 47 | /// Don't fail patch due to imagehlp failures. | ||
| 48 | /// </summary> | ||
| 49 | PatchSymbolNoFailures = 0x00000002, | ||
| 50 | |||
| 51 | /// <summary> | ||
| 52 | /// After matching decorated symbols, try to match remaining by undecorated names. | ||
| 53 | /// </summary> | ||
| 54 | PatchSymbolUndecoratedToo = 0x00000004, | ||
| 55 | |||
| 56 | /// <summary> | ||
| 57 | /// (used internally) | ||
| 58 | /// </summary> | ||
| 59 | PatchSymbolReserved = 0x80000000, | ||
| 60 | } | ||
| 61 | |||
| 62 | public class WixPatchSymbol : IntermediateSymbol | ||
| 63 | { | ||
| 64 | public WixPatchSymbol() : base(SymbolDefinitions.WixPatchId, null, null) | ||
| 65 | { | ||
| 66 | } | ||
| 67 | |||
| 68 | public WixPatchSymbol(SourceLineNumber sourceLineNumber, Identifier id = null) : base(SymbolDefinitions.WixPatchId, sourceLineNumber, id) | ||
| 69 | { | ||
| 70 | } | ||
| 71 | |||
| 72 | public IntermediateField this[WixPatchSymbolFields index] => this.Fields[(int)index]; | ||
| 73 | |||
| 74 | public string ClientPatchId | ||
| 75 | { | ||
| 76 | get => (string)this.Fields[(int)WixPatchSymbolFields.ClientPatchId]; | ||
| 77 | set => this.Set((int)WixPatchSymbolFields.ClientPatchId, value); | ||
| 78 | } | ||
| 79 | |||
| 80 | public bool? OptimizePatchSizeForLargeFiles | ||
| 81 | { | ||
| 82 | get => (bool?)this.Fields[(int)WixPatchSymbolFields.OptimizePatchSizeForLargeFiles]; | ||
| 83 | set => this.Set((int)WixPatchSymbolFields.OptimizePatchSizeForLargeFiles, value); | ||
| 84 | } | ||
| 85 | |||
| 86 | public int? ApiPatchingSymbolFlags | ||
| 87 | { | ||
| 88 | get => (int?)this.Fields[(int)WixPatchSymbolFields.ApiPatchingSymbolFlags]; | ||
| 89 | set => this.Set((int)WixPatchSymbolFields.ApiPatchingSymbolFlags, value); | ||
| 90 | } | ||
| 91 | |||
| 92 | public string Codepage | ||
| 93 | { | ||
| 94 | get => (string)this.Fields[(int)WixPatchSymbolFields.Codepage]; | ||
| 95 | set => this.Set((int)WixPatchSymbolFields.Codepage, value); | ||
| 96 | } | ||
| 97 | } | ||
| 98 | } \ No newline at end of file | ||
diff --git a/src/WixToolset.Data/WindowsInstaller/WindowsInstallerTableDefinitions.cs b/src/WixToolset.Data/WindowsInstaller/WindowsInstallerTableDefinitions.cs index dab5ed02..a64593ec 100644 --- a/src/WixToolset.Data/WindowsInstaller/WindowsInstallerTableDefinitions.cs +++ b/src/WixToolset.Data/WindowsInstaller/WindowsInstallerTableDefinitions.cs | |||
| @@ -1440,7 +1440,7 @@ namespace WixToolset.Data.WindowsInstaller | |||
| 1440 | 1440 | ||
| 1441 | public static readonly TableDefinition ModuleSignature = new TableDefinition( | 1441 | public static readonly TableDefinition ModuleSignature = new TableDefinition( |
| 1442 | "ModuleSignature", | 1442 | "ModuleSignature", |
| 1443 | SymbolDefinitions.ModuleSignature, | 1443 | SymbolDefinitions.WixModule, |
| 1444 | new[] | 1444 | new[] |
| 1445 | { | 1445 | { |
| 1446 | new ColumnDefinition("ModuleID", ColumnType.String, 72, primaryKey: true, nullable: false, ColumnCategory.Identifier, description: "Module identifier (String.GUID).", modularizeType: ColumnModularizeType.Column), | 1446 | new ColumnDefinition("ModuleID", ColumnType.String, 72, primaryKey: true, nullable: false, ColumnCategory.Identifier, description: "Module identifier (String.GUID).", modularizeType: ColumnModularizeType.Column), |
diff --git a/src/test/WixToolsetTest.Data/SerializeFixture.cs b/src/test/WixToolsetTest.Data/SerializeFixture.cs index ff39cb33..8a65c2d4 100644 --- a/src/test/WixToolsetTest.Data/SerializeFixture.cs +++ b/src/test/WixToolsetTest.Data/SerializeFixture.cs | |||
| @@ -20,7 +20,7 @@ namespace WixToolsetTest.Data | |||
| 20 | { | 20 | { |
| 21 | var sln = new SourceLineNumber("test.wxs", 1); | 21 | var sln = new SourceLineNumber("test.wxs", 1); |
| 22 | 22 | ||
| 23 | var section = new IntermediateSection("test", SectionType.Product, 65001); | 23 | var section = new IntermediateSection("test", SectionType.Product); |
| 24 | 24 | ||
| 25 | section.AddSymbol(new ComponentSymbol(sln, new Identifier(AccessModifier.Global, "TestComponent")) | 25 | section.AddSymbol(new ComponentSymbol(sln, new Identifier(AccessModifier.Global, "TestComponent")) |
| 26 | { | 26 | { |
| @@ -62,7 +62,7 @@ namespace WixToolsetTest.Data | |||
| 62 | public void CanUpdateIntermediate() | 62 | public void CanUpdateIntermediate() |
| 63 | { | 63 | { |
| 64 | var sln = new SourceLineNumber("test.wxs", 1); | 64 | var sln = new SourceLineNumber("test.wxs", 1); |
| 65 | var section = new IntermediateSection("test", SectionType.Product, 65001); | 65 | var section = new IntermediateSection("test", SectionType.Product); |
| 66 | 66 | ||
| 67 | section.AddSymbol(new ComponentSymbol(sln, new Identifier(AccessModifier.Global, "TestComponent")) | 67 | section.AddSymbol(new ComponentSymbol(sln, new Identifier(AccessModifier.Global, "TestComponent")) |
| 68 | { | 68 | { |
| @@ -119,7 +119,7 @@ namespace WixToolsetTest.Data | |||
| 119 | { | 119 | { |
| 120 | var sln = new SourceLineNumber("test.wxs", 1); | 120 | var sln = new SourceLineNumber("test.wxs", 1); |
| 121 | 121 | ||
| 122 | var section = new IntermediateSection("test", SectionType.Product, 65001); | 122 | var section = new IntermediateSection("test", SectionType.Product); |
| 123 | 123 | ||
| 124 | var fieldDefs = new[] | 124 | var fieldDefs = new[] |
| 125 | { | 125 | { |
| @@ -178,7 +178,7 @@ namespace WixToolsetTest.Data | |||
| 178 | symbol.Set(1, 2); | 178 | symbol.Set(1, 2); |
| 179 | symbol.Set(2, true); | 179 | symbol.Set(2, true); |
| 180 | 180 | ||
| 181 | var section = new IntermediateSection("test", SectionType.Product, 65001); | 181 | var section = new IntermediateSection("test", SectionType.Product); |
| 182 | section.AddSymbol(symbol); | 182 | section.AddSymbol(symbol); |
| 183 | 183 | ||
| 184 | var intermediate1 = new Intermediate("TestIntermediate", new[] { section }, null); | 184 | var intermediate1 = new Intermediate("TestIntermediate", new[] { section }, null); |
| @@ -200,7 +200,7 @@ namespace WixToolsetTest.Data | |||
| 200 | symbol2.Set(2, false); | 200 | symbol2.Set(2, false); |
| 201 | symbol2.Set(3, "baz"); | 201 | symbol2.Set(3, "baz"); |
| 202 | 202 | ||
| 203 | var section2 = new IntermediateSection("test2", SectionType.Fragment, 65001); | 203 | var section2 = new IntermediateSection("test2", SectionType.Fragment); |
| 204 | section2.AddSymbol(symbol2); | 204 | section2.AddSymbol(symbol2); |
| 205 | 205 | ||
| 206 | var intermediate2 = new Intermediate("TestIntermediate2", new[] { section2 }, null); | 206 | var intermediate2 = new Intermediate("TestIntermediate2", new[] { section2 }, null); |
| @@ -261,7 +261,7 @@ namespace WixToolsetTest.Data | |||
| 261 | 261 | ||
| 262 | symbol.AddTag("symbol1tag"); | 262 | symbol.AddTag("symbol1tag"); |
| 263 | 263 | ||
| 264 | var section = new IntermediateSection("test", SectionType.Product, 65001); | 264 | var section = new IntermediateSection("test", SectionType.Product); |
| 265 | section.AddSymbol(symbol); | 265 | section.AddSymbol(symbol); |
| 266 | 266 | ||
| 267 | var intermediate1 = new Intermediate("TestIntermediate", new[] { section }, null); | 267 | var intermediate1 = new Intermediate("TestIntermediate", new[] { section }, null); |
| @@ -289,7 +289,7 @@ namespace WixToolsetTest.Data | |||
| 289 | symbol2.AddTag("symbol2tag1"); | 289 | symbol2.AddTag("symbol2tag1"); |
| 290 | symbol2.AddTag("symbol2tag2"); | 290 | symbol2.AddTag("symbol2tag2"); |
| 291 | 291 | ||
| 292 | var section2 = new IntermediateSection("test2", SectionType.Fragment, 65001); | 292 | var section2 = new IntermediateSection("test2", SectionType.Fragment); |
| 293 | section2.AddSymbol(symbol2); | 293 | section2.AddSymbol(symbol2); |
| 294 | 294 | ||
| 295 | var intermediate2 = new Intermediate("TestIntermediate2", new[] { section2 }, null); | 295 | var intermediate2 = new Intermediate("TestIntermediate2", new[] { section2 }, null); |
| @@ -351,10 +351,10 @@ namespace WixToolsetTest.Data | |||
| 351 | 351 | ||
| 352 | var localizations = new[] | 352 | var localizations = new[] |
| 353 | { | 353 | { |
| 354 | new Localization(65001, null, bindVariables.ToDictionary(b => b.Id), controls.ToDictionary(c => c.GetKey())) | 354 | new Localization(65001, 1252, null, bindVariables.ToDictionary(b => b.Id), controls.ToDictionary(c => c.GetKey())) |
| 355 | }; | 355 | }; |
| 356 | 356 | ||
| 357 | var section = new IntermediateSection("test", SectionType.Product, 65001); | 357 | var section = new IntermediateSection("test", SectionType.Product); |
| 358 | 358 | ||
| 359 | section.AddSymbol(new ComponentSymbol(sln, new Identifier(AccessModifier.Global, "TestComponent")) | 359 | section.AddSymbol(new ComponentSymbol(sln, new Identifier(AccessModifier.Global, "TestComponent")) |
| 360 | { | 360 | { |
