aboutsummaryrefslogtreecommitdiff
path: root/src/wixext
diff options
context:
space:
mode:
authorSean Hall <r.sean.hall@gmail.com>2020-04-05 21:27:11 +1000
committerSean Hall <r.sean.hall@gmail.com>2020-04-05 21:51:07 +1000
commitaecff401f974f603cb78b8a665000b2a93490e80 (patch)
treeeb7e442f26e17cb81e7f232de145d22fdcace0eb /src/wixext
parent057da4cedb151761c4a8cbfe9c1899315c8a3b05 (diff)
downloadwix-aecff401f974f603cb78b8a665000b2a93490e80.tar.gz
wix-aecff401f974f603cb78b8a665000b2a93490e80.tar.bz2
wix-aecff401f974f603cb78b8a665000b2a93490e80.zip
Modernize NetfxCompiler and table definitions.
Diffstat (limited to 'src/wixext')
-rw-r--r--src/wixext/NetFxCompiler.cs12
-rw-r--r--src/wixext/NetfxTableDefinitions.cs29
-rw-r--r--src/wixext/NetfxWindowsInstallerBackendExtension.cs18
3 files changed, 36 insertions, 23 deletions
diff --git a/src/wixext/NetFxCompiler.cs b/src/wixext/NetFxCompiler.cs
index 4916994e..58c8c0f6 100644
--- a/src/wixext/NetFxCompiler.cs
+++ b/src/wixext/NetFxCompiler.cs
@@ -53,14 +53,14 @@ namespace WixToolset.Netfx
53 /// <param name="fileId">The file identifier of the parent element.</param> 53 /// <param name="fileId">The file identifier of the parent element.</param>
54 private void ParseNativeImageElement(Intermediate intermediate, IntermediateSection section, XElement element, string fileId) 54 private void ParseNativeImageElement(Intermediate intermediate, IntermediateSection section, XElement element, string fileId)
55 { 55 {
56 SourceLineNumber sourceLineNumbers = this.ParseHelper.GetSourceLineNumbers(element); 56 var sourceLineNumbers = this.ParseHelper.GetSourceLineNumbers(element);
57 Identifier id = null; 57 Identifier id = null;
58 string appBaseDirectory = null; 58 string appBaseDirectory = null;
59 string assemblyApplication = null; 59 string assemblyApplication = null;
60 int attributes = 0x8; // 32bit is on by default 60 int attributes = 0x8; // 32bit is on by default
61 int priority = 3; 61 int priority = 3;
62 62
63 foreach (XAttribute attrib in element.Attributes()) 63 foreach (var attrib in element.Attributes())
64 { 64 {
65 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || this.Namespace == attrib.Name.Namespace) 65 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || this.Namespace == attrib.Name.Namespace)
66 { 66 {
@@ -75,7 +75,7 @@ namespace WixToolset.Netfx
75 // See if a formatted value is specified. 75 // See if a formatted value is specified.
76 if (-1 == appBaseDirectory.IndexOf("[", StringComparison.Ordinal)) 76 if (-1 == appBaseDirectory.IndexOf("[", StringComparison.Ordinal))
77 { 77 {
78 this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, "Directory", appBaseDirectory); 78 this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, TupleDefinitions.Directory, appBaseDirectory);
79 } 79 }
80 break; 80 break;
81 case "AssemblyApplication": 81 case "AssemblyApplication":
@@ -84,7 +84,7 @@ namespace WixToolset.Netfx
84 // See if a formatted value is specified. 84 // See if a formatted value is specified.
85 if (-1 == assemblyApplication.IndexOf("[", StringComparison.Ordinal)) 85 if (-1 == assemblyApplication.IndexOf("[", StringComparison.Ordinal))
86 { 86 {
87 this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, "File", assemblyApplication); 87 this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, TupleDefinitions.File, assemblyApplication);
88 } 88 }
89 break; 89 break;
90 case "Debug": 90 case "Debug":
@@ -140,7 +140,7 @@ namespace WixToolset.Netfx
140 140
141 if (null == id) 141 if (null == id)
142 { 142 {
143 this.Messaging.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, element.Name.LocalName, "Id")); 143 id = this.ParseHelper.CreateIdentifier("nni", fileId);
144 } 144 }
145 145
146 this.ParseHelper.ParseForExtensionElements(this.Context.Extensions, intermediate, section, element); 146 this.ParseHelper.ParseForExtensionElements(this.Context.Extensions, intermediate, section, element);
@@ -149,7 +149,7 @@ namespace WixToolset.Netfx
149 149
150 if (!this.Messaging.EncounteredError) 150 if (!this.Messaging.EncounteredError)
151 { 151 {
152 section.Tuples.Add(new NetFxNativeImageTuple(sourceLineNumbers, id) 152 section.AddTuple(new NetFxNativeImageTuple(sourceLineNumbers, id)
153 { 153 {
154 FileRef = fileId, 154 FileRef = fileId,
155 Priority = priority, 155 Priority = priority,
diff --git a/src/wixext/NetfxTableDefinitions.cs b/src/wixext/NetfxTableDefinitions.cs
new file mode 100644
index 00000000..378f6def
--- /dev/null
+++ b/src/wixext/NetfxTableDefinitions.cs
@@ -0,0 +1,29 @@
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
3namespace WixToolset.Netfx
4{
5 using WixToolset.Data.WindowsInstaller;
6
7 public static class NetfxTableDefinitions
8 {
9 public static readonly TableDefinition NetFxNativeImage = new TableDefinition(
10 "Wix4NetFxNativeImage",
11 new[]
12 {
13 new ColumnDefinition("Wix4NetFxNativeImage", ColumnType.String, 72, primaryKey: true, nullable: false, ColumnCategory.Identifier, description: "The primary key, a non-localized token.", modularizeType: ColumnModularizeType.Column),
14 new ColumnDefinition("File_", ColumnType.String, 72, primaryKey: false, nullable: false, ColumnCategory.Identifier, keyTable: "File", keyColumn: 1, description: "The assembly for which a native image will be generated.", modularizeType: ColumnModularizeType.Column),
15 new ColumnDefinition("Priority", ColumnType.Number, 2, primaryKey: false, nullable: false, ColumnCategory.Integer, minValue: 0, maxValue: 3, description: "The priority for generating this native image: 0 is syncronous, 1-3 represent various levels of queued generation."),
16 new ColumnDefinition("Attributes", ColumnType.Number, 4, primaryKey: false, nullable: false, ColumnCategory.Integer, minValue: 0, maxValue: 2147483647, description: "Integer containing bit flags representing native image attributes."),
17 new ColumnDefinition("File_Application", ColumnType.String, 72, primaryKey: false, nullable: true, ColumnCategory.Formatted, description: "The application which loads this assembly.", modularizeType: ColumnModularizeType.Column),
18 new ColumnDefinition("Directory_ApplicationBase", ColumnType.String, 72, primaryKey: false, nullable: true, ColumnCategory.Formatted, description: "The directory containing the application which loads this assembly.", modularizeType: ColumnModularizeType.Column),
19 },
20 tupleDefinitionName: "NetFxNativeImage",
21 tupleIdIsPrimaryKey: true
22 );
23
24 public static readonly TableDefinition[] All = new[]
25 {
26 NetFxNativeImage,
27 };
28 }
29}
diff --git a/src/wixext/NetfxWindowsInstallerBackendExtension.cs b/src/wixext/NetfxWindowsInstallerBackendExtension.cs
index 7e30d396..e1404c1a 100644
--- a/src/wixext/NetfxWindowsInstallerBackendExtension.cs
+++ b/src/wixext/NetfxWindowsInstallerBackendExtension.cs
@@ -8,22 +8,6 @@ namespace WixToolset.Netfx
8 8
9 public class NetfxWindowsInstallerBackendBinderExtension : BaseWindowsInstallerBackendBinderExtension 9 public class NetfxWindowsInstallerBackendBinderExtension : BaseWindowsInstallerBackendBinderExtension
10 { 10 {
11 private static readonly TableDefinition[] Tables = new[] { 11 public override IEnumerable<TableDefinition> TableDefinitions => NetfxTableDefinitions.All;
12 new TableDefinition(
13 "Wix4NetFxNativeImage",
14 "NetFxNativeImage",
15 new[]
16 {
17 new ColumnDefinition("Wix4NetFxNativeImage", ColumnType.String, 72, true, false, ColumnCategory.Identifier, description: "The primary key, a non-localized token."),
18 new ColumnDefinition("File_", ColumnType.String, 0, false, false, ColumnCategory.Identifier, keyTable:"File", keyColumn: 1, description: "The assembly for which a native image will be generated."),
19 new ColumnDefinition("Priority", ColumnType.Number, 2, false, false, ColumnCategory.Integer, maxValue: 3, description: "The priority for generating this native image: 0 is syncronous, 1-3 represent various levels of queued generation."),
20 new ColumnDefinition("Attributes", ColumnType.Number, 4, false, false, ColumnCategory.Integer, maxValue: 2147483647, description: "Integer containing bit flags representing native image attributes."),
21 new ColumnDefinition("File_Application", ColumnType.String, 72, false, true, ColumnCategory.Formatted, description: "The application which loads this assembly."),
22 new ColumnDefinition("Directory_ApplicationBase", ColumnType.String, 72, false, true, ColumnCategory.Formatted, description: "The directory containing the application which loads this assembly."),
23 }
24 ),
25 };
26
27 public override IEnumerable<TableDefinition> TableDefinitions { get => Tables; }
28 } 12 }
29} 13}