diff options
Diffstat (limited to 'src/wixext/IIsDecompiler.cs')
-rw-r--r-- | src/wixext/IIsDecompiler.cs | 1547 |
1 files changed, 1547 insertions, 0 deletions
diff --git a/src/wixext/IIsDecompiler.cs b/src/wixext/IIsDecompiler.cs new file mode 100644 index 00000000..8b3b8248 --- /dev/null +++ b/src/wixext/IIsDecompiler.cs | |||
@@ -0,0 +1,1547 @@ | |||
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.Extensions | ||
4 | { | ||
5 | using System; | ||
6 | using System.Collections; | ||
7 | using System.Globalization; | ||
8 | using WixToolset.Data; | ||
9 | using WixToolset.Extensibility; | ||
10 | using IIs = WixToolset.Extensions.Serialize.IIs; | ||
11 | using Wix = WixToolset.Data.Serialize; | ||
12 | |||
13 | /// <summary> | ||
14 | /// The decompiler for the WiX Toolset Internet Information Services Extension. | ||
15 | /// </summary> | ||
16 | public sealed class IIsDecompiler : DecompilerExtension | ||
17 | { | ||
18 | /// <summary> | ||
19 | /// Creates a decompiler for IIs Extension. | ||
20 | /// </summary> | ||
21 | public IIsDecompiler() | ||
22 | { | ||
23 | this.TableDefinitions = IIsExtensionData.GetExtensionTableDefinitions(); | ||
24 | } | ||
25 | |||
26 | /// <summary> | ||
27 | /// Get the extensions library to be removed. | ||
28 | /// </summary> | ||
29 | /// <param name="tableDefinitions">Table definitions for library.</param> | ||
30 | /// <returns>Library to remove from decompiled output.</returns> | ||
31 | public override Library GetLibraryToRemove(TableDefinitionCollection tableDefinitions) | ||
32 | { | ||
33 | return IIsExtensionData.GetExtensionLibrary(tableDefinitions); | ||
34 | } | ||
35 | |||
36 | /// <summary> | ||
37 | /// Decompiles an extension table. | ||
38 | /// </summary> | ||
39 | /// <param name="table">The table to decompile.</param> | ||
40 | public override void DecompileTable(Table table) | ||
41 | { | ||
42 | switch (table.Name) | ||
43 | { | ||
44 | case "Certificate": | ||
45 | this.DecompileCertificateTable(table); | ||
46 | break; | ||
47 | case "CertificateHash": | ||
48 | // There is nothing to do for this table, it contains no authored data | ||
49 | // to be decompiled. | ||
50 | break; | ||
51 | case "IIsAppPool": | ||
52 | this.DecompileIIsAppPoolTable(table); | ||
53 | break; | ||
54 | case "IIsFilter": | ||
55 | this.DecompileIIsFilterTable(table); | ||
56 | break; | ||
57 | case "IIsProperty": | ||
58 | this.DecompileIIsPropertyTable(table); | ||
59 | break; | ||
60 | case "IIsHttpHeader": | ||
61 | this.DecompileIIsHttpHeaderTable(table); | ||
62 | break; | ||
63 | case "IIsMimeMap": | ||
64 | this.DecompileIIsMimeMapTable(table); | ||
65 | break; | ||
66 | case "IIsWebAddress": | ||
67 | this.DecompileIIsWebAddressTable(table); | ||
68 | break; | ||
69 | case "IIsWebApplication": | ||
70 | this.DecompileIIsWebApplicationTable(table); | ||
71 | break; | ||
72 | case "IIsWebDirProperties": | ||
73 | this.DecompileIIsWebDirPropertiesTable(table); | ||
74 | break; | ||
75 | case "IIsWebError": | ||
76 | this.DecompileIIsWebErrorTable(table); | ||
77 | break; | ||
78 | case "IIsWebLog": | ||
79 | this.DecompileIIsWebLogTable(table); | ||
80 | break; | ||
81 | case "IIsWebServiceExtension": | ||
82 | this.DecompileIIsWebServiceExtensionTable(table); | ||
83 | break; | ||
84 | case "IIsWebSite": | ||
85 | this.DecompileIIsWebSiteTable(table); | ||
86 | break; | ||
87 | case "IIsWebVirtualDir": | ||
88 | this.DecompileIIsWebVirtualDirTable(table); | ||
89 | break; | ||
90 | case "IIsWebSiteCertificates": | ||
91 | this.DecompileIIsWebSiteCertificatesTable(table); | ||
92 | break; | ||
93 | default: | ||
94 | base.DecompileTable(table); | ||
95 | break; | ||
96 | } | ||
97 | } | ||
98 | |||
99 | /// <summary> | ||
100 | /// Finalize decompilation. | ||
101 | /// </summary> | ||
102 | /// <param name="tables">The collection of all tables.</param> | ||
103 | public override void Finish(TableIndexedCollection tables) | ||
104 | { | ||
105 | this.FinalizeIIsMimeMapTable(tables); | ||
106 | this.FinalizeIIsHttpHeaderTable(tables); | ||
107 | this.FinalizeIIsWebApplicationTable(tables); | ||
108 | this.FinalizeIIsWebErrorTable(tables); | ||
109 | this.FinalizeIIsWebVirtualDirTable(tables); | ||
110 | this.FinalizeIIsWebSiteCertificatesTable(tables); | ||
111 | this.FinalizeWebAddressTable(tables); | ||
112 | } | ||
113 | |||
114 | /// <summary> | ||
115 | /// Decompile the Certificate table. | ||
116 | /// </summary> | ||
117 | /// <param name="table">The table to decompile.</param> | ||
118 | private void DecompileCertificateTable(Table table) | ||
119 | { | ||
120 | foreach (Row row in table.Rows) | ||
121 | { | ||
122 | IIs.Certificate certificate = new IIs.Certificate(); | ||
123 | |||
124 | certificate.Id = (string)row[0]; | ||
125 | certificate.Name = (string)row[2]; | ||
126 | |||
127 | switch ((int)row[3]) | ||
128 | { | ||
129 | case 1: | ||
130 | certificate.StoreLocation = IIs.Certificate.StoreLocationType.currentUser; | ||
131 | break; | ||
132 | case 2: | ||
133 | certificate.StoreLocation = IIs.Certificate.StoreLocationType.localMachine; | ||
134 | break; | ||
135 | default: | ||
136 | // TODO: warn | ||
137 | break; | ||
138 | } | ||
139 | |||
140 | switch ((string)row[4]) | ||
141 | { | ||
142 | case "CA": | ||
143 | certificate.StoreName = IIs.Certificate.StoreNameType.ca; | ||
144 | break; | ||
145 | case "MY": | ||
146 | certificate.StoreName = IIs.Certificate.StoreNameType.my; | ||
147 | break; | ||
148 | case "REQUEST": | ||
149 | certificate.StoreName = IIs.Certificate.StoreNameType.request; | ||
150 | break; | ||
151 | case "Root": | ||
152 | certificate.StoreName = IIs.Certificate.StoreNameType.root; | ||
153 | break; | ||
154 | case "AddressBook": | ||
155 | certificate.StoreName = IIs.Certificate.StoreNameType.otherPeople; | ||
156 | break; | ||
157 | case "TrustedPeople": | ||
158 | certificate.StoreName = IIs.Certificate.StoreNameType.trustedPeople; | ||
159 | break; | ||
160 | case "TrustedPublisher": | ||
161 | certificate.StoreName = IIs.Certificate.StoreNameType.trustedPublisher; | ||
162 | break; | ||
163 | default: | ||
164 | // TODO: warn | ||
165 | break; | ||
166 | } | ||
167 | |||
168 | int attribute = (int)row[5]; | ||
169 | |||
170 | if (0x1 == (attribute & 0x1)) | ||
171 | { | ||
172 | certificate.Request = IIs.YesNoType.yes; | ||
173 | } | ||
174 | |||
175 | if (0x2 == (attribute & 0x2)) | ||
176 | { | ||
177 | if (null != row[6]) | ||
178 | { | ||
179 | certificate.BinaryKey = (string)row[6]; | ||
180 | } | ||
181 | else | ||
182 | { | ||
183 | // TODO: warn about expected value in row 5 | ||
184 | } | ||
185 | } | ||
186 | else if (null != row[7]) | ||
187 | { | ||
188 | certificate.CertificatePath = (string)row[7]; | ||
189 | } | ||
190 | |||
191 | if (0x4 == (attribute & 0x4)) | ||
192 | { | ||
193 | certificate.Overwrite = IIs.YesNoType.yes; | ||
194 | } | ||
195 | |||
196 | if (null != row[8]) | ||
197 | { | ||
198 | certificate.PFXPassword = (string)row[8]; | ||
199 | } | ||
200 | |||
201 | Wix.Component component = (Wix.Component)this.Core.GetIndexedElement("Component", (string)row[1]); | ||
202 | if (null != component) | ||
203 | { | ||
204 | component.AddChild(certificate); | ||
205 | } | ||
206 | else | ||
207 | { | ||
208 | this.Core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Component_", (string)row[1], "Component")); | ||
209 | } | ||
210 | } | ||
211 | } | ||
212 | |||
213 | /// <summary> | ||
214 | /// Decompile the IIsAppPool table. | ||
215 | /// </summary> | ||
216 | /// <param name="table">The table to decompile.</param> | ||
217 | private void DecompileIIsAppPoolTable(Table table) | ||
218 | { | ||
219 | foreach (Row row in table.Rows) | ||
220 | { | ||
221 | IIs.WebAppPool webAppPool = new IIs.WebAppPool(); | ||
222 | |||
223 | webAppPool.Id = (string)row[0]; | ||
224 | |||
225 | webAppPool.Name = (string)row[1]; | ||
226 | |||
227 | switch ((int)row[3] & 0x1F) | ||
228 | { | ||
229 | case 1: | ||
230 | webAppPool.Identity = IIs.WebAppPool.IdentityType.networkService; | ||
231 | break; | ||
232 | case 2: | ||
233 | webAppPool.Identity = IIs.WebAppPool.IdentityType.localService; | ||
234 | break; | ||
235 | case 4: | ||
236 | webAppPool.Identity = IIs.WebAppPool.IdentityType.localSystem; | ||
237 | break; | ||
238 | case 8: | ||
239 | webAppPool.Identity = IIs.WebAppPool.IdentityType.other; | ||
240 | break; | ||
241 | case 0x10: | ||
242 | webAppPool.Identity = IIs.WebAppPool.IdentityType.applicationPoolIdentity; | ||
243 | break; | ||
244 | default: | ||
245 | // TODO: warn | ||
246 | break; | ||
247 | } | ||
248 | |||
249 | if (null != row[4]) | ||
250 | { | ||
251 | webAppPool.User = (string)row[4]; | ||
252 | } | ||
253 | |||
254 | if (null != row[5]) | ||
255 | { | ||
256 | webAppPool.RecycleMinutes = (int)row[5]; | ||
257 | } | ||
258 | |||
259 | if (null != row[6]) | ||
260 | { | ||
261 | webAppPool.RecycleRequests = (int)row[6]; | ||
262 | } | ||
263 | |||
264 | if (null != row[7]) | ||
265 | { | ||
266 | string[] recycleTimeValues = ((string)row[7]).Split(','); | ||
267 | |||
268 | foreach (string recycleTimeValue in recycleTimeValues) | ||
269 | { | ||
270 | IIs.RecycleTime recycleTime = new IIs.RecycleTime(); | ||
271 | |||
272 | recycleTime.Value = recycleTimeValue; | ||
273 | |||
274 | webAppPool.AddChild(recycleTime); | ||
275 | } | ||
276 | } | ||
277 | |||
278 | if (null != row[8]) | ||
279 | { | ||
280 | webAppPool.IdleTimeout = (int)row[8]; | ||
281 | } | ||
282 | |||
283 | if (null != row[9]) | ||
284 | { | ||
285 | webAppPool.QueueLimit = (int)row[9]; | ||
286 | } | ||
287 | |||
288 | if (null != row[10]) | ||
289 | { | ||
290 | string[] cpuMon = ((string)row[10]).Split(','); | ||
291 | |||
292 | if (0 < cpuMon.Length && "0" != cpuMon[0]) | ||
293 | { | ||
294 | webAppPool.MaxCpuUsage = Convert.ToInt32(cpuMon[0], CultureInfo.InvariantCulture); | ||
295 | } | ||
296 | |||
297 | if (1 < cpuMon.Length) | ||
298 | { | ||
299 | webAppPool.RefreshCpu = Convert.ToInt32(cpuMon[1], CultureInfo.InvariantCulture); | ||
300 | } | ||
301 | |||
302 | if (2 < cpuMon.Length) | ||
303 | { | ||
304 | switch (Convert.ToInt32(cpuMon[2], CultureInfo.InvariantCulture)) | ||
305 | { | ||
306 | case 0: | ||
307 | webAppPool.CpuAction = IIs.WebAppPool.CpuActionType.none; | ||
308 | break; | ||
309 | case 1: | ||
310 | webAppPool.CpuAction = IIs.WebAppPool.CpuActionType.shutdown; | ||
311 | break; | ||
312 | default: | ||
313 | // TODO: warn | ||
314 | break; | ||
315 | } | ||
316 | } | ||
317 | |||
318 | if (3 < cpuMon.Length) | ||
319 | { | ||
320 | // TODO: warn | ||
321 | } | ||
322 | } | ||
323 | |||
324 | if (null != row[11]) | ||
325 | { | ||
326 | webAppPool.MaxWorkerProcesses = (int)row[11]; | ||
327 | } | ||
328 | |||
329 | if (null != row[12]) | ||
330 | { | ||
331 | webAppPool.VirtualMemory = (int)row[12]; | ||
332 | } | ||
333 | |||
334 | if (null != row[13]) | ||
335 | { | ||
336 | webAppPool.PrivateMemory = (int)row[13]; | ||
337 | } | ||
338 | |||
339 | if (null != row[14]) | ||
340 | { | ||
341 | webAppPool.ManagedRuntimeVersion = (string)row[14]; | ||
342 | } | ||
343 | |||
344 | if (null != row[15]) | ||
345 | { | ||
346 | webAppPool.ManagedPipelineMode = (string)row[15]; | ||
347 | } | ||
348 | |||
349 | if (null != row[2]) | ||
350 | { | ||
351 | Wix.Component component = (Wix.Component)this.Core.GetIndexedElement("Component", (string)row[2]); | ||
352 | |||
353 | if (null != component) | ||
354 | { | ||
355 | component.AddChild(webAppPool); | ||
356 | } | ||
357 | else | ||
358 | { | ||
359 | this.Core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Component_", (string)row[2], "Component")); | ||
360 | } | ||
361 | } | ||
362 | else | ||
363 | { | ||
364 | this.Core.RootElement.AddChild(webAppPool); | ||
365 | } | ||
366 | } | ||
367 | } | ||
368 | |||
369 | /// <summary> | ||
370 | /// Decompile the IIsProperty table. | ||
371 | /// </summary> | ||
372 | /// <param name="table">The table to decompile.</param> | ||
373 | private void DecompileIIsPropertyTable(Table table) | ||
374 | { | ||
375 | foreach (Row row in table.Rows) | ||
376 | { | ||
377 | IIs.WebProperty webProperty = new IIs.WebProperty(); | ||
378 | |||
379 | switch ((string)row[0]) | ||
380 | { | ||
381 | case "ETagChangeNumber": | ||
382 | webProperty.Id = IIs.WebProperty.IdType.ETagChangeNumber; | ||
383 | break; | ||
384 | case "IIs5IsolationMode": | ||
385 | webProperty.Id = IIs.WebProperty.IdType.IIs5IsolationMode; | ||
386 | break; | ||
387 | case "LogInUTF8": | ||
388 | webProperty.Id = IIs.WebProperty.IdType.LogInUTF8; | ||
389 | break; | ||
390 | case "MaxGlobalBandwidth": | ||
391 | webProperty.Id = IIs.WebProperty.IdType.MaxGlobalBandwidth; | ||
392 | break; | ||
393 | } | ||
394 | |||
395 | if (0 != (int)row[2]) | ||
396 | { | ||
397 | // TODO: warn about value in unused column | ||
398 | } | ||
399 | |||
400 | if (null != row[3]) | ||
401 | { | ||
402 | webProperty.Value = (string)row[3]; | ||
403 | } | ||
404 | |||
405 | Wix.Component component = (Wix.Component)this.Core.GetIndexedElement("Component", (string)row[1]); | ||
406 | if (null != component) | ||
407 | { | ||
408 | component.AddChild(webProperty); | ||
409 | } | ||
410 | else | ||
411 | { | ||
412 | this.Core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Component_", (string)row[1], "Component")); | ||
413 | } | ||
414 | } | ||
415 | } | ||
416 | |||
417 | /// <summary> | ||
418 | /// Decompile the IIsHttpHeader table. | ||
419 | /// </summary> | ||
420 | /// <param name="table">The table to decompile.</param> | ||
421 | private void DecompileIIsHttpHeaderTable(Table table) | ||
422 | { | ||
423 | foreach (Row row in table.Rows) | ||
424 | { | ||
425 | IIs.HttpHeader httpHeader = new IIs.HttpHeader(); | ||
426 | |||
427 | httpHeader.Name = (string)row[3]; | ||
428 | |||
429 | // the ParentType and Parent columns are handled in FinalizeIIsHttpHeaderTable | ||
430 | |||
431 | httpHeader.Value = (string)row[4]; | ||
432 | |||
433 | this.Core.IndexElement(row, httpHeader); | ||
434 | } | ||
435 | } | ||
436 | |||
437 | /// <summary> | ||
438 | /// Decompile the IIsMimeMap table. | ||
439 | /// </summary> | ||
440 | /// <param name="table">The table to decompile.</param> | ||
441 | private void DecompileIIsMimeMapTable(Table table) | ||
442 | { | ||
443 | foreach (Row row in table.Rows) | ||
444 | { | ||
445 | IIs.MimeMap mimeMap = new IIs.MimeMap(); | ||
446 | |||
447 | mimeMap.Id = (string)row[0]; | ||
448 | |||
449 | // the ParentType and ParentValue columns are handled in FinalizeIIsMimeMapTable | ||
450 | |||
451 | mimeMap.Type = (string)row[3]; | ||
452 | |||
453 | mimeMap.Extension = (string)row[4]; | ||
454 | |||
455 | this.Core.IndexElement(row, mimeMap); | ||
456 | } | ||
457 | } | ||
458 | |||
459 | /// <summary> | ||
460 | /// Decompile the IIsWebAddress table. | ||
461 | /// </summary> | ||
462 | /// <param name="table">The table to decompile.</param> | ||
463 | private void DecompileIIsWebAddressTable(Table table) | ||
464 | { | ||
465 | foreach (Row row in table.Rows) | ||
466 | { | ||
467 | IIs.WebAddress webAddress = new IIs.WebAddress(); | ||
468 | |||
469 | webAddress.Id = (string)row[0]; | ||
470 | |||
471 | if (null != row[2]) | ||
472 | { | ||
473 | webAddress.IP = (string)row[2]; | ||
474 | } | ||
475 | |||
476 | webAddress.Port = (string)row[3]; | ||
477 | |||
478 | if (null != row[4]) | ||
479 | { | ||
480 | webAddress.Header = (string)row[4]; | ||
481 | } | ||
482 | |||
483 | if (null != row[5] && 1 == (int)row[5]) | ||
484 | { | ||
485 | webAddress.Secure = IIs.YesNoType.yes; | ||
486 | } | ||
487 | |||
488 | this.Core.IndexElement(row, webAddress); | ||
489 | } | ||
490 | } | ||
491 | |||
492 | /// <summary> | ||
493 | /// Decompile the IIsWebApplication table. | ||
494 | /// </summary> | ||
495 | /// <param name="table">The table to decompile.</param> | ||
496 | private void DecompileIIsWebApplicationTable(Table table) | ||
497 | { | ||
498 | foreach (Row row in table.Rows) | ||
499 | { | ||
500 | IIs.WebApplication webApplication = new IIs.WebApplication(); | ||
501 | |||
502 | webApplication.Id = (string)row[0]; | ||
503 | |||
504 | webApplication.Name = (string)row[1]; | ||
505 | |||
506 | // these are not listed incorrectly - the order is low, high, medium | ||
507 | switch ((int)row[2]) | ||
508 | { | ||
509 | case 0: | ||
510 | webApplication.Isolation = IIs.WebApplication.IsolationType.low; | ||
511 | break; | ||
512 | case 1: | ||
513 | webApplication.Isolation = IIs.WebApplication.IsolationType.high; | ||
514 | break; | ||
515 | case 2: | ||
516 | webApplication.Isolation = IIs.WebApplication.IsolationType.medium; | ||
517 | break; | ||
518 | default: | ||
519 | // TODO: warn | ||
520 | break; | ||
521 | } | ||
522 | |||
523 | if (null != row[3]) | ||
524 | { | ||
525 | switch ((int)row[3]) | ||
526 | { | ||
527 | case 0: | ||
528 | webApplication.AllowSessions = IIs.YesNoDefaultType.no; | ||
529 | break; | ||
530 | case 1: | ||
531 | webApplication.AllowSessions = IIs.YesNoDefaultType.yes; | ||
532 | break; | ||
533 | default: | ||
534 | // TODO: warn | ||
535 | break; | ||
536 | } | ||
537 | } | ||
538 | |||
539 | if (null != row[4]) | ||
540 | { | ||
541 | webApplication.SessionTimeout = (int)row[4]; | ||
542 | } | ||
543 | |||
544 | if (null != row[5]) | ||
545 | { | ||
546 | switch ((int)row[5]) | ||
547 | { | ||
548 | case 0: | ||
549 | webApplication.Buffer = IIs.YesNoDefaultType.no; | ||
550 | break; | ||
551 | case 1: | ||
552 | webApplication.Buffer = IIs.YesNoDefaultType.yes; | ||
553 | break; | ||
554 | default: | ||
555 | // TODO: warn | ||
556 | break; | ||
557 | } | ||
558 | } | ||
559 | |||
560 | if (null != row[6]) | ||
561 | { | ||
562 | switch ((int)row[6]) | ||
563 | { | ||
564 | case 0: | ||
565 | webApplication.ParentPaths = IIs.YesNoDefaultType.no; | ||
566 | break; | ||
567 | case 1: | ||
568 | webApplication.ParentPaths = IIs.YesNoDefaultType.yes; | ||
569 | break; | ||
570 | default: | ||
571 | // TODO: warn | ||
572 | break; | ||
573 | } | ||
574 | } | ||
575 | |||
576 | if (null != row[7]) | ||
577 | { | ||
578 | switch ((string)row[7]) | ||
579 | { | ||
580 | case "JScript": | ||
581 | webApplication.DefaultScript = IIs.WebApplication.DefaultScriptType.JScript; | ||
582 | break; | ||
583 | case "VBScript": | ||
584 | webApplication.DefaultScript = IIs.WebApplication.DefaultScriptType.VBScript; | ||
585 | break; | ||
586 | default: | ||
587 | // TODO: warn | ||
588 | break; | ||
589 | } | ||
590 | } | ||
591 | |||
592 | if (null != row[8]) | ||
593 | { | ||
594 | webApplication.ScriptTimeout = (int)row[8]; | ||
595 | } | ||
596 | |||
597 | if (null != row[9]) | ||
598 | { | ||
599 | switch ((int)row[9]) | ||
600 | { | ||
601 | case 0: | ||
602 | webApplication.ServerDebugging = IIs.YesNoDefaultType.no; | ||
603 | break; | ||
604 | case 1: | ||
605 | webApplication.ServerDebugging = IIs.YesNoDefaultType.yes; | ||
606 | break; | ||
607 | default: | ||
608 | // TODO: warn | ||
609 | break; | ||
610 | } | ||
611 | } | ||
612 | |||
613 | if (null != row[10]) | ||
614 | { | ||
615 | switch ((int)row[10]) | ||
616 | { | ||
617 | case 0: | ||
618 | webApplication.ClientDebugging = IIs.YesNoDefaultType.no; | ||
619 | break; | ||
620 | case 1: | ||
621 | webApplication.ClientDebugging = IIs.YesNoDefaultType.yes; | ||
622 | break; | ||
623 | default: | ||
624 | // TODO: warn | ||
625 | break; | ||
626 | } | ||
627 | } | ||
628 | |||
629 | if (null != row[11]) | ||
630 | { | ||
631 | webApplication.WebAppPool = (string)row[11]; | ||
632 | } | ||
633 | |||
634 | this.Core.IndexElement(row, webApplication); | ||
635 | } | ||
636 | } | ||
637 | |||
638 | /// <summary> | ||
639 | /// Decompile the IIsWebDirProperties table. | ||
640 | /// </summary> | ||
641 | /// <param name="table">The table to decompile.</param> | ||
642 | private void DecompileIIsWebDirPropertiesTable(Table table) | ||
643 | { | ||
644 | foreach (Row row in table.Rows) | ||
645 | { | ||
646 | IIs.WebDirProperties webDirProperties = new IIs.WebDirProperties(); | ||
647 | |||
648 | webDirProperties.Id = (string)row[0]; | ||
649 | |||
650 | if (null != row[1]) | ||
651 | { | ||
652 | int access = (int)row[1]; | ||
653 | |||
654 | if (0x1 == (access & 0x1)) | ||
655 | { | ||
656 | webDirProperties.Read = IIs.YesNoType.yes; | ||
657 | } | ||
658 | |||
659 | if (0x2 == (access & 0x2)) | ||
660 | { | ||
661 | webDirProperties.Write = IIs.YesNoType.yes; | ||
662 | } | ||
663 | |||
664 | if (0x4 == (access & 0x4)) | ||
665 | { | ||
666 | webDirProperties.Execute = IIs.YesNoType.yes; | ||
667 | } | ||
668 | |||
669 | if (0x200 == (access & 0x200)) | ||
670 | { | ||
671 | webDirProperties.Script = IIs.YesNoType.yes; | ||
672 | } | ||
673 | } | ||
674 | |||
675 | if (null != row[2]) | ||
676 | { | ||
677 | int authorization = (int)row[2]; | ||
678 | |||
679 | if (0x1 == (authorization & 0x1)) | ||
680 | { | ||
681 | webDirProperties.AnonymousAccess = IIs.YesNoType.yes; | ||
682 | } | ||
683 | else // set one of the properties to 'no' to force the output value to be '0' if not other attributes are set | ||
684 | { | ||
685 | webDirProperties.AnonymousAccess = IIs.YesNoType.no; | ||
686 | } | ||
687 | |||
688 | if (0x2 == (authorization & 0x2)) | ||
689 | { | ||
690 | webDirProperties.BasicAuthentication = IIs.YesNoType.yes; | ||
691 | } | ||
692 | |||
693 | if (0x4 == (authorization & 0x4)) | ||
694 | { | ||
695 | webDirProperties.WindowsAuthentication = IIs.YesNoType.yes; | ||
696 | } | ||
697 | |||
698 | if (0x10 == (authorization & 0x10)) | ||
699 | { | ||
700 | webDirProperties.DigestAuthentication = IIs.YesNoType.yes; | ||
701 | } | ||
702 | |||
703 | if (0x40 == (authorization & 0x40)) | ||
704 | { | ||
705 | webDirProperties.PassportAuthentication = IIs.YesNoType.yes; | ||
706 | } | ||
707 | } | ||
708 | |||
709 | if (null != row[3]) | ||
710 | { | ||
711 | webDirProperties.AnonymousUser = (string)row[3]; | ||
712 | } | ||
713 | |||
714 | if (null != row[4] && 1 == (int)row[4]) | ||
715 | { | ||
716 | webDirProperties.IIsControlledPassword = IIs.YesNoType.yes; | ||
717 | } | ||
718 | |||
719 | if (null != row[5]) | ||
720 | { | ||
721 | switch ((int)row[5]) | ||
722 | { | ||
723 | case 0: | ||
724 | webDirProperties.LogVisits = IIs.YesNoType.no; | ||
725 | break; | ||
726 | case 1: | ||
727 | webDirProperties.LogVisits = IIs.YesNoType.yes; | ||
728 | break; | ||
729 | default: | ||
730 | // TODO: warn | ||
731 | break; | ||
732 | } | ||
733 | } | ||
734 | |||
735 | if (null != row[6]) | ||
736 | { | ||
737 | switch ((int)row[6]) | ||
738 | { | ||
739 | case 0: | ||
740 | webDirProperties.Index = IIs.YesNoType.no; | ||
741 | break; | ||
742 | case 1: | ||
743 | webDirProperties.Index = IIs.YesNoType.yes; | ||
744 | break; | ||
745 | default: | ||
746 | // TODO: warn | ||
747 | break; | ||
748 | } | ||
749 | } | ||
750 | |||
751 | if (null != row[7]) | ||
752 | { | ||
753 | webDirProperties.DefaultDocuments = (string)row[7]; | ||
754 | } | ||
755 | |||
756 | if (null != row[8]) | ||
757 | { | ||
758 | switch ((int)row[8]) | ||
759 | { | ||
760 | case 0: | ||
761 | webDirProperties.AspDetailedError = IIs.YesNoType.no; | ||
762 | break; | ||
763 | case 1: | ||
764 | webDirProperties.AspDetailedError = IIs.YesNoType.yes; | ||
765 | break; | ||
766 | default: | ||
767 | // TODO: warn | ||
768 | break; | ||
769 | } | ||
770 | } | ||
771 | |||
772 | if (null != row[9]) | ||
773 | { | ||
774 | webDirProperties.HttpExpires = (string)row[9]; | ||
775 | } | ||
776 | |||
777 | if (null != row[10]) | ||
778 | { | ||
779 | // force the value to be a positive number | ||
780 | webDirProperties.CacheControlMaxAge = unchecked((uint)(int)row[10]); | ||
781 | } | ||
782 | |||
783 | if (null != row[11]) | ||
784 | { | ||
785 | webDirProperties.CacheControlCustom = (string)row[11]; | ||
786 | } | ||
787 | |||
788 | if (null != row[12]) | ||
789 | { | ||
790 | switch ((int)row[8]) | ||
791 | { | ||
792 | case 0: | ||
793 | webDirProperties.ClearCustomError = IIs.YesNoType.no; | ||
794 | break; | ||
795 | case 1: | ||
796 | webDirProperties.ClearCustomError = IIs.YesNoType.yes; | ||
797 | break; | ||
798 | default: | ||
799 | // TODO: warn | ||
800 | break; | ||
801 | } | ||
802 | } | ||
803 | |||
804 | if (null != row[13]) | ||
805 | { | ||
806 | int accessSSLFlags = (int)row[13]; | ||
807 | |||
808 | if (0x8 == (accessSSLFlags & 0x8)) | ||
809 | { | ||
810 | webDirProperties.AccessSSL = IIs.YesNoType.yes; | ||
811 | } | ||
812 | |||
813 | if (0x20 == (accessSSLFlags & 0x20)) | ||
814 | { | ||
815 | webDirProperties.AccessSSLNegotiateCert = IIs.YesNoType.yes; | ||
816 | } | ||
817 | |||
818 | if (0x40 == (accessSSLFlags & 0x40)) | ||
819 | { | ||
820 | webDirProperties.AccessSSLRequireCert = IIs.YesNoType.yes; | ||
821 | } | ||
822 | |||
823 | if (0x80 == (accessSSLFlags & 0x80)) | ||
824 | { | ||
825 | webDirProperties.AccessSSLMapCert = IIs.YesNoType.yes; | ||
826 | } | ||
827 | |||
828 | if (0x100 == (accessSSLFlags & 0x100)) | ||
829 | { | ||
830 | webDirProperties.AccessSSL128 = IIs.YesNoType.yes; | ||
831 | } | ||
832 | } | ||
833 | |||
834 | if (null != row[14]) | ||
835 | { | ||
836 | webDirProperties.AuthenticationProviders = (string)row[14]; | ||
837 | } | ||
838 | |||
839 | this.Core.RootElement.AddChild(webDirProperties); | ||
840 | } | ||
841 | } | ||
842 | |||
843 | /// <summary> | ||
844 | /// Decompile the IIsWebError table. | ||
845 | /// </summary> | ||
846 | /// <param name="table">The table to decompile.</param> | ||
847 | private void DecompileIIsWebErrorTable(Table table) | ||
848 | { | ||
849 | foreach (Row row in table.Rows) | ||
850 | { | ||
851 | IIs.WebError webError = new IIs.WebError(); | ||
852 | |||
853 | webError.ErrorCode = (int)row[0]; | ||
854 | |||
855 | webError.SubCode = (int)row[1]; | ||
856 | |||
857 | // the ParentType and ParentValue columns are handled in FinalizeIIsWebErrorTable | ||
858 | |||
859 | if (null != row[4]) | ||
860 | { | ||
861 | webError.File = (string)row[4]; | ||
862 | } | ||
863 | |||
864 | if (null != row[5]) | ||
865 | { | ||
866 | webError.URL = (string)row[5]; | ||
867 | } | ||
868 | |||
869 | this.Core.IndexElement(row, webError); | ||
870 | } | ||
871 | } | ||
872 | |||
873 | /// <summary> | ||
874 | /// Decompile the IIsFilter table. | ||
875 | /// </summary> | ||
876 | /// <param name="table">The table to decompile.</param> | ||
877 | private void DecompileIIsFilterTable(Table table) | ||
878 | { | ||
879 | foreach (Row row in table.Rows) | ||
880 | { | ||
881 | IIs.WebFilter webFilter = new IIs.WebFilter(); | ||
882 | |||
883 | webFilter.Id = (string)row[0]; | ||
884 | |||
885 | webFilter.Name = (string)row[1]; | ||
886 | |||
887 | if (null != row[3]) | ||
888 | { | ||
889 | webFilter.Path = (string)row[3]; | ||
890 | } | ||
891 | |||
892 | if (null != row[5]) | ||
893 | { | ||
894 | webFilter.Description = (string)row[5]; | ||
895 | } | ||
896 | |||
897 | webFilter.Flags = (int)row[6]; | ||
898 | |||
899 | if (null != row[7]) | ||
900 | { | ||
901 | switch ((int)row[7]) | ||
902 | { | ||
903 | case (-1): | ||
904 | webFilter.LoadOrder = "last"; | ||
905 | break; | ||
906 | case 0: | ||
907 | webFilter.LoadOrder = "first"; | ||
908 | break; | ||
909 | default: | ||
910 | webFilter.LoadOrder = Convert.ToString((int)row[7], CultureInfo.InvariantCulture); | ||
911 | break; | ||
912 | } | ||
913 | } | ||
914 | |||
915 | if (null != row[4]) | ||
916 | { | ||
917 | IIs.WebSite webSite = (IIs.WebSite)this.Core.GetIndexedElement("IIsWebSite", (string)row[4]); | ||
918 | |||
919 | if (null != webSite) | ||
920 | { | ||
921 | webSite.AddChild(webFilter); | ||
922 | } | ||
923 | else | ||
924 | { | ||
925 | this.Core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Web_", (string)row[4], "IIsWebSite")); | ||
926 | } | ||
927 | } | ||
928 | else // Component parent | ||
929 | { | ||
930 | Wix.Component component = (Wix.Component)this.Core.GetIndexedElement("Component", (string)row[2]); | ||
931 | |||
932 | if (null != component) | ||
933 | { | ||
934 | component.AddChild(webFilter); | ||
935 | } | ||
936 | else | ||
937 | { | ||
938 | this.Core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Component_", (string)row[2], "Component")); | ||
939 | } | ||
940 | } | ||
941 | } | ||
942 | } | ||
943 | |||
944 | /// <summary> | ||
945 | /// Decompile the IIsWebLog table. | ||
946 | /// </summary> | ||
947 | /// <param name="table">The table to decompile.</param> | ||
948 | private void DecompileIIsWebLogTable(Table table) | ||
949 | { | ||
950 | foreach (Row row in table.Rows) | ||
951 | { | ||
952 | IIs.WebLog webLog = new IIs.WebLog(); | ||
953 | |||
954 | webLog.Id = (string)row[0]; | ||
955 | |||
956 | switch ((string)row[1]) | ||
957 | { | ||
958 | case "Microsoft IIS Log File Format": | ||
959 | webLog.Type = IIs.WebLog.TypeType.IIS; | ||
960 | break; | ||
961 | case "NCSA Common Log File Format": | ||
962 | webLog.Type = IIs.WebLog.TypeType.NCSA; | ||
963 | break; | ||
964 | case "none": | ||
965 | webLog.Type = IIs.WebLog.TypeType.none; | ||
966 | break; | ||
967 | case "ODBC Logging": | ||
968 | webLog.Type = IIs.WebLog.TypeType.ODBC; | ||
969 | break; | ||
970 | case "W3C Extended Log File Format": | ||
971 | webLog.Type = IIs.WebLog.TypeType.W3C; | ||
972 | break; | ||
973 | default: | ||
974 | // TODO: warn | ||
975 | break; | ||
976 | } | ||
977 | |||
978 | this.Core.RootElement.AddChild(webLog); | ||
979 | } | ||
980 | } | ||
981 | |||
982 | /// <summary> | ||
983 | /// Decompile the IIsWebServiceExtension table. | ||
984 | /// </summary> | ||
985 | /// <param name="table">The table to decompile.</param> | ||
986 | private void DecompileIIsWebServiceExtensionTable(Table table) | ||
987 | { | ||
988 | foreach (Row row in table.Rows) | ||
989 | { | ||
990 | IIs.WebServiceExtension webServiceExtension = new IIs.WebServiceExtension(); | ||
991 | |||
992 | webServiceExtension.Id = (string)row[0]; | ||
993 | |||
994 | webServiceExtension.File = (string)row[2]; | ||
995 | |||
996 | if (null != row[3]) | ||
997 | { | ||
998 | webServiceExtension.Description = (string)row[3]; | ||
999 | } | ||
1000 | |||
1001 | if (null != row[4]) | ||
1002 | { | ||
1003 | webServiceExtension.Group = (string)row[4]; | ||
1004 | } | ||
1005 | |||
1006 | int attributes = (int)row[5]; | ||
1007 | |||
1008 | if (0x1 == (attributes & 0x1)) | ||
1009 | { | ||
1010 | webServiceExtension.Allow = IIs.YesNoType.yes; | ||
1011 | } | ||
1012 | else | ||
1013 | { | ||
1014 | webServiceExtension.Allow = IIs.YesNoType.no; | ||
1015 | } | ||
1016 | |||
1017 | if (0x2 == (attributes & 0x2)) | ||
1018 | { | ||
1019 | webServiceExtension.UIDeletable = IIs.YesNoType.yes; | ||
1020 | } | ||
1021 | |||
1022 | Wix.Component component = (Wix.Component)this.Core.GetIndexedElement("Component", (string)row[1]); | ||
1023 | if (null != component) | ||
1024 | { | ||
1025 | component.AddChild(webServiceExtension); | ||
1026 | } | ||
1027 | else | ||
1028 | { | ||
1029 | this.Core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Component_", (string)row[1], "Component")); | ||
1030 | } | ||
1031 | } | ||
1032 | } | ||
1033 | |||
1034 | /// <summary> | ||
1035 | /// Decompile the IIsWebSite table. | ||
1036 | /// </summary> | ||
1037 | /// <param name="table">The table to decompile.</param> | ||
1038 | private void DecompileIIsWebSiteTable(Table table) | ||
1039 | { | ||
1040 | foreach (Row row in table.Rows) | ||
1041 | { | ||
1042 | IIs.WebSite webSite = new IIs.WebSite(); | ||
1043 | |||
1044 | webSite.Id = (string)row[0]; | ||
1045 | |||
1046 | if (null != row[2]) | ||
1047 | { | ||
1048 | webSite.Description = (string)row[2]; | ||
1049 | } | ||
1050 | |||
1051 | if (null != row[3]) | ||
1052 | { | ||
1053 | webSite.ConnectionTimeout = (int)row[3]; | ||
1054 | } | ||
1055 | |||
1056 | if (null != row[4]) | ||
1057 | { | ||
1058 | webSite.Directory = (string)row[4]; | ||
1059 | } | ||
1060 | |||
1061 | if (null != row[5]) | ||
1062 | { | ||
1063 | switch ((int)row[5]) | ||
1064 | { | ||
1065 | case 0: | ||
1066 | // this is the default | ||
1067 | break; | ||
1068 | case 1: | ||
1069 | webSite.StartOnInstall = IIs.YesNoType.yes; | ||
1070 | break; | ||
1071 | case 2: | ||
1072 | webSite.AutoStart = IIs.YesNoType.yes; | ||
1073 | break; | ||
1074 | default: | ||
1075 | // TODO: warn | ||
1076 | break; | ||
1077 | } | ||
1078 | } | ||
1079 | |||
1080 | if (null != row[6]) | ||
1081 | { | ||
1082 | int attributes = (int)row[6]; | ||
1083 | |||
1084 | if (0x2 == (attributes & 0x2)) | ||
1085 | { | ||
1086 | webSite.ConfigureIfExists = IIs.YesNoType.no; | ||
1087 | } | ||
1088 | } | ||
1089 | |||
1090 | // the KeyAddress_ column is handled in FinalizeWebAddressTable | ||
1091 | |||
1092 | if (null != row[8]) | ||
1093 | { | ||
1094 | webSite.DirProperties = (string)row[8]; | ||
1095 | } | ||
1096 | |||
1097 | // the Application_ column is handled in FinalizeIIsWebApplicationTable | ||
1098 | |||
1099 | if (null != row[10]) | ||
1100 | { | ||
1101 | if (-1 != (int)row[10]) | ||
1102 | { | ||
1103 | webSite.Sequence = (int)row[10]; | ||
1104 | } | ||
1105 | } | ||
1106 | |||
1107 | if (null != row[11]) | ||
1108 | { | ||
1109 | webSite.WebLog = (string)row[11]; | ||
1110 | } | ||
1111 | |||
1112 | if (null != row[12]) | ||
1113 | { | ||
1114 | webSite.SiteId = (string)row[12]; | ||
1115 | } | ||
1116 | |||
1117 | if (null != row[1]) | ||
1118 | { | ||
1119 | Wix.Component component = (Wix.Component)this.Core.GetIndexedElement("Component", (string)row[1]); | ||
1120 | |||
1121 | if (null != component) | ||
1122 | { | ||
1123 | component.AddChild(webSite); | ||
1124 | } | ||
1125 | else | ||
1126 | { | ||
1127 | this.Core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Component_", (string)row[1], "Component")); | ||
1128 | } | ||
1129 | } | ||
1130 | else | ||
1131 | { | ||
1132 | this.Core.RootElement.AddChild(webSite); | ||
1133 | } | ||
1134 | this.Core.IndexElement(row, webSite); | ||
1135 | } | ||
1136 | } | ||
1137 | |||
1138 | /// <summary> | ||
1139 | /// Decompile the IIsWebVirtualDir table. | ||
1140 | /// </summary> | ||
1141 | /// <param name="table">The table to decompile.</param> | ||
1142 | private void DecompileIIsWebVirtualDirTable(Table table) | ||
1143 | { | ||
1144 | foreach (Row row in table.Rows) | ||
1145 | { | ||
1146 | IIs.WebVirtualDir webVirtualDir = new IIs.WebVirtualDir(); | ||
1147 | |||
1148 | webVirtualDir.Id = (string)row[0]; | ||
1149 | |||
1150 | // the Component_ and Web_ columns are handled in FinalizeIIsWebVirtualDirTable | ||
1151 | |||
1152 | webVirtualDir.Alias = (string)row[3]; | ||
1153 | |||
1154 | webVirtualDir.Directory = (string)row[4]; | ||
1155 | |||
1156 | if (null != row[5]) | ||
1157 | { | ||
1158 | webVirtualDir.DirProperties = (string)row[5]; | ||
1159 | } | ||
1160 | |||
1161 | // the Application_ column is handled in FinalizeIIsWebApplicationTable | ||
1162 | |||
1163 | this.Core.IndexElement(row, webVirtualDir); | ||
1164 | } | ||
1165 | } | ||
1166 | |||
1167 | /// <summary> | ||
1168 | /// Decompile the IIsWebSiteCertificates table. | ||
1169 | /// </summary> | ||
1170 | /// <param name="table">The table to decompile.</param> | ||
1171 | private void DecompileIIsWebSiteCertificatesTable(Table table) | ||
1172 | { | ||
1173 | foreach (Row row in table.Rows) | ||
1174 | { | ||
1175 | IIs.CertificateRef certificateRef = new IIs.CertificateRef(); | ||
1176 | |||
1177 | certificateRef.Id = (string)row[1]; | ||
1178 | |||
1179 | this.Core.IndexElement(row, certificateRef); | ||
1180 | } | ||
1181 | } | ||
1182 | |||
1183 | /// <summary> | ||
1184 | /// Finalize the IIsHttpHeader table. | ||
1185 | /// </summary> | ||
1186 | /// <param name="tables">The collection of all tables.</param> | ||
1187 | /// <remarks> | ||
1188 | /// The IIsHttpHeader table supports multiple parent types so no foreign key | ||
1189 | /// is declared and thus nesting must be done late. | ||
1190 | /// </remarks> | ||
1191 | private void FinalizeIIsHttpHeaderTable(TableIndexedCollection tables) | ||
1192 | { | ||
1193 | Table iisHttpHeaderTable = tables["IIsHttpHeader"]; | ||
1194 | |||
1195 | if (null != iisHttpHeaderTable) | ||
1196 | { | ||
1197 | foreach (Row row in iisHttpHeaderTable.Rows) | ||
1198 | { | ||
1199 | IIs.HttpHeader httpHeader = (IIs.HttpHeader)this.Core.GetIndexedElement(row); | ||
1200 | |||
1201 | if (1 == (int)row[1]) | ||
1202 | { | ||
1203 | IIs.WebVirtualDir webVirtualDir = (IIs.WebVirtualDir)this.Core.GetIndexedElement("IIsWebVirtualDir", (string)row[2]); | ||
1204 | if (null != webVirtualDir) | ||
1205 | { | ||
1206 | webVirtualDir.AddChild(httpHeader); | ||
1207 | } | ||
1208 | else | ||
1209 | { | ||
1210 | this.Core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, iisHttpHeaderTable.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "ParentValue", (string)row[2], "IIsWebVirtualDir")); | ||
1211 | } | ||
1212 | } | ||
1213 | else if (2 == (int)row[1]) | ||
1214 | { | ||
1215 | IIs.WebSite webSite = (IIs.WebSite)this.Core.GetIndexedElement("IIsWebSite", (string)row[2]); | ||
1216 | if (null != webSite) | ||
1217 | { | ||
1218 | webSite.AddChild(httpHeader); | ||
1219 | } | ||
1220 | else | ||
1221 | { | ||
1222 | this.Core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, iisHttpHeaderTable.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "ParentValue", (string)row[2], "IIsWebSite")); | ||
1223 | } | ||
1224 | } | ||
1225 | } | ||
1226 | } | ||
1227 | } | ||
1228 | |||
1229 | /// <summary> | ||
1230 | /// Finalize the IIsMimeMap table. | ||
1231 | /// </summary> | ||
1232 | /// <param name="tables">The collection of all tables.</param> | ||
1233 | /// <remarks> | ||
1234 | /// The IIsMimeMap table supports multiple parent types so no foreign key | ||
1235 | /// is declared and thus nesting must be done late. | ||
1236 | /// </remarks> | ||
1237 | private void FinalizeIIsMimeMapTable(TableIndexedCollection tables) | ||
1238 | { | ||
1239 | Table iisMimeMapTable = tables["IIsMimeMap"]; | ||
1240 | |||
1241 | if (null != iisMimeMapTable) | ||
1242 | { | ||
1243 | foreach (Row row in iisMimeMapTable.Rows) | ||
1244 | { | ||
1245 | IIs.MimeMap mimeMap = (IIs.MimeMap)this.Core.GetIndexedElement(row); | ||
1246 | |||
1247 | if (2 < (int)row[1] || 0 >= (int)row[1]) | ||
1248 | { | ||
1249 | // TODO: warn about unknown parent type | ||
1250 | } | ||
1251 | |||
1252 | IIs.WebVirtualDir webVirtualDir = (IIs.WebVirtualDir)this.Core.GetIndexedElement("IIsWebVirtualDir", (string)row[2]); | ||
1253 | IIs.WebSite webSite = (IIs.WebSite)this.Core.GetIndexedElement("IIsWebSite", (string)row[2]); | ||
1254 | if (null != webVirtualDir) | ||
1255 | { | ||
1256 | webVirtualDir.AddChild(mimeMap); | ||
1257 | } | ||
1258 | else if (null != webSite) | ||
1259 | { | ||
1260 | webSite.AddChild(mimeMap); | ||
1261 | } | ||
1262 | else | ||
1263 | { | ||
1264 | this.Core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, iisMimeMapTable.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "ParentValue", (string)row[2], "IIsWebVirtualDir")); | ||
1265 | } | ||
1266 | } | ||
1267 | } | ||
1268 | } | ||
1269 | |||
1270 | /// <summary> | ||
1271 | /// Finalize the IIsWebApplication table. | ||
1272 | /// </summary> | ||
1273 | /// <param name="tables">The collection of all tables.</param> | ||
1274 | /// <remarks> | ||
1275 | /// Since WebApplication elements may nest under a specific WebSite or | ||
1276 | /// WebVirtualDir (or just the root element), the nesting must be done late. | ||
1277 | /// </remarks> | ||
1278 | private void FinalizeIIsWebApplicationTable(TableIndexedCollection tables) | ||
1279 | { | ||
1280 | Table iisWebApplicationTable = tables["IIsWebApplication"]; | ||
1281 | Table iisWebSiteTable = tables["IIsWebSite"]; | ||
1282 | Table iisWebVirtualDirTable = tables["IIsWebVirtualDir"]; | ||
1283 | |||
1284 | Hashtable addedWebApplications = new Hashtable(); | ||
1285 | |||
1286 | if (null != iisWebSiteTable) | ||
1287 | { | ||
1288 | foreach (Row row in iisWebSiteTable.Rows) | ||
1289 | { | ||
1290 | if (null != row[9]) | ||
1291 | { | ||
1292 | IIs.WebSite webSite = (IIs.WebSite)this.Core.GetIndexedElement(row); | ||
1293 | |||
1294 | IIs.WebApplication webApplication = (IIs.WebApplication)this.Core.GetIndexedElement("IIsWebApplication", (string)row[9]); | ||
1295 | if (null != webApplication) | ||
1296 | { | ||
1297 | webSite.AddChild(webApplication); | ||
1298 | addedWebApplications[webApplication] = null; | ||
1299 | } | ||
1300 | else | ||
1301 | { | ||
1302 | this.Core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, iisWebSiteTable.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Application_", (string)row[9], "IIsWebApplication")); | ||
1303 | } | ||
1304 | } | ||
1305 | } | ||
1306 | } | ||
1307 | |||
1308 | if (null != iisWebVirtualDirTable) | ||
1309 | { | ||
1310 | foreach (Row row in iisWebVirtualDirTable.Rows) | ||
1311 | { | ||
1312 | if (null != row[6]) | ||
1313 | { | ||
1314 | IIs.WebVirtualDir webVirtualDir = (IIs.WebVirtualDir)this.Core.GetIndexedElement(row); | ||
1315 | |||
1316 | IIs.WebApplication webApplication = (IIs.WebApplication)this.Core.GetIndexedElement("IIsWebApplication", (string)row[6]); | ||
1317 | if (null != webApplication) | ||
1318 | { | ||
1319 | webVirtualDir.AddChild(webApplication); | ||
1320 | addedWebApplications[webApplication] = null; | ||
1321 | } | ||
1322 | else | ||
1323 | { | ||
1324 | this.Core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, iisWebVirtualDirTable.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Application_", (string)row[6], "IIsWebApplication")); | ||
1325 | } | ||
1326 | } | ||
1327 | } | ||
1328 | } | ||
1329 | |||
1330 | if (null != iisWebApplicationTable) | ||
1331 | { | ||
1332 | foreach (Row row in iisWebApplicationTable.Rows) | ||
1333 | { | ||
1334 | IIs.WebApplication webApplication = (IIs.WebApplication)this.Core.GetIndexedElement(row); | ||
1335 | |||
1336 | if (!addedWebApplications.Contains(webApplication)) | ||
1337 | { | ||
1338 | this.Core.RootElement.AddChild(webApplication); | ||
1339 | } | ||
1340 | } | ||
1341 | } | ||
1342 | } | ||
1343 | |||
1344 | /// <summary> | ||
1345 | /// Finalize the IIsWebError table. | ||
1346 | /// </summary> | ||
1347 | /// <param name="tables">The collection of all tables.</param> | ||
1348 | /// <remarks> | ||
1349 | /// Since there is no foreign key relationship declared for this table | ||
1350 | /// (because it takes various parent types), it must be nested late. | ||
1351 | /// </remarks> | ||
1352 | private void FinalizeIIsWebErrorTable(TableIndexedCollection tables) | ||
1353 | { | ||
1354 | Table iisWebErrorTable = tables["IIsWebError"]; | ||
1355 | |||
1356 | if (null != iisWebErrorTable) | ||
1357 | { | ||
1358 | foreach (Row row in iisWebErrorTable.Rows) | ||
1359 | { | ||
1360 | IIs.WebError webError = (IIs.WebError)this.Core.GetIndexedElement(row); | ||
1361 | |||
1362 | if (1 == (int)row[2]) // WebVirtualDir parent | ||
1363 | { | ||
1364 | IIs.WebVirtualDir webVirtualDir = (IIs.WebVirtualDir)this.Core.GetIndexedElement("IIsWebVirtualDir", (string)row[3]); | ||
1365 | |||
1366 | if (null != webVirtualDir) | ||
1367 | { | ||
1368 | webVirtualDir.AddChild(webError); | ||
1369 | } | ||
1370 | else | ||
1371 | { | ||
1372 | this.Core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, iisWebErrorTable.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "ParentValue", (string)row[3], "IIsWebVirtualDir")); | ||
1373 | } | ||
1374 | } | ||
1375 | else if (2 == (int)row[2]) // WebSite parent | ||
1376 | { | ||
1377 | IIs.WebSite webSite = (IIs.WebSite)this.Core.GetIndexedElement("IIsWebSite", (string)row[3]); | ||
1378 | |||
1379 | if (null != webSite) | ||
1380 | { | ||
1381 | webSite.AddChild(webError); | ||
1382 | } | ||
1383 | else | ||
1384 | { | ||
1385 | this.Core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, iisWebErrorTable.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "ParentValue", (string)row[3], "IIsWebSite")); | ||
1386 | } | ||
1387 | } | ||
1388 | else | ||
1389 | { | ||
1390 | // TODO: warn unknown parent type | ||
1391 | } | ||
1392 | } | ||
1393 | } | ||
1394 | } | ||
1395 | |||
1396 | /// <summary> | ||
1397 | /// Finalize the IIsWebVirtualDir table. | ||
1398 | /// </summary> | ||
1399 | /// <param name="tables">The collection of all tables.</param> | ||
1400 | /// <remarks> | ||
1401 | /// WebVirtualDir elements nest under either a WebSite or component | ||
1402 | /// depending upon whether the component in the IIsWebVirtualDir row | ||
1403 | /// is the same as the one in the parent IIsWebSite row. | ||
1404 | /// </remarks> | ||
1405 | private void FinalizeIIsWebVirtualDirTable(TableIndexedCollection tables) | ||
1406 | { | ||
1407 | Table iisWebSiteTable = tables["IIsWebSite"]; | ||
1408 | Table iisWebVirtualDirTable = tables["IIsWebVirtualDir"]; | ||
1409 | |||
1410 | Hashtable iisWebSiteRows = new Hashtable(); | ||
1411 | |||
1412 | // index the IIsWebSite rows by their primary keys | ||
1413 | if (null != iisWebSiteTable) | ||
1414 | { | ||
1415 | foreach (Row row in iisWebSiteTable.Rows) | ||
1416 | { | ||
1417 | iisWebSiteRows.Add(row[0], row); | ||
1418 | } | ||
1419 | } | ||
1420 | |||
1421 | if (null != iisWebVirtualDirTable) | ||
1422 | { | ||
1423 | foreach (Row row in iisWebVirtualDirTable.Rows) | ||
1424 | { | ||
1425 | IIs.WebVirtualDir webVirtualDir = (IIs.WebVirtualDir)this.Core.GetIndexedElement(row); | ||
1426 | Row iisWebSiteRow = (Row)iisWebSiteRows[row[2]]; | ||
1427 | |||
1428 | if (null != iisWebSiteRow) | ||
1429 | { | ||
1430 | if ((string)iisWebSiteRow[1] == (string)row[1]) | ||
1431 | { | ||
1432 | IIs.WebSite webSite = (IIs.WebSite)this.Core.GetIndexedElement(iisWebSiteRow); | ||
1433 | |||
1434 | webSite.AddChild(webVirtualDir); | ||
1435 | } | ||
1436 | else | ||
1437 | { | ||
1438 | Wix.Component component = (Wix.Component)this.Core.GetIndexedElement("Component", (string)row[1]); | ||
1439 | |||
1440 | if (null != component) | ||
1441 | { | ||
1442 | webVirtualDir.WebSite = (string)row[2]; | ||
1443 | component.AddChild(webVirtualDir); | ||
1444 | } | ||
1445 | else | ||
1446 | { | ||
1447 | this.Core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, iisWebVirtualDirTable.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Component_", (string)row[1], "Component")); | ||
1448 | } | ||
1449 | } | ||
1450 | } | ||
1451 | else | ||
1452 | { | ||
1453 | this.Core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, iisWebVirtualDirTable.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Web_", (string)row[2], "IIsWebSite")); | ||
1454 | } | ||
1455 | } | ||
1456 | } | ||
1457 | } | ||
1458 | |||
1459 | /// <summary> | ||
1460 | /// Finalize the IIsWebSiteCertificates table. | ||
1461 | /// </summary> | ||
1462 | /// <param name="tables">The collection of all tables.</param> | ||
1463 | /// <remarks> | ||
1464 | /// This table creates CertificateRef elements which nest under WebSite | ||
1465 | /// elements. | ||
1466 | /// </remarks> | ||
1467 | private void FinalizeIIsWebSiteCertificatesTable(TableIndexedCollection tables) | ||
1468 | { | ||
1469 | Table IIsWebSiteCertificatesTable = tables["IIsWebSiteCertificates"]; | ||
1470 | |||
1471 | if (null != IIsWebSiteCertificatesTable) | ||
1472 | { | ||
1473 | foreach (Row row in IIsWebSiteCertificatesTable.Rows) | ||
1474 | { | ||
1475 | IIs.CertificateRef certificateRef = (IIs.CertificateRef)this.Core.GetIndexedElement(row); | ||
1476 | IIs.WebSite webSite = (IIs.WebSite)this.Core.GetIndexedElement("IIsWebSite", (string)row[0]); | ||
1477 | |||
1478 | if (null != webSite) | ||
1479 | { | ||
1480 | webSite.AddChild(certificateRef); | ||
1481 | } | ||
1482 | else | ||
1483 | { | ||
1484 | this.Core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, IIsWebSiteCertificatesTable.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Web_", (string)row[0], "IIsWebSite")); | ||
1485 | } | ||
1486 | } | ||
1487 | } | ||
1488 | } | ||
1489 | |||
1490 | /// <summary> | ||
1491 | /// Finalize the WebAddress table. | ||
1492 | /// </summary> | ||
1493 | /// <param name="tables">The collection of all tables.</param> | ||
1494 | /// <remarks> | ||
1495 | /// There is a circular dependency between the WebAddress and WebSite | ||
1496 | /// tables, so nesting must be handled here. | ||
1497 | /// </remarks> | ||
1498 | private void FinalizeWebAddressTable(TableIndexedCollection tables) | ||
1499 | { | ||
1500 | Table iisWebAddressTable = tables["IIsWebAddress"]; | ||
1501 | Table iisWebSiteTable = tables["IIsWebSite"]; | ||
1502 | |||
1503 | Hashtable addedWebAddresses = new Hashtable(); | ||
1504 | |||
1505 | if (null != iisWebSiteTable) | ||
1506 | { | ||
1507 | foreach (Row row in iisWebSiteTable.Rows) | ||
1508 | { | ||
1509 | IIs.WebSite webSite = (IIs.WebSite)this.Core.GetIndexedElement(row); | ||
1510 | |||
1511 | IIs.WebAddress webAddress = (IIs.WebAddress)this.Core.GetIndexedElement("IIsWebAddress", (string)row[7]); | ||
1512 | if (null != webAddress) | ||
1513 | { | ||
1514 | webSite.AddChild(webAddress); | ||
1515 | addedWebAddresses[webAddress] = null; | ||
1516 | } | ||
1517 | else | ||
1518 | { | ||
1519 | this.Core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, iisWebSiteTable.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "KeyAddress_", (string)row[7], "IIsWebAddress")); | ||
1520 | } | ||
1521 | } | ||
1522 | } | ||
1523 | |||
1524 | if (null != iisWebAddressTable) | ||
1525 | { | ||
1526 | foreach (Row row in iisWebAddressTable.Rows) | ||
1527 | { | ||
1528 | IIs.WebAddress webAddress = (IIs.WebAddress)this.Core.GetIndexedElement(row); | ||
1529 | |||
1530 | if (!addedWebAddresses.Contains(webAddress)) | ||
1531 | { | ||
1532 | IIs.WebSite webSite = (IIs.WebSite)this.Core.GetIndexedElement("IIsWebSite", (string)row[1]); | ||
1533 | |||
1534 | if (null != webSite) | ||
1535 | { | ||
1536 | webSite.AddChild(webAddress); | ||
1537 | } | ||
1538 | else | ||
1539 | { | ||
1540 | this.Core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, iisWebAddressTable.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Web_", (string)row[1], "IIsWebSite")); | ||
1541 | } | ||
1542 | } | ||
1543 | } | ||
1544 | } | ||
1545 | } | ||
1546 | } | ||
1547 | } | ||