aboutsummaryrefslogtreecommitdiff
path: root/src/WixToolset.Core/Link/ConnectToFeature.cs
blob: 6e046b895484f3675abb9184207d73cbbfeb29e6 (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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
// 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.Link
{
    using System.Collections.Specialized;
    using WixToolset.Data;

    /// <summary>
    /// Object that connects things (components/modules) to features.
    /// </summary>
    public sealed class ConnectToFeature
    {
        private Section section;
        private string childId;

        private string primaryFeature;
        private bool explicitPrimaryFeature;
        private StringCollection connectFeatures;

        /// <summary>
        /// Creates a new connect to feature.
        /// </summary>
        /// <param name="section">Section this connect belongs to.</param>
        /// <param name="childId">Id of the child.</param>
        public ConnectToFeature(Section section, string childId) :
            this(section, childId, null, false)
        {
        }

        /// <summary>
        /// Creates a new connect to feature.
        /// </summary>
        /// <param name="section">Section this connect belongs to.</param>
        /// <param name="childId">Id of the child.</param>
        /// <param name="primaryFeature">Sets the primary feature for the connection.</param>
        /// <param name="explicitPrimaryFeature">Sets if this is explicit primary.</param>
        public ConnectToFeature(Section section, string childId, string primaryFeature, bool explicitPrimaryFeature)
        {
            this.section = section;
            this.childId = childId;

            this.primaryFeature = primaryFeature;
            this.explicitPrimaryFeature = explicitPrimaryFeature;

            this.connectFeatures = new StringCollection();
        }

        /// <summary>
        /// Gets the section.
        /// </summary>
        /// <value>Section.</value>
        public Section Section
        {
            get { return this.section; }
        }

        /// <summary>
        /// Gets the child identifier.
        /// </summary>
        /// <value>The child identifier.</value>
        public string ChildId
        {
            get { return this.childId; }
        }

        /// <summary>
        /// Gets or sets if the flag for if the primary feature was set explicitly.
        /// </summary>
        /// <value>The flag for if the primary feature was set explicitly.</value>
        public bool IsExplicitPrimaryFeature
        {
            get { return this.explicitPrimaryFeature; }
            set { this.explicitPrimaryFeature = value; }
        }

        /// <summary>
        /// Gets or sets the primary feature.
        /// </summary>
        /// <value>The primary feature.</value>
        public string PrimaryFeature
        {
            get { return this.primaryFeature; }
            set { this.primaryFeature = value; }
        }

        /// <summary>
        /// Gets the features connected to.
        /// </summary>
        /// <value>Features connected to.</value>
        public StringCollection ConnectFeatures
        {
            get { return this.connectFeatures; }
        }
    }
}