aboutsummaryrefslogtreecommitdiff
path: root/src/WixToolset.Core.Burn/Bind/WixFileSearchInfo.cs
diff options
context:
space:
mode:
Diffstat (limited to 'src/WixToolset.Core.Burn/Bind/WixFileSearchInfo.cs')
-rw-r--r--src/WixToolset.Core.Burn/Bind/WixFileSearchInfo.cs54
1 files changed, 54 insertions, 0 deletions
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 @@
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
3namespace WixToolset.Core.Burn
4{
5 using System;
6 using System.Xml;
7 using WixToolset.Data;
8
9 /// <summary>
10 /// Utility class for all WixFileSearches (file and directory searches).
11 /// </summary>
12 internal class WixFileSearchInfo : WixSearchInfo
13 {
14 public WixFileSearchInfo(Row row)
15 : this((string)row[0], (string)row[1], (int)row[9])
16 {
17 }
18
19 public WixFileSearchInfo(string id, string path, int attributes)
20 : base(id)
21 {
22 this.Path = path;
23 this.Attributes = (WixFileSearchAttributes)attributes;
24 }
25
26 public string Path { get; private set; }
27 public WixFileSearchAttributes Attributes { get; private set; }
28
29 /// <summary>
30 /// Generates Burn manifest and ParameterInfo-style markup for a file/directory search.
31 /// </summary>
32 /// <param name="writer"></param>
33 public override void WriteXml(XmlTextWriter writer)
34 {
35 writer.WriteStartElement((0 == (this.Attributes & WixFileSearchAttributes.IsDirectory)) ? "FileSearch" : "DirectorySearch");
36 this.WriteWixSearchAttributes(writer);
37 writer.WriteAttributeString("Path", this.Path);
38 if (WixFileSearchAttributes.WantExists == (this.Attributes & WixFileSearchAttributes.WantExists))
39 {
40 writer.WriteAttributeString("Type", "exists");
41 }
42 else if (WixFileSearchAttributes.WantVersion == (this.Attributes & WixFileSearchAttributes.WantVersion))
43 {
44 // Can never get here for DirectorySearch.
45 writer.WriteAttributeString("Type", "version");
46 }
47 else
48 {
49 writer.WriteAttributeString("Type", "path");
50 }
51 writer.WriteEndElement();
52 }
53 }
54}