diff options
author | Bob Arnson <bob@joyofsetup.com> | 2019-10-28 21:17:09 -0400 |
---|---|---|
committer | Bob Arnson <bob@firegiant.com> | 2019-10-28 21:22:25 -0400 |
commit | 7a934bcfb8d460b0cf91a51caa956a8bbff14edf (patch) | |
tree | 861e5cc38b9ee762d8de1e679f65ec305d52c5f5 /src/wixext | |
parent | cc153493c432de282ad7297c7e674340829caf7f (diff) | |
download | wix-7a934bcfb8d460b0cf91a51caa956a8bbff14edf.tar.gz wix-7a934bcfb8d460b0cf91a51caa956a8bbff14edf.tar.bz2 wix-7a934bcfb8d460b0cf91a51caa956a8bbff14edf.zip |
Modernize tuple creation and update dependencies.
Diffstat (limited to 'src/wixext')
-rw-r--r-- | src/wixext/FirewallCompiler.cs | 33 | ||||
-rw-r--r-- | src/wixext/FirewallWindowsInstallerBackendExtension.cs | 5 | ||||
-rw-r--r-- | src/wixext/Tuples/FirewallTupleDefinitions.cs | 3 | ||||
-rw-r--r-- | src/wixext/Tuples/WixFirewallExceptionTuple.cs | 19 | ||||
-rw-r--r-- | src/wixext/tables.xml | 2 |
5 files changed, 27 insertions, 35 deletions
diff --git a/src/wixext/FirewallCompiler.cs b/src/wixext/FirewallCompiler.cs index 0696b4b1..353afff3 100644 --- a/src/wixext/FirewallCompiler.cs +++ b/src/wixext/FirewallCompiler.cs | |||
@@ -4,10 +4,10 @@ namespace WixToolset.Firewall | |||
4 | { | 4 | { |
5 | using System; | 5 | using System; |
6 | using System.Collections.Generic; | 6 | using System.Collections.Generic; |
7 | using System.Globalization; | ||
8 | using System.Xml.Linq; | 7 | using System.Xml.Linq; |
9 | using WixToolset.Data; | 8 | using WixToolset.Data; |
10 | using WixToolset.Extensibility; | 9 | using WixToolset.Extensibility; |
10 | using WixToolset.Firewall.Tuples; | ||
11 | 11 | ||
12 | /// <summary> | 12 | /// <summary> |
13 | /// The compiler for the WiX Toolset Firewall Extension. | 13 | /// The compiler for the WiX Toolset Firewall Extension. |
@@ -255,13 +255,18 @@ namespace WixToolset.Firewall | |||
255 | fileId = file; | 255 | fileId = file; |
256 | } | 256 | } |
257 | 257 | ||
258 | var row = this.ParseHelper.CreateRow(section, sourceLineNumbers, "WixFirewallException", id); | 258 | var tuple = new WixFirewallExceptionTuple(sourceLineNumbers, id) |
259 | row.Set(1, name); | 259 | { |
260 | row.Set(2, remoteAddresses); | 260 | Name = name, |
261 | RemoteAddresses = remoteAddresses, | ||
262 | Profile = profile ?? FirewallConstants.NET_FW_PROFILE2_ALL, | ||
263 | ComponentRef = componentId, | ||
264 | Description = description, | ||
265 | }; | ||
261 | 266 | ||
262 | if (!String.IsNullOrEmpty(port)) | 267 | if (!String.IsNullOrEmpty(port)) |
263 | { | 268 | { |
264 | row.Set(3, port); | 269 | tuple.Port = port; |
265 | 270 | ||
266 | if (!protocol.HasValue) | 271 | if (!protocol.HasValue) |
267 | { | 272 | { |
@@ -270,32 +275,24 @@ namespace WixToolset.Firewall | |||
270 | } | 275 | } |
271 | } | 276 | } |
272 | 277 | ||
273 | if (protocol.HasValue) | 278 | tuple.Protocol = protocol.Value; |
274 | { | ||
275 | row.Set(4, protocol); | ||
276 | } | ||
277 | 279 | ||
278 | if (!String.IsNullOrEmpty(fileId)) | 280 | if (!String.IsNullOrEmpty(fileId)) |
279 | { | 281 | { |
280 | row.Set(5, $"[#{fileId}]"); | 282 | tuple.Program = $"[#{fileId}]"; |
281 | this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, "File", fileId); | 283 | this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, "File", fileId); |
282 | } | 284 | } |
283 | else if (!String.IsNullOrEmpty(program)) | 285 | else if (!String.IsNullOrEmpty(program)) |
284 | { | 286 | { |
285 | row.Set(5, program); | 287 | tuple.Program = program; |
286 | } | 288 | } |
287 | 289 | ||
288 | if (CompilerConstants.IntegerNotSet != attributes) | 290 | if (CompilerConstants.IntegerNotSet != attributes) |
289 | { | 291 | { |
290 | row.Set(6, attributes); | 292 | tuple.Attributes = attributes; |
291 | } | 293 | } |
292 | 294 | ||
293 | // Default is "all" | 295 | section.Tuples.Add(tuple); |
294 | row.Set(7, profile ?? FirewallConstants.NET_FW_PROFILE2_ALL); | ||
295 | |||
296 | row.Set(8, componentId); | ||
297 | |||
298 | row.Set(9, description); | ||
299 | 296 | ||
300 | if (this.Context.Platform == Platform.ARM) | 297 | if (this.Context.Platform == Platform.ARM) |
301 | { | 298 | { |
diff --git a/src/wixext/FirewallWindowsInstallerBackendExtension.cs b/src/wixext/FirewallWindowsInstallerBackendExtension.cs index a3949e69..47a01ac0 100644 --- a/src/wixext/FirewallWindowsInstallerBackendExtension.cs +++ b/src/wixext/FirewallWindowsInstallerBackendExtension.cs | |||
@@ -1,9 +1,10 @@ | |||
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. | 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 | 2 | ||
3 | namespace WixToolset.Firewall | 3 | namespace WixToolset.Firewall |
4 | { | 4 | { |
5 | using System.Linq; | 5 | using System.Linq; |
6 | using System.Xml; | 6 | using System.Xml; |
7 | using WixToolset.Data; | ||
7 | using WixToolset.Data.WindowsInstaller; | 8 | using WixToolset.Data.WindowsInstaller; |
8 | using WixToolset.Extensibility; | 9 | using WixToolset.Extensibility; |
9 | 10 | ||
@@ -13,6 +14,8 @@ namespace WixToolset.Firewall | |||
13 | 14 | ||
14 | protected override TableDefinition[] TableDefinitionsForTuples => Tables; | 15 | protected override TableDefinition[] TableDefinitionsForTuples => Tables; |
15 | 16 | ||
17 | public override bool TryAddTupleToOutput(IntermediateTuple tuple, WindowsInstallerData output) => this.BackendHelper.TryAddTupleToOutputMatchingTableDefinitions(tuple, output, this.TableDefinitionsForTuples, true); | ||
18 | |||
16 | private static TableDefinition[] LoadTables() | 19 | private static TableDefinition[] LoadTables() |
17 | { | 20 | { |
18 | using (var resourceStream = typeof(FirewallWindowsInstallerBackendBinderExtension).Assembly.GetManifestResourceStream("WixToolset.Firewall.tables.xml")) | 21 | using (var resourceStream = typeof(FirewallWindowsInstallerBackendBinderExtension).Assembly.GetManifestResourceStream("WixToolset.Firewall.tables.xml")) |
diff --git a/src/wixext/Tuples/FirewallTupleDefinitions.cs b/src/wixext/Tuples/FirewallTupleDefinitions.cs index 79fc28cf..df595c18 100644 --- a/src/wixext/Tuples/FirewallTupleDefinitions.cs +++ b/src/wixext/Tuples/FirewallTupleDefinitions.cs | |||
@@ -15,7 +15,6 @@ namespace WixToolset.Firewall.Tuples | |||
15 | FirewallTupleDefinitionNames.WixFirewallException, | 15 | FirewallTupleDefinitionNames.WixFirewallException, |
16 | new[] | 16 | new[] |
17 | { | 17 | { |
18 | new IntermediateFieldDefinition(nameof(WixFirewallExceptionTupleFields.WixFirewallException), IntermediateFieldType.String), | ||
19 | new IntermediateFieldDefinition(nameof(WixFirewallExceptionTupleFields.Name), IntermediateFieldType.String), | 18 | new IntermediateFieldDefinition(nameof(WixFirewallExceptionTupleFields.Name), IntermediateFieldType.String), |
20 | new IntermediateFieldDefinition(nameof(WixFirewallExceptionTupleFields.RemoteAddresses), IntermediateFieldType.String), | 19 | new IntermediateFieldDefinition(nameof(WixFirewallExceptionTupleFields.RemoteAddresses), IntermediateFieldType.String), |
21 | new IntermediateFieldDefinition(nameof(WixFirewallExceptionTupleFields.Port), IntermediateFieldType.String), | 20 | new IntermediateFieldDefinition(nameof(WixFirewallExceptionTupleFields.Port), IntermediateFieldType.String), |
@@ -23,7 +22,7 @@ namespace WixToolset.Firewall.Tuples | |||
23 | new IntermediateFieldDefinition(nameof(WixFirewallExceptionTupleFields.Program), IntermediateFieldType.String), | 22 | new IntermediateFieldDefinition(nameof(WixFirewallExceptionTupleFields.Program), IntermediateFieldType.String), |
24 | new IntermediateFieldDefinition(nameof(WixFirewallExceptionTupleFields.Attributes), IntermediateFieldType.Number), | 23 | new IntermediateFieldDefinition(nameof(WixFirewallExceptionTupleFields.Attributes), IntermediateFieldType.Number), |
25 | new IntermediateFieldDefinition(nameof(WixFirewallExceptionTupleFields.Profile), IntermediateFieldType.Number), | 24 | new IntermediateFieldDefinition(nameof(WixFirewallExceptionTupleFields.Profile), IntermediateFieldType.Number), |
26 | new IntermediateFieldDefinition(nameof(WixFirewallExceptionTupleFields.Component_), IntermediateFieldType.String), | 25 | new IntermediateFieldDefinition(nameof(WixFirewallExceptionTupleFields.ComponentRef), IntermediateFieldType.String), |
27 | new IntermediateFieldDefinition(nameof(WixFirewallExceptionTupleFields.Description), IntermediateFieldType.String), | 26 | new IntermediateFieldDefinition(nameof(WixFirewallExceptionTupleFields.Description), IntermediateFieldType.String), |
28 | }, | 27 | }, |
29 | typeof(WixFirewallExceptionTuple)); | 28 | typeof(WixFirewallExceptionTuple)); |
diff --git a/src/wixext/Tuples/WixFirewallExceptionTuple.cs b/src/wixext/Tuples/WixFirewallExceptionTuple.cs index 715a4b9b..3c7cda3a 100644 --- a/src/wixext/Tuples/WixFirewallExceptionTuple.cs +++ b/src/wixext/Tuples/WixFirewallExceptionTuple.cs | |||
@@ -6,7 +6,6 @@ namespace WixToolset.Firewall.Tuples | |||
6 | 6 | ||
7 | public enum WixFirewallExceptionTupleFields | 7 | public enum WixFirewallExceptionTupleFields |
8 | { | 8 | { |
9 | WixFirewallException, | ||
10 | Name, | 9 | Name, |
11 | RemoteAddresses, | 10 | RemoteAddresses, |
12 | Port, | 11 | Port, |
@@ -14,7 +13,7 @@ namespace WixToolset.Firewall.Tuples | |||
14 | Program, | 13 | Program, |
15 | Attributes, | 14 | Attributes, |
16 | Profile, | 15 | Profile, |
17 | Component_, | 16 | ComponentRef, |
18 | Description, | 17 | Description, |
19 | } | 18 | } |
20 | 19 | ||
@@ -30,12 +29,6 @@ namespace WixToolset.Firewall.Tuples | |||
30 | 29 | ||
31 | public IntermediateField this[WixFirewallExceptionTupleFields index] => this.Fields[(int)index]; | 30 | public IntermediateField this[WixFirewallExceptionTupleFields index] => this.Fields[(int)index]; |
32 | 31 | ||
33 | public string WixFirewallException | ||
34 | { | ||
35 | get => this.Fields[(int)WixFirewallExceptionTupleFields.WixFirewallException].AsString(); | ||
36 | set => this.Set((int)WixFirewallExceptionTupleFields.WixFirewallException, value); | ||
37 | } | ||
38 | |||
39 | public string Name | 32 | public string Name |
40 | { | 33 | { |
41 | get => this.Fields[(int)WixFirewallExceptionTupleFields.Name].AsString(); | 34 | get => this.Fields[(int)WixFirewallExceptionTupleFields.Name].AsString(); |
@@ -54,9 +47,9 @@ namespace WixToolset.Firewall.Tuples | |||
54 | set => this.Set((int)WixFirewallExceptionTupleFields.Port, value); | 47 | set => this.Set((int)WixFirewallExceptionTupleFields.Port, value); |
55 | } | 48 | } |
56 | 49 | ||
57 | public int Protocol | 50 | public int? Protocol |
58 | { | 51 | { |
59 | get => this.Fields[(int)WixFirewallExceptionTupleFields.Protocol].AsNumber(); | 52 | get => this.Fields[(int)WixFirewallExceptionTupleFields.Protocol].AsNullableNumber(); |
60 | set => this.Set((int)WixFirewallExceptionTupleFields.Protocol, value); | 53 | set => this.Set((int)WixFirewallExceptionTupleFields.Protocol, value); |
61 | } | 54 | } |
62 | 55 | ||
@@ -78,10 +71,10 @@ namespace WixToolset.Firewall.Tuples | |||
78 | set => this.Set((int)WixFirewallExceptionTupleFields.Profile, value); | 71 | set => this.Set((int)WixFirewallExceptionTupleFields.Profile, value); |
79 | } | 72 | } |
80 | 73 | ||
81 | public string Component_ | 74 | public string ComponentRef |
82 | { | 75 | { |
83 | get => this.Fields[(int)WixFirewallExceptionTupleFields.Component_].AsString(); | 76 | get => this.Fields[(int)WixFirewallExceptionTupleFields.ComponentRef].AsString(); |
84 | set => this.Set((int)WixFirewallExceptionTupleFields.Component_, value); | 77 | set => this.Set((int)WixFirewallExceptionTupleFields.ComponentRef, value); |
85 | } | 78 | } |
86 | 79 | ||
87 | public string Description | 80 | public string Description |
diff --git a/src/wixext/tables.xml b/src/wixext/tables.xml index 5b408b96..b0c32305 100644 --- a/src/wixext/tables.xml +++ b/src/wixext/tables.xml | |||
@@ -17,7 +17,7 @@ | |||
17 | <columnDefinition name="Program" type="string" length="255" nullable="yes" modularize="property" | 17 | <columnDefinition name="Program" type="string" length="255" nullable="yes" modularize="property" |
18 | category="formatted" description="Exception for a program (formatted path name)." /> | 18 | category="formatted" description="Exception for a program (formatted path name)." /> |
19 | <columnDefinition name="Attributes" type="number" length="4" nullable="yes" | 19 | <columnDefinition name="Attributes" type="number" length="4" nullable="yes" |
20 | minValue="0" maxValue="65536" description="Vital=1" /> | 20 | description="Vital=1" /> |
21 | <columnDefinition name="Profile" type="number" length="4" nullable="no" | 21 | <columnDefinition name="Profile" type="number" length="4" nullable="no" |
22 | category="integer" minValue="1" maxValue="2147483647" description="Profile (1=domain; 2=private; 4=public; 2147483647=all)." /> | 22 | category="integer" minValue="1" maxValue="2147483647" description="Profile (1=domain; 2=private; 4=public; 2147483647=all)." /> |
23 | <columnDefinition name="Component_" type="string" length="72" modularize="column" | 23 | <columnDefinition name="Component_" type="string" length="72" modularize="column" |