From dbde9e7104b907bbbaea17e21247d8cafc8b3a4c Mon Sep 17 00:00:00 2001 From: Rob Mensching Date: Sat, 14 Oct 2017 16:12:07 -0700 Subject: Massive refactoring to introduce the concept of IBackend --- .../Bind/WixComponentSearchInfo.cs | 64 ++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 src/WixToolset.Core.Burn/Bind/WixComponentSearchInfo.cs (limited to 'src/WixToolset.Core.Burn/Bind/WixComponentSearchInfo.cs') diff --git a/src/WixToolset.Core.Burn/Bind/WixComponentSearchInfo.cs b/src/WixToolset.Core.Burn/Bind/WixComponentSearchInfo.cs new file mode 100644 index 00000000..f605d7c7 --- /dev/null +++ b/src/WixToolset.Core.Burn/Bind/WixComponentSearchInfo.cs @@ -0,0 +1,64 @@ +// 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.Core.Burn +{ + using System; + using System.Xml; + using WixToolset.Data; + + /// + /// Utility class for all WixComponentSearches. + /// + internal class WixComponentSearchInfo : WixSearchInfo + { + public WixComponentSearchInfo(Row row) + : this((string)row[0], (string)row[1], (string)row[2], (int)row[3]) + { + } + + public WixComponentSearchInfo(string id, string guid, string productCode, int attributes) + : base(id) + { + this.Guid = guid; + this.ProductCode = productCode; + this.Attributes = (WixComponentSearchAttributes)attributes; + } + + public string Guid { get; private set; } + public string ProductCode { get; private set; } + public WixComponentSearchAttributes Attributes { get; private set; } + + /// + /// Generates Burn manifest and ParameterInfo-style markup for a component search. + /// + /// + public override void WriteXml(XmlTextWriter writer) + { + writer.WriteStartElement("MsiComponentSearch"); + this.WriteWixSearchAttributes(writer); + + writer.WriteAttributeString("ComponentId", this.Guid); + + if (!String.IsNullOrEmpty(this.ProductCode)) + { + writer.WriteAttributeString("ProductCode", this.ProductCode); + } + + if (0 != (this.Attributes & WixComponentSearchAttributes.KeyPath)) + { + writer.WriteAttributeString("Type", "keyPath"); + } + else if (0 != (this.Attributes & WixComponentSearchAttributes.State)) + { + writer.WriteAttributeString("Type", "state"); + } + else if (0 != (this.Attributes & WixComponentSearchAttributes.WantDirectory)) + { + writer.WriteAttributeString("Type", "directory"); + } + + writer.WriteEndElement(); + } + } + +} -- cgit v1.2.3-55-g6feb