diff options
Diffstat (limited to 'src/WixToolset.Data.WindowsInstaller/WindowsInstallerStandardInternal.cs')
-rw-r--r-- | src/WixToolset.Data.WindowsInstaller/WindowsInstallerStandardInternal.cs | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/src/WixToolset.Data.WindowsInstaller/WindowsInstallerStandardInternal.cs b/src/WixToolset.Data.WindowsInstaller/WindowsInstallerStandardInternal.cs new file mode 100644 index 00000000..cc6754c3 --- /dev/null +++ b/src/WixToolset.Data.WindowsInstaller/WindowsInstallerStandardInternal.cs | |||
@@ -0,0 +1,59 @@ | |||
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.Data | ||
4 | { | ||
5 | using System.Reflection; | ||
6 | using System.Xml; | ||
7 | using WixToolset.Data.Rows; | ||
8 | |||
9 | /// <summary> | ||
10 | /// Represents the Windows Installer standard objects. | ||
11 | /// </summary> | ||
12 | public static class WindowsInstallerStandardInternal | ||
13 | { | ||
14 | private static readonly object lockObject = new object(); | ||
15 | |||
16 | private static TableDefinitionCollection tableDefinitions; | ||
17 | private static WixActionRowCollection standardActions; | ||
18 | |||
19 | /// <summary> | ||
20 | /// Gets the table definitions stored in this assembly. | ||
21 | /// </summary> | ||
22 | /// <returns>Table definition collection for tables stored in this assembly.</returns> | ||
23 | public static TableDefinitionCollection GetTableDefinitions() | ||
24 | { | ||
25 | lock (lockObject) | ||
26 | { | ||
27 | if (null == WindowsInstallerStandardInternal.tableDefinitions) | ||
28 | { | ||
29 | using (XmlReader reader = XmlReader.Create(Assembly.GetExecutingAssembly().GetManifestResourceStream("WixToolset.Data.WindowsInstaller.Data.tables.xml"))) | ||
30 | { | ||
31 | WindowsInstallerStandardInternal.tableDefinitions = TableDefinitionCollection.Load(reader); | ||
32 | } | ||
33 | } | ||
34 | } | ||
35 | |||
36 | return WindowsInstallerStandardInternal.tableDefinitions; | ||
37 | } | ||
38 | |||
39 | /// <summary> | ||
40 | /// Gets the standard actions stored in this assembly. | ||
41 | /// </summary> | ||
42 | /// <returns>Collection of standard actions in this assembly.</returns> | ||
43 | public static WixActionRowCollection GetStandardActionRows() | ||
44 | { | ||
45 | lock (lockObject) | ||
46 | { | ||
47 | if (null == WindowsInstallerStandardInternal.standardActions) | ||
48 | { | ||
49 | using (XmlReader reader = XmlReader.Create(Assembly.GetExecutingAssembly().GetManifestResourceStream("WixToolset.Data.WindowsInstaller.Data.actions.xml"))) | ||
50 | { | ||
51 | WindowsInstallerStandardInternal.standardActions = WixActionRowCollection.Load(reader); | ||
52 | } | ||
53 | } | ||
54 | } | ||
55 | |||
56 | return WindowsInstallerStandardInternal.standardActions; | ||
57 | } | ||
58 | } | ||
59 | } | ||