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 --- src/WixToolset.Core.Burn/Bind/WixFileSearchInfo.cs | 54 ++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 src/WixToolset.Core.Burn/Bind/WixFileSearchInfo.cs (limited to 'src/WixToolset.Core.Burn/Bind/WixFileSearchInfo.cs') diff --git a/src/WixToolset.Core.Burn/Bind/WixFileSearchInfo.cs b/src/WixToolset.Core.Burn/Bind/WixFileSearchInfo.cs new file mode 100644 index 00000000..ea955db4 --- /dev/null +++ b/src/WixToolset.Core.Burn/Bind/WixFileSearchInfo.cs @@ -0,0 +1,54 @@ +// 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 WixFileSearches (file and directory searches). + /// + internal class WixFileSearchInfo : WixSearchInfo + { + public WixFileSearchInfo(Row row) + : this((string)row[0], (string)row[1], (int)row[9]) + { + } + + public WixFileSearchInfo(string id, string path, int attributes) + : base(id) + { + this.Path = path; + this.Attributes = (WixFileSearchAttributes)attributes; + } + + public string Path { get; private set; } + public WixFileSearchAttributes Attributes { get; private set; } + + /// + /// Generates Burn manifest and ParameterInfo-style markup for a file/directory search. + /// + /// + public override void WriteXml(XmlTextWriter writer) + { + writer.WriteStartElement((0 == (this.Attributes & WixFileSearchAttributes.IsDirectory)) ? "FileSearch" : "DirectorySearch"); + this.WriteWixSearchAttributes(writer); + writer.WriteAttributeString("Path", this.Path); + if (WixFileSearchAttributes.WantExists == (this.Attributes & WixFileSearchAttributes.WantExists)) + { + writer.WriteAttributeString("Type", "exists"); + } + else if (WixFileSearchAttributes.WantVersion == (this.Attributes & WixFileSearchAttributes.WantVersion)) + { + // Can never get here for DirectorySearch. + writer.WriteAttributeString("Type", "version"); + } + else + { + writer.WriteAttributeString("Type", "path"); + } + writer.WriteEndElement(); + } + } +} -- cgit v1.2.3-55-g6feb