blob: ea955db454479916323098d42430fc4d0110b237 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
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;
/// <summary>
/// Utility class for all WixFileSearches (file and directory searches).
/// </summary>
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; }
/// <summary>
/// Generates Burn manifest and ParameterInfo-style markup for a file/directory search.
/// </summary>
/// <param name="writer"></param>
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();
}
}
}
|