aboutsummaryrefslogtreecommitdiff
path: root/src/ext/DifxApp/wixext/DifxAppDecompiler.cs
diff options
context:
space:
mode:
Diffstat (limited to 'src/ext/DifxApp/wixext/DifxAppDecompiler.cs')
-rw-r--r--src/ext/DifxApp/wixext/DifxAppDecompiler.cs98
1 files changed, 98 insertions, 0 deletions
diff --git a/src/ext/DifxApp/wixext/DifxAppDecompiler.cs b/src/ext/DifxApp/wixext/DifxAppDecompiler.cs
new file mode 100644
index 00000000..e41d8b98
--- /dev/null
+++ b/src/ext/DifxApp/wixext/DifxAppDecompiler.cs
@@ -0,0 +1,98 @@
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
3namespace WixToolset.DifxApp
4{
5#if TODO_CONSIDER_DECOMPILER
6 using System;
7 using System.Collections;
8 using System.Globalization;
9 using WixToolset.Data;
10 using WixToolset.Extensibility;
11 using DifxApp = WixToolset.Extensions.Serialize.DifxApp;
12 using Wix = WixToolset.Data.Serialize;
13
14 /// <summary>
15 /// The decompiler for the WiX Toolset Driver Install Frameworks for Applications Extension.
16 /// </summary>
17 public sealed class DifxAppDecompiler : DecompilerExtension
18 {
19 /// <summary>
20 /// Creates a decompiler for Gaming Extension.
21 /// </summary>
22 public DifxAppDecompiler()
23 {
24 this.TableDefinitions = DifxAppExtensionData.GetExtensionTableDefinitions();
25 }
26
27 /// <summary>
28 /// Decompiles an extension table.
29 /// </summary>
30 /// <param name="table">The table to decompile.</param>
31 public override void DecompileTable(Table table)
32 {
33 switch (table.Name)
34 {
35 case "MsiDriverPackages":
36 this.DecompileMsiDriverPackagesTable(table);
37 break;
38 default:
39 base.DecompileTable(table);
40 break;
41 }
42 }
43
44 /// <summary>
45 /// Decompile the MsiDriverPackages table.
46 /// </summary>
47 /// <param name="table">The table to decompile.</param>
48 private void DecompileMsiDriverPackagesTable(Table table)
49 {
50 foreach (Row row in table.Rows)
51 {
52 DifxApp.Driver driver = new DifxApp.Driver();
53
54 int attributes = (int)row[1];
55 if (0x1 == (attributes & 0x1))
56 {
57 driver.ForceInstall = DifxApp.YesNoType.yes;
58 }
59
60 if (0x2 == (attributes & 0x2))
61 {
62 driver.PlugAndPlayPrompt = DifxApp.YesNoType.no;
63 }
64
65 if (0x4 == (attributes & 0x4))
66 {
67 driver.AddRemovePrograms = DifxApp.YesNoType.no;
68 }
69
70 if (0x8 == (attributes & 0x8))
71 {
72 driver.Legacy = DifxApp.YesNoType.yes;
73 }
74
75 if (0x10 == (attributes & 0x10))
76 {
77 driver.DeleteFiles = DifxApp.YesNoType.yes;
78 }
79
80 if (null != row[2])
81 {
82 driver.Sequence = (int)row[2];
83 }
84
85 Wix.Component component = (Wix.Component)this.Core.GetIndexedElement("Component", (string)row[0]);
86 if (null != component)
87 {
88 component.AddChild(driver);
89 }
90 else
91 {
92 this.Core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Component", (string)row[0], "Component"));
93 }
94 }
95 }
96 }
97#endif
98}