aboutsummaryrefslogtreecommitdiff
path: root/src/WixToolset.Core/WixSearchInfo.cs
blob: 906365a2d8c8bc39d37e70bfd937613e7a9625f9 (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
// 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
{
    using System;
    using System.Diagnostics;
    using System.Xml;
    using WixToolset.Data;

    /// <summary>
    /// Utility base class for all WixSearches.
    /// </summary>
    internal abstract class WixSearchInfo
    {
        public WixSearchInfo(string id)
        {
            this.Id = id;
        }

        public void AddWixSearchRowInfo(Row row)
        {
            Debug.Assert((string)row[0] == Id);
            Variable = (string)row[1];
            Condition = (string)row[2];
        }

        public string Id { get; private set; }
        public string Variable { get; private set; }
        public string Condition { get; private set; }

        /// <summary>
        /// Generates Burn manifest and ParameterInfo-style markup a search.
        /// </summary>
        /// <param name="writer"></param>
        public virtual void WriteXml(XmlTextWriter writer)
        {
        }

        /// <summary>
        /// Writes attributes common to all WixSearch elements.
        /// </summary>
        /// <param name="writer"></param>
        protected void WriteWixSearchAttributes(XmlTextWriter writer)
        {
            writer.WriteAttributeString("Id", this.Id);
            writer.WriteAttributeString("Variable", this.Variable);
            if (!String.IsNullOrEmpty(this.Condition))
            {
                writer.WriteAttributeString("Condition", this.Condition);
            }
        }
    }
}