diff options
Diffstat (limited to 'src/WixToolset.Core/Bind/Databases/CreateSpecialPropertiesCommand.cs')
| -rw-r--r-- | src/WixToolset.Core/Bind/Databases/CreateSpecialPropertiesCommand.cs | 68 |
1 files changed, 68 insertions, 0 deletions
diff --git a/src/WixToolset.Core/Bind/Databases/CreateSpecialPropertiesCommand.cs b/src/WixToolset.Core/Bind/Databases/CreateSpecialPropertiesCommand.cs new file mode 100644 index 00000000..5db2768b --- /dev/null +++ b/src/WixToolset.Core/Bind/Databases/CreateSpecialPropertiesCommand.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.Bind.Databases | ||
| 4 | { | ||
| 5 | using System; | ||
| 6 | using System.Collections.Generic; | ||
| 7 | using WixToolset.Data; | ||
| 8 | using WixToolset.Data.Rows; | ||
| 9 | |||
| 10 | internal class CreateSpecialPropertiesCommand : ICommand | ||
| 11 | { | ||
| 12 | public Table PropertyTable { private get; set; } | ||
| 13 | |||
| 14 | public Table WixPropertyTable { private get; set; } | ||
| 15 | |||
| 16 | public void Execute() | ||
| 17 | { | ||
| 18 | // Create the special properties. | ||
| 19 | if (null != this.WixPropertyTable) | ||
| 20 | { | ||
| 21 | // Create lists of the properties that contribute to the special lists of properties. | ||
| 22 | SortedSet<string> adminProperties = new SortedSet<string>(); | ||
| 23 | SortedSet<string> secureProperties = new SortedSet<string>(); | ||
| 24 | SortedSet<string> hiddenProperties = new SortedSet<string>(); | ||
| 25 | |||
| 26 | foreach (WixPropertyRow wixPropertyRow in this.WixPropertyTable.Rows) | ||
| 27 | { | ||
| 28 | if (wixPropertyRow.Admin) | ||
| 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 | } | ||
| 43 | |||
| 44 | Table propertyTable = this.PropertyTable; | ||
| 45 | if (0 < adminProperties.Count) | ||
| 46 | { | ||
| 47 | PropertyRow row = (PropertyRow)propertyTable.CreateRow(null); | ||
| 48 | row.Property = "AdminProperties"; | ||
| 49 | row.Value = String.Join(";", adminProperties); | ||
| 50 | } | ||
| 51 | |||
| 52 | if (0 < secureProperties.Count) | ||
| 53 | { | ||
| 54 | PropertyRow row = (PropertyRow)propertyTable.CreateRow(null); | ||
| 55 | row.Property = "SecureCustomProperties"; | ||
| 56 | row.Value = String.Join(";", secureProperties); | ||
| 57 | } | ||
| 58 | |||
| 59 | if (0 < hiddenProperties.Count) | ||
| 60 | { | ||
| 61 | PropertyRow row = (PropertyRow)propertyTable.CreateRow(null); | ||
| 62 | row.Property = "MsiHiddenProperties"; | ||
| 63 | row.Value = String.Join(";", hiddenProperties); | ||
| 64 | } | ||
| 65 | } | ||
| 66 | } | ||
| 67 | } | ||
| 68 | } | ||
