aboutsummaryrefslogtreecommitdiff
path: root/src/WixToolset.Core.WindowsInstaller/WindowsInstallerStandardInternal.cs
blob: 759bda14e15b683a8ffb3d8ba50c3ea3197bb973 (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
// 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.Core.WindowsInstaller
{
    using System;
    using System.Reflection;
    using System.Xml;
    using WixToolset.Core.WindowsInstaller.Rows;
    using WixToolset.Data.WindowsInstaller;

    /// <summary>
    /// Represents the Windows Installer standard objects.
    /// </summary>
    internal static class WindowsInstallerStandardInternal
    {
        private static readonly object lockObject = new object();

        private static TableDefinitionCollection tableDefinitions;
#if REVISIT_FOR_PATCHING
        private static WixActionRowCollection standardActions;
#endif

        /// <summary>
        /// Gets the table definitions stored in this assembly.
        /// </summary>
        /// <returns>Table definition collection for tables stored in this assembly.</returns>
        public static TableDefinitionCollection GetTableDefinitions()
        {
            lock (lockObject)
            {
                if (null == WindowsInstallerStandardInternal.tableDefinitions)
                {
                    using (XmlReader reader = XmlReader.Create(Assembly.GetExecutingAssembly().GetManifestResourceStream("WixToolset.Core.WindowsInstaller.Data.tables.xml")))
                    {
                        WindowsInstallerStandardInternal.tableDefinitions = TableDefinitionCollection.Load(reader);
                    }
                }
            }

            return WindowsInstallerStandardInternal.tableDefinitions;
        }

        /// <summary>
        /// Gets the standard actions stored in this assembly.
        /// </summary>
        /// <returns>Collection of standard actions in this assembly.</returns>
        public static WixActionRowCollection GetStandardActionRows()
        {
#if REVISIT_FOR_PATCHING
            lock (lockObject)
            {
                if (null == WindowsInstallerStandardInternal.standardActions)
                {
                    using (XmlReader reader = XmlReader.Create(Assembly.GetExecutingAssembly().GetManifestResourceStream("WixToolset.Core.WindowsInstaller.Data.actions.xml")))
                    {
                        WindowsInstallerStandardInternal.standardActions = WixActionRowCollection.Load(reader);
                    }
                }
            }

            return WindowsInstallerStandardInternal.standardActions;
#endif
            throw new NotImplementedException();
        }
    }
}