From d3d3649a68cb1fa589fdd987a6690dbd5d671f0d Mon Sep 17 00:00:00 2001 From: Rob Mensching Date: Sun, 17 Sep 2017 15:35:20 -0700 Subject: Initial code commit --- .../Databases/CreateSpecialPropertiesCommand.cs | 68 ++++++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 src/WixToolset.Core/Bind/Databases/CreateSpecialPropertiesCommand.cs (limited to 'src/WixToolset.Core/Bind/Databases/CreateSpecialPropertiesCommand.cs') 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 @@ +// 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. + +namespace WixToolset.Bind.Databases +{ + using System; + using System.Collections.Generic; + using WixToolset.Data; + using WixToolset.Data.Rows; + + internal class CreateSpecialPropertiesCommand : ICommand + { + public Table PropertyTable { private get; set; } + + public Table WixPropertyTable { private get; set; } + + public void Execute() + { + // Create the special properties. + if (null != this.WixPropertyTable) + { + // Create lists of the properties that contribute to the special lists of properties. + SortedSet adminProperties = new SortedSet(); + SortedSet secureProperties = new SortedSet(); + SortedSet hiddenProperties = new SortedSet(); + + foreach (WixPropertyRow wixPropertyRow in this.WixPropertyTable.Rows) + { + if (wixPropertyRow.Admin) + { + adminProperties.Add(wixPropertyRow.Id); + } + + if (wixPropertyRow.Hidden) + { + hiddenProperties.Add(wixPropertyRow.Id); + } + + if (wixPropertyRow.Secure) + { + secureProperties.Add(wixPropertyRow.Id); + } + } + + Table propertyTable = this.PropertyTable; + if (0 < adminProperties.Count) + { + PropertyRow row = (PropertyRow)propertyTable.CreateRow(null); + row.Property = "AdminProperties"; + row.Value = String.Join(";", adminProperties); + } + + if (0 < secureProperties.Count) + { + PropertyRow row = (PropertyRow)propertyTable.CreateRow(null); + row.Property = "SecureCustomProperties"; + row.Value = String.Join(";", secureProperties); + } + + if (0 < hiddenProperties.Count) + { + PropertyRow row = (PropertyRow)propertyTable.CreateRow(null); + row.Property = "MsiHiddenProperties"; + row.Value = String.Join(";", hiddenProperties); + } + } + } + } +} -- cgit v1.2.3-55-g6feb