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