| 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.Dtf.WindowsInstaller |
| 4 | { |
| 5 | using System; |
| 6 | using System.Text; |
| 7 | using System.Globalization; |
| 8 | |
| 9 | /// <summary> |
| 10 | /// Subclasses of this abstract class represent a unique instance of a |
| 11 | /// registered product or patch installation. |
| 12 | /// </summary> |
| 13 | public abstract class Installation |
| 14 | { |
| 15 | private string installationCode; |
| 16 | private string userSid; |
| 17 | private UserContexts context; |
| 18 | private SourceList sourceList; |
| 19 | |
| 20 | internal Installation(string installationCode, string userSid, UserContexts context) |
| 21 | { |
| 22 | if (context == UserContexts.Machine) |
| 23 | { |
| 24 | userSid = null; |
| 25 | } |
| 26 | this.installationCode = installationCode; |
| 27 | this.userSid = userSid; |
| 28 | this.context = context; |
| 29 | } |
| 30 | |
| 31 | /// <summary> |
| 32 | /// Gets the user security identifier (SID) under which this product or patch |
| 33 | /// installation is available. |
| 34 | /// </summary> |
| 35 | public string UserSid |
| 36 | { |
| 37 | get |
| 38 | { |
| 39 | return this.userSid; |
| 40 | } |
| 41 | } |
| 42 | |
| 43 | /// <summary> |
| 44 | /// Gets the user context of this product or patch installation. |
| 45 | /// </summary> |
| 46 | public UserContexts Context |
| 47 | { |
| 48 | get |
| 49 | { |
| 50 | return this.context; |
| 51 | } |
| 52 | } |
| 53 | |
| 54 | /// <summary> |
| 55 | /// Gets the source list of this product or patch installation. |
| 56 | /// </summary> |
| 57 | public virtual SourceList SourceList |
| 58 | { |
| 59 | get |
| 60 | { |
| 61 | if (this.sourceList == null) |
| 62 | { |
| 63 | this.sourceList = new SourceList(this); |
| 64 | } |
| 65 | return this.sourceList; |
| 66 | } |
| 67 | } |
| 68 | |
| 69 | /// <summary> |
| 70 | /// Gets a value indicating whether this product or patch is installed on the current system. |
| 71 | /// </summary> |
| 72 | public abstract bool IsInstalled |
| 73 | { |
| 74 | get; |
| 75 | } |
| 76 | |
| 77 | internal string InstallationCode |
| 78 | { |
| 79 | get |
| 80 | { |
| 81 | return this.installationCode; |
| 82 | } |
| 83 | } |
| 84 | |
| 85 | internal abstract int InstallationType |
| 86 | { |
| 87 | get; |
| 88 | } |
| 89 | |
| 90 | /// <summary> |
| 91 | /// Gets a property about the product or patch installation. |
| 92 | /// </summary> |
| 93 | /// <param name="propertyName">Name of the property being retrieved.</param> |
| 94 | /// <returns></returns> |
| 95 | public abstract string this[string propertyName] |
| 96 | { |
| 97 | get; |
| 98 | } |
| 99 | } |
| 100 | } |