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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
|
// 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.Http
{
#if TODO_CONSIDER_DECOMPILER
using System;
using System.Collections;
using System.Diagnostics;
using System.Globalization;
using WixToolset.Data;
using WixToolset.Extensibility;
using Http = WixToolset.Extensions.Serialize.Http;
using Wix = WixToolset.Data.Serialize;
/// <summary>
/// The decompiler for the WiX Toolset Http Extension.
/// </summary>
public sealed class HttpDecompiler : DecompilerExtension
{
/// <summary>
/// Creates a decompiler for Http Extension.
/// </summary>
public HttpDecompiler()
{
this.TableDefinitions = HttpExtensionData.GetExtensionTableDefinitions();
}
/// <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 HttpExtensionData.GetExtensionLibrary(tableDefinitions);
}
/// <summary>
/// Decompiles an extension table.
/// </summary>
/// <param name="table">The table to decompile.</param>
public override void DecompileTable(Table table)
{
switch (table.Name)
{
case "WixHttpUrlReservation":
this.DecompileWixHttpUrlReservationTable(table);
break;
case "WixHttpUrlAce":
this.DecompileWixHttpUrlAceTable(table);
break;
default:
base.DecompileTable(table);
break;
}
}
/// <summary>
/// Decompile the WixHttpUrlReservation table.
/// </summary>
/// <param name="table">The table to decompile.</param>
private void DecompileWixHttpUrlReservationTable(Table table)
{
foreach (Row row in table.Rows)
{
Http.UrlReservation urlReservation = new Http.UrlReservation();
urlReservation.Id = (string)row[0];
switch((int)row[1])
{
case HttpConstants.heReplace:
default:
urlReservation.HandleExisting = Http.UrlReservation.HandleExistingType.replace;
break;
case HttpConstants.heIgnore:
urlReservation.HandleExisting = Http.UrlReservation.HandleExistingType.ignore;
break;
case HttpConstants.heFail:
urlReservation.HandleExisting = Http.UrlReservation.HandleExistingType.fail;
break;
}
urlReservation.Sddl = (string)row[2];
urlReservation.Url = (string)row[3];
Wix.Component component = (Wix.Component)this.Core.GetIndexedElement("Component", (string)row[4]);
if (null != component)
{
component.AddChild(urlReservation);
}
else
{
this.Core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Component_", (string)row[2], "Component"));
}
this.Core.IndexElement(row, urlReservation);
}
}
/// <summary>
/// Decompile the WixHttpUrlAce table.
/// </summary>
/// <param name="table">The table to decompile.</param>
private void DecompileWixHttpUrlAceTable(Table table)
{
foreach (Row row in table.Rows)
{
Http.UrlAce urlace = new Http.UrlAce();
urlace.Id = (string)row[0];
urlace.SecurityPrincipal = (string)row[2];
switch (Convert.ToInt32(row[3]))
{
case HttpConstants.GENERIC_ALL:
default:
urlace.Rights = Http.UrlAce.RightsType.all;
break;
case HttpConstants.GENERIC_EXECUTE:
urlace.Rights = Http.UrlAce.RightsType.register;
break;
case HttpConstants.GENERIC_WRITE:
urlace.Rights = Http.UrlAce.RightsType.@delegate;
break;
}
string reservationId = (string)row[1];
Http.UrlReservation urlReservation = (Http.UrlReservation)this.Core.GetIndexedElement("WixHttpUrlReservation", reservationId);
if (null != urlReservation)
{
urlReservation.AddChild(urlace);
}
else
{
this.Core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, table.Name, urlace.Id, "WixHttpUrlReservation_", reservationId, "WixHttpUrlReservation"));
}
}
}
}
#endif
}
|