aboutsummaryrefslogtreecommitdiff
path: root/src/dtf/WixToolset.Dtf.WindowsInstaller/InstallationPart.cs
blob: ce5a6a947bc39616c3bfff312b614b651e359c62 (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
// 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.Dtf.WindowsInstaller
{
    /// <summary>
    /// Subclasses of this abstract class represent an instance
    /// of a registered feature or component.
    /// </summary>
    public abstract class InstallationPart
    {
        private string id;
        private string productCode;
        private string userSid;
        private UserContexts context;

        internal InstallationPart(string id, string productCode)
	    : this(id, productCode, null, UserContexts.None)
        {
        }

        internal InstallationPart(string id, string productCode, string userSid, UserContexts context)
        {
            this.id = id;
            this.productCode = productCode;
            this.userSid = userSid;
            this.context = context;
        }

        internal string Id
        {
            get
            {
                return this.id;
            }
        }

        internal string ProductCode
        {
            get
            {
                return this.productCode;
            }
        }

        internal string UserSid
        {
            get
            {
                return this.userSid;
            }
        }

        internal UserContexts Context
        {
            get
            {
                return this.context;
            }
        }

        /// <summary>
        /// Gets the product that this item is a part of.
        /// </summary>
        public ProductInstallation Product
        {
            get
            {
                return this.productCode != null ?
                    new ProductInstallation(this.productCode, userSid, context) : null;
            }
        }

        /// <summary>
        /// Gets the current installation state of the item.
        /// </summary>
        public abstract InstallState State
        {
            get;
        }
    }

}