aboutsummaryrefslogtreecommitdiff
path: root/src/WixToolset.Core.WindowsInstaller/Bind/CreateSpecialPropertiesCommand.cs
diff options
context:
space:
mode:
Diffstat (limited to 'src/WixToolset.Core.WindowsInstaller/Bind/CreateSpecialPropertiesCommand.cs')
-rw-r--r--src/WixToolset.Core.WindowsInstaller/Bind/CreateSpecialPropertiesCommand.cs87
1 files changed, 46 insertions, 41 deletions
diff --git a/src/WixToolset.Core.WindowsInstaller/Bind/CreateSpecialPropertiesCommand.cs b/src/WixToolset.Core.WindowsInstaller/Bind/CreateSpecialPropertiesCommand.cs
index aef130b0..ab2e8201 100644
--- a/src/WixToolset.Core.WindowsInstaller/Bind/CreateSpecialPropertiesCommand.cs
+++ b/src/WixToolset.Core.WindowsInstaller/Bind/CreateSpecialPropertiesCommand.cs
@@ -1,67 +1,72 @@
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
3namespace WixToolset.Core.WindowsInstaller.Databases 3namespace WixToolset.Core.WindowsInstaller.Bind
4{ 4{
5 using System; 5 using System;
6 using System.Collections.Generic; 6 using System.Collections.Generic;
7 using System.Linq;
7 using WixToolset.Data; 8 using WixToolset.Data;
8 using WixToolset.Data.Rows; 9 using WixToolset.Data.Tuples;
9 10
10 internal class CreateSpecialPropertiesCommand 11 internal class CreateSpecialPropertiesCommand
11 { 12 {
12 public Table PropertyTable { private get; set; } 13 public CreateSpecialPropertiesCommand(IntermediateSection section)
14 {
15 this.Section = section;
16 }
13 17
14 public Table WixPropertyTable { private get; set; } 18 private IntermediateSection Section { get; }
15 19
16 public void Execute() 20 public void Execute()
17 { 21 {
18 // Create the special properties. 22 // Create lists of the properties that contribute to the special lists of properties.
19 if (null != this.WixPropertyTable) 23 SortedSet<string> adminProperties = new SortedSet<string>();
20 { 24 SortedSet<string> secureProperties = new SortedSet<string>();
21 // Create lists of the properties that contribute to the special lists of properties. 25 SortedSet<string> hiddenProperties = new SortedSet<string>();
22 SortedSet<string> adminProperties = new SortedSet<string>();
23 SortedSet<string> secureProperties = new SortedSet<string>();
24 SortedSet<string> hiddenProperties = new SortedSet<string>();
25 26
26 foreach (WixPropertyRow wixPropertyRow in this.WixPropertyTable.Rows) 27 foreach (var wixPropertyRow in this.Section.Tuples.OfType<WixPropertyTuple>())
28 {
29 if (wixPropertyRow.Admin)
27 { 30 {
28 if (wixPropertyRow.Admin) 31 adminProperties.Add(wixPropertyRow.Property_);
29 {
30 adminProperties.Add(wixPropertyRow.Id);
31 }
32
33 if (wixPropertyRow.Hidden)
34 {
35 hiddenProperties.Add(wixPropertyRow.Id);
36 }
37
38 if (wixPropertyRow.Secure)
39 {
40 secureProperties.Add(wixPropertyRow.Id);
41 }
42 } 32 }
43 33
44 Table propertyTable = this.PropertyTable; 34 if (wixPropertyRow.Hidden)
45 if (0 < adminProperties.Count)
46 { 35 {
47 PropertyRow row = (PropertyRow)propertyTable.CreateRow(null); 36 hiddenProperties.Add(wixPropertyRow.Property_);
48 row.Property = "AdminProperties";
49 row.Value = String.Join(";", adminProperties);
50 } 37 }
51 38
52 if (0 < secureProperties.Count) 39 if (wixPropertyRow.Secure)
53 { 40 {
54 PropertyRow row = (PropertyRow)propertyTable.CreateRow(null); 41 secureProperties.Add(wixPropertyRow.Property_);
55 row.Property = "SecureCustomProperties";
56 row.Value = String.Join(";", secureProperties);
57 } 42 }
43 }
58 44
59 if (0 < hiddenProperties.Count) 45 if (0 < adminProperties.Count)
60 { 46 {
61 PropertyRow row = (PropertyRow)propertyTable.CreateRow(null); 47 var tuple = new PropertyTuple(null, new Identifier("AdminProperties", AccessModifier.Private));
62 row.Property = "MsiHiddenProperties"; 48 tuple.Property = "AdminProperties";
63 row.Value = String.Join(";", hiddenProperties); 49 tuple.Value = String.Join(";", adminProperties);
64 } 50
51 this.Section.Tuples.Add(tuple);
52 }
53
54 if (0 < secureProperties.Count)
55 {
56 var tuple = new PropertyTuple(null, new Identifier("SecureCustomProperties", AccessModifier.Private));
57 tuple.Property = "SecureCustomProperties";
58 tuple.Value = String.Join(";", secureProperties);
59
60 this.Section.Tuples.Add(tuple);
61 }
62
63 if (0 < hiddenProperties.Count)
64 {
65 var tuple = new PropertyTuple(null, new Identifier("MsiHiddenProperties", AccessModifier.Private));
66 tuple.Property = "MsiHiddenProperties";
67 tuple.Value = String.Join(";", hiddenProperties);
68
69 this.Section.Tuples.Add(tuple);
65 } 70 }
66 } 71 }
67 } 72 }