blob: 03f901630a46a669cc51080407b17deaecf82c2a (
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
|
// 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.DirectX
{
#if TODO_CONSIDER_DECOMPILER
using System;
using System.Text;
using WixToolset.Data;
using WixToolset.Extensibility;
using Wix = WixToolset.Data.Serialize;
/// <summary>
/// The WiX Toolset DirectX Extension.
/// </summary>
public sealed class DirectXDecompiler : DecompilerExtension
{
/// <summary>
/// Get the extensions library to be removed.
/// </summary>
/// <param name="tableDefinitions">Table definitions for library.</param>
/// <returns>Library to remove from decompiled output.</returns>
public override Library GetLibraryToRemove(TableDefinitionCollection tableDefinitions)
{
return DirectXExtensionData.GetExtensionLibrary(tableDefinitions);
}
/// <summary>
/// Called at the beginning of the decompilation of a database.
/// </summary>
/// <param name="tables">The collection of all tables.</param>
public override void Initialize(TableIndexedCollection tables)
{
Table propertyTable = tables["Property"];
if (null != propertyTable)
{
foreach (Row row in propertyTable.Rows)
{
if ("SecureCustomProperties" == row[0].ToString())
{
// if we've referenced any of the DirectX properties, add
// a PropertyRef to pick up the CA from the extension and then remove
// it from the SecureCustomExtensions property so we don't get duplicates
StringBuilder remainingProperties = new StringBuilder();
string[] secureCustomProperties = row[1].ToString().Split(';');
foreach (string property in secureCustomProperties)
{
if (property.StartsWith("WIX_DIRECTX_"))
{
Wix.PropertyRef propertyRef = new Wix.PropertyRef();
propertyRef.Id = property;
this.Core.RootElement.AddChild(propertyRef);
}
else
{
if (0 < remainingProperties.Length)
{
remainingProperties.Append(";");
}
remainingProperties.Append(property);
}
}
row[1] = remainingProperties.ToString();
break;
}
}
}
}
}
#endif
}
|