diff options
Diffstat (limited to 'src/WixToolset.Converters.Tupleizer/ConvertTuplesCommand.cs')
| -rw-r--r-- | src/WixToolset.Converters.Tupleizer/ConvertTuplesCommand.cs | 82 |
1 files changed, 43 insertions, 39 deletions
diff --git a/src/WixToolset.Converters.Tupleizer/ConvertTuplesCommand.cs b/src/WixToolset.Converters.Tupleizer/ConvertTuplesCommand.cs index 007b9c62..b878f656 100644 --- a/src/WixToolset.Converters.Tupleizer/ConvertTuplesCommand.cs +++ b/src/WixToolset.Converters.Tupleizer/ConvertTuplesCommand.cs | |||
| @@ -23,16 +23,18 @@ namespace WixToolset.Converters.Tupleizer | |||
| 23 | var section = new IntermediateSection(String.Empty, OutputType3ToSectionType4(output.Type), output.Codepage); | 23 | var section = new IntermediateSection(String.Empty, OutputType3ToSectionType4(output.Type), output.Codepage); |
| 24 | 24 | ||
| 25 | var wixMediaByDiskId = IndexWixMediaTableByDiskId(output); | 25 | var wixMediaByDiskId = IndexWixMediaTableByDiskId(output); |
| 26 | var componentsById = IndexById<Wix3.Row>(output, "Component"); | ||
| 26 | var bindPathsById = IndexById<Wix3.Row>(output, "BindPath"); | 27 | var bindPathsById = IndexById<Wix3.Row>(output, "BindPath"); |
| 27 | var fontsById = IndexById<Wix3.Row>(output, "Font"); | 28 | var fontsById = IndexById<Wix3.Row>(output, "Font"); |
| 28 | var selfRegById = IndexById<Wix3.Row>(output, "SelfReg"); | 29 | var selfRegById = IndexById<Wix3.Row>(output, "SelfReg"); |
| 29 | var wixDirectoryById = IndexById<Wix3.Row>(output, "WixDirectory"); | 30 | var wixDirectoryById = IndexById<Wix3.Row>(output, "WixDirectory"); |
| 31 | var wixFileById = IndexById<Wix3.Row>(output, "WixFile"); | ||
| 30 | 32 | ||
| 31 | foreach (Wix3.Table table in output.Tables) | 33 | foreach (Wix3.Table table in output.Tables) |
| 32 | { | 34 | { |
| 33 | foreach (Wix3.Row row in table.Rows) | 35 | foreach (Wix3.Row row in table.Rows) |
| 34 | { | 36 | { |
| 35 | var tuple = GenerateTupleFromRow(row, wixMediaByDiskId, fontsById, bindPathsById, selfRegById, wixDirectoryById); | 37 | var tuple = GenerateTupleFromRow(row, wixMediaByDiskId, componentsById, fontsById, bindPathsById, selfRegById, wixFileById, wixDirectoryById); |
| 36 | if (tuple != null) | 38 | if (tuple != null) |
| 37 | { | 39 | { |
| 38 | section.Tuples.Add(tuple); | 40 | section.Tuples.Add(tuple); |
| @@ -75,7 +77,7 @@ namespace WixToolset.Converters.Tupleizer | |||
| 75 | return byId; | 77 | return byId; |
| 76 | } | 78 | } |
| 77 | 79 | ||
| 78 | private static IntermediateTuple GenerateTupleFromRow(Wix3.Row row, Dictionary<int, Wix3.WixMediaRow> wixMediaByDiskId, Dictionary<string, Wix3.Row> fontsById, Dictionary<string, Wix3.Row> bindPathsById, Dictionary<string, Wix3.Row> selfRegById, Dictionary<string, Wix3.Row> wixDirectoryById) | 80 | private static IntermediateTuple GenerateTupleFromRow(Wix3.Row row, Dictionary<int, Wix3.WixMediaRow> wixMediaByDiskId, Dictionary<string, Wix3.Row> componentsById, Dictionary<string, Wix3.Row> fontsById, Dictionary<string, Wix3.Row> bindPathsById, Dictionary<string, Wix3.Row> selfRegById, Dictionary<string, Wix3.Row> wixFileById, Dictionary<string, Wix3.Row> wixDirectoryById) |
| 79 | { | 81 | { |
| 80 | var name = row.Table.Name; | 82 | var name = row.Table.Name; |
| 81 | switch (name) | 83 | switch (name) |
| @@ -234,20 +236,15 @@ namespace WixToolset.Converters.Tupleizer | |||
| 234 | case "File": | 236 | case "File": |
| 235 | { | 237 | { |
| 236 | var attributes = FieldAsNullableInt(row, 6); | 238 | var attributes = FieldAsNullableInt(row, 6); |
| 237 | var readOnly = (attributes & WindowsInstallerConstants.MsidbFileAttributesReadOnly) == WindowsInstallerConstants.MsidbFileAttributesReadOnly; | 239 | |
| 238 | var hidden = (attributes & WindowsInstallerConstants.MsidbFileAttributesHidden) == WindowsInstallerConstants.MsidbFileAttributesHidden; | 240 | FileTupleAttributes tupleAttributes = 0; |
| 239 | var system = (attributes & WindowsInstallerConstants.MsidbFileAttributesSystem) == WindowsInstallerConstants.MsidbFileAttributesSystem; | 241 | tupleAttributes |= (attributes & WindowsInstallerConstants.MsidbFileAttributesReadOnly) == WindowsInstallerConstants.MsidbFileAttributesReadOnly ? FileTupleAttributes.ReadOnly : 0; |
| 240 | var vital = (attributes & WindowsInstallerConstants.MsidbFileAttributesVital) == WindowsInstallerConstants.MsidbFileAttributesVital; | 242 | tupleAttributes |= (attributes & WindowsInstallerConstants.MsidbFileAttributesHidden) == WindowsInstallerConstants.MsidbFileAttributesHidden ? FileTupleAttributes.Hidden : 0; |
| 241 | var checksum = (attributes & WindowsInstallerConstants.MsidbFileAttributesChecksum) == WindowsInstallerConstants.MsidbFileAttributesChecksum; | 243 | tupleAttributes |= (attributes & WindowsInstallerConstants.MsidbFileAttributesSystem) == WindowsInstallerConstants.MsidbFileAttributesSystem ? FileTupleAttributes.System : 0; |
| 242 | bool? compressed = null; | 244 | tupleAttributes |= (attributes & WindowsInstallerConstants.MsidbFileAttributesVital) == WindowsInstallerConstants.MsidbFileAttributesVital ? FileTupleAttributes.Vital : 0; |
| 243 | if ((attributes & WindowsInstallerConstants.MsidbFileAttributesNoncompressed) == WindowsInstallerConstants.MsidbFileAttributesNoncompressed) | 245 | tupleAttributes |= (attributes & WindowsInstallerConstants.MsidbFileAttributesChecksum) == WindowsInstallerConstants.MsidbFileAttributesChecksum ? FileTupleAttributes.Checksum : 0; |
| 244 | { | 246 | tupleAttributes |= (attributes & WindowsInstallerConstants.MsidbFileAttributesNoncompressed) == WindowsInstallerConstants.MsidbFileAttributesNoncompressed ? FileTupleAttributes.Uncompressed : 0; |
| 245 | compressed = false; | 247 | tupleAttributes |= (attributes & WindowsInstallerConstants.MsidbFileAttributesCompressed) == WindowsInstallerConstants.MsidbFileAttributesCompressed ? FileTupleAttributes.Compressed : 0; |
| 246 | } | ||
| 247 | else if ((attributes & WindowsInstallerConstants.MsidbFileAttributesCompressed) == WindowsInstallerConstants.MsidbFileAttributesCompressed) | ||
| 248 | { | ||
| 249 | compressed = true; | ||
| 250 | } | ||
| 251 | 248 | ||
| 252 | var id = FieldAsString(row, 0); | 249 | var id = FieldAsString(row, 0); |
| 253 | 250 | ||
| @@ -258,12 +255,7 @@ namespace WixToolset.Converters.Tupleizer | |||
| 258 | FileSize = FieldAsInt(row, 3), | 255 | FileSize = FieldAsInt(row, 3), |
| 259 | Version = FieldAsString(row, 4), | 256 | Version = FieldAsString(row, 4), |
| 260 | Language = FieldAsString(row, 5), | 257 | Language = FieldAsString(row, 5), |
| 261 | ReadOnly = readOnly, | 258 | Attributes = tupleAttributes |
| 262 | Hidden = hidden, | ||
| 263 | System = system, | ||
| 264 | Vital = vital, | ||
| 265 | Checksum = checksum, | ||
| 266 | Compressed = compressed, | ||
| 267 | }; | 259 | }; |
| 268 | 260 | ||
| 269 | if (bindPathsById.TryGetValue(id, out var bindPathRow)) | 261 | if (bindPathsById.TryGetValue(id, out var bindPathRow)) |
| @@ -281,6 +273,16 @@ namespace WixToolset.Converters.Tupleizer | |||
| 281 | tuple.SelfRegCost = FieldAsNullableInt(selfRegRow, 1) ?? 0; | 273 | tuple.SelfRegCost = FieldAsNullableInt(selfRegRow, 1) ?? 0; |
| 282 | } | 274 | } |
| 283 | 275 | ||
| 276 | if (wixFileById.TryGetValue(id, out var wixFileRow)) | ||
| 277 | { | ||
| 278 | tuple.DirectoryRef = FieldAsString(wixFileRow, 4); | ||
| 279 | tuple.DiskId = FieldAsNullableInt(wixFileRow, 5) ?? 0; | ||
| 280 | tuple.Source = new IntermediateFieldPathValue() { Path = FieldAsString(wixFileRow, 6) }; | ||
| 281 | tuple.PatchGroup = FieldAsInt(wixFileRow, 8); | ||
| 282 | tuple.Attributes |= FieldAsInt(wixFileRow, 9) != 0 ? FileTupleAttributes.GeneratedShortFileName : 0; | ||
| 283 | tuple.PatchAttributes = (PatchAttributeType)FieldAsInt(wixFileRow, 10); | ||
| 284 | } | ||
| 285 | |||
| 284 | return tuple; | 286 | return tuple; |
| 285 | } | 287 | } |
| 286 | case "Font": | 288 | case "Font": |
| @@ -321,7 +323,22 @@ namespace WixToolset.Converters.Tupleizer | |||
| 321 | case "MoveFile": | 323 | case "MoveFile": |
| 322 | return DefaultTupleFromRow(typeof(MoveFileTuple), row, columnZeroIsId: true); | 324 | return DefaultTupleFromRow(typeof(MoveFileTuple), row, columnZeroIsId: true); |
| 323 | case "MsiAssembly": | 325 | case "MsiAssembly": |
| 324 | return DefaultTupleFromRow(typeof(MsiAssemblyTuple), row, columnZeroIsId: false); | 326 | { |
| 327 | var componentId = FieldAsString(row, 0); | ||
| 328 | if (componentsById.TryGetValue(componentId, out var componentRow)) | ||
| 329 | { | ||
| 330 | return new AssemblyTuple(SourceLineNumber4(row.SourceLineNumbers), new Identifier(AccessModifier.Public, FieldAsString(componentRow, 5))) | ||
| 331 | { | ||
| 332 | ComponentRef = componentId, | ||
| 333 | FeatureRef = FieldAsString(row, 1), | ||
| 334 | ManifestFileRef = FieldAsString(row, 2), | ||
| 335 | ApplicationFileRef = FieldAsString(row, 3), | ||
| 336 | Type = FieldAsNullableInt(row, 4) == 1 ? AssemblyType.Win32Assembly : AssemblyType.DotNetAssembly, | ||
| 337 | }; | ||
| 338 | } | ||
| 339 | |||
| 340 | return null; | ||
| 341 | } | ||
| 325 | case "MsiLockPermissionsEx": | 342 | case "MsiLockPermissionsEx": |
| 326 | return DefaultTupleFromRow(typeof(MsiLockPermissionsExTuple), row, columnZeroIsId: true); | 343 | return DefaultTupleFromRow(typeof(MsiLockPermissionsExTuple), row, columnZeroIsId: true); |
| 327 | case "MsiShortcutProperty": | 344 | case "MsiShortcutProperty": |
| @@ -504,6 +521,7 @@ namespace WixToolset.Converters.Tupleizer | |||
| 504 | case "Verb": | 521 | case "Verb": |
| 505 | return DefaultTupleFromRow(typeof(VerbTuple), row, columnZeroIsId: false); | 522 | return DefaultTupleFromRow(typeof(VerbTuple), row, columnZeroIsId: false); |
| 506 | case "WixAction": | 523 | case "WixAction": |
| 524 | { | ||
| 507 | var sequenceTable = FieldAsString(row, 0); | 525 | var sequenceTable = FieldAsString(row, 0); |
| 508 | return new WixActionTuple(SourceLineNumber4(row.SourceLineNumbers)) | 526 | return new WixActionTuple(SourceLineNumber4(row.SourceLineNumbers)) |
| 509 | { | 527 | { |
| @@ -515,6 +533,7 @@ namespace WixToolset.Converters.Tupleizer | |||
| 515 | After = FieldAsString(row, 5), | 533 | After = FieldAsString(row, 5), |
| 516 | Overridable = FieldAsNullableInt(row, 6) != 0, | 534 | Overridable = FieldAsNullableInt(row, 6) != 0, |
| 517 | }; | 535 | }; |
| 536 | } | ||
| 518 | case "WixBootstrapperApplication": | 537 | case "WixBootstrapperApplication": |
| 519 | return DefaultTupleFromRow(typeof(WixBootstrapperApplicationTuple), row, columnZeroIsId: true); | 538 | return DefaultTupleFromRow(typeof(WixBootstrapperApplicationTuple), row, columnZeroIsId: true); |
| 520 | case "WixBundleContainer": | 539 | case "WixBundleContainer": |
| @@ -525,25 +544,10 @@ namespace WixToolset.Converters.Tupleizer | |||
| 525 | return DefaultTupleFromRow(typeof(WixChainItemTuple), row, columnZeroIsId: true); | 544 | return DefaultTupleFromRow(typeof(WixChainItemTuple), row, columnZeroIsId: true); |
| 526 | case "WixCustomTable": | 545 | case "WixCustomTable": |
| 527 | return DefaultTupleFromRow(typeof(WixCustomTableTuple), row, columnZeroIsId: true); | 546 | return DefaultTupleFromRow(typeof(WixCustomTableTuple), row, columnZeroIsId: true); |
| 528 | case "WixDeltaPatchFile": | ||
| 529 | return DefaultTupleFromRow(typeof(WixDeltaPatchFileTuple), row, columnZeroIsId: true); | ||
| 530 | case "WixDirectory": | 547 | case "WixDirectory": |
| 531 | return null; | 548 | return null; |
| 532 | case "WixFile": | 549 | case "WixFile": |
| 533 | var assemblyAttributes3 = FieldAsNullableInt(row, 1); | 550 | return null; |
| 534 | return new WixFileTuple(SourceLineNumber4(row.SourceLineNumbers), new Identifier(AccessModifier.Public, FieldAsString(row, 0))) | ||
| 535 | { | ||
| 536 | AssemblyType = assemblyAttributes3 == 0 ? FileAssemblyType.DotNetAssembly : assemblyAttributes3 == 1 ? FileAssemblyType.Win32Assembly : FileAssemblyType.NotAnAssembly, | ||
| 537 | AssemblyManifestFileRef = FieldAsString(row, 2), | ||
| 538 | AssemblyApplicationFileRef = FieldAsString(row, 3), | ||
| 539 | DirectoryRef = FieldAsString(row, 4), | ||
| 540 | DiskId = FieldAsNullableInt(row, 5) ?? 0, | ||
| 541 | Source = new IntermediateFieldPathValue() { Path = FieldAsString(row, 6) }, | ||
| 542 | ProcessorArchitecture = FieldAsString(row, 7), | ||
| 543 | PatchGroup = FieldAsInt(row, 8), | ||
| 544 | Attributes = FieldAsInt(row, 9), | ||
| 545 | PatchAttributes = (PatchAttributeType)FieldAsInt(row, 10), | ||
| 546 | }; | ||
| 547 | case "WixInstanceTransforms": | 551 | case "WixInstanceTransforms": |
| 548 | return DefaultTupleFromRow(typeof(WixInstanceTransformsTuple), row, columnZeroIsId: true); | 552 | return DefaultTupleFromRow(typeof(WixInstanceTransformsTuple), row, columnZeroIsId: true); |
| 549 | case "WixMedia": | 553 | case "WixMedia": |
