diff options
Diffstat (limited to 'src/WixToolset.Core.Burn/Bind/WixComponentSearchInfo.cs')
-rw-r--r-- | src/WixToolset.Core.Burn/Bind/WixComponentSearchInfo.cs | 64 |
1 files changed, 64 insertions, 0 deletions
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 @@ | |||
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 | |||
3 | namespace WixToolset.Core.Burn | ||
4 | { | ||
5 | using System; | ||
6 | using System.Xml; | ||
7 | using WixToolset.Data; | ||
8 | |||
9 | /// <summary> | ||
10 | /// Utility class for all WixComponentSearches. | ||
11 | /// </summary> | ||
12 | internal class WixComponentSearchInfo : WixSearchInfo | ||
13 | { | ||
14 | public WixComponentSearchInfo(Row row) | ||
15 | : this((string)row[0], (string)row[1], (string)row[2], (int)row[3]) | ||
16 | { | ||
17 | } | ||
18 | |||
19 | public WixComponentSearchInfo(string id, string guid, string productCode, int attributes) | ||
20 | : base(id) | ||
21 | { | ||
22 | this.Guid = guid; | ||
23 | this.ProductCode = productCode; | ||
24 | this.Attributes = (WixComponentSearchAttributes)attributes; | ||
25 | } | ||
26 | |||
27 | public string Guid { get; private set; } | ||
28 | public string ProductCode { get; private set; } | ||
29 | public WixComponentSearchAttributes Attributes { get; private set; } | ||
30 | |||
31 | /// <summary> | ||
32 | /// Generates Burn manifest and ParameterInfo-style markup for a component search. | ||
33 | /// </summary> | ||
34 | /// <param name="writer"></param> | ||
35 | public override void WriteXml(XmlTextWriter writer) | ||
36 | { | ||
37 | writer.WriteStartElement("MsiComponentSearch"); | ||
38 | this.WriteWixSearchAttributes(writer); | ||
39 | |||
40 | writer.WriteAttributeString("ComponentId", this.Guid); | ||
41 | |||
42 | if (!String.IsNullOrEmpty(this.ProductCode)) | ||
43 | { | ||
44 | writer.WriteAttributeString("ProductCode", this.ProductCode); | ||
45 | } | ||
46 | |||
47 | if (0 != (this.Attributes & WixComponentSearchAttributes.KeyPath)) | ||
48 | { | ||
49 | writer.WriteAttributeString("Type", "keyPath"); | ||
50 | } | ||
51 | else if (0 != (this.Attributes & WixComponentSearchAttributes.State)) | ||
52 | { | ||
53 | writer.WriteAttributeString("Type", "state"); | ||
54 | } | ||
55 | else if (0 != (this.Attributes & WixComponentSearchAttributes.WantDirectory)) | ||
56 | { | ||
57 | writer.WriteAttributeString("Type", "directory"); | ||
58 | } | ||
59 | |||
60 | writer.WriteEndElement(); | ||
61 | } | ||
62 | } | ||
63 | |||
64 | } | ||