From 1b61862e5292f007624868e0f40e50a593383200 Mon Sep 17 00:00:00 2001 From: Sean Hall Date: Wed, 30 Mar 2022 17:06:19 -0500 Subject: Fix formatting on some bundle files. --- src/wix/WixToolset.Core.Burn/Bundles/BurnCommon.cs | 145 +- src/wix/WixToolset.Core.Burn/Bundles/BurnWriter.cs | 23 +- .../Bundles/GetPackageFacadesCommand.cs | 80 +- src/wix/WixToolset.Core/Compiler_Bundle.cs | 1500 ++++++++++---------- .../Link/FlattenAndProcessBundleTablesCommand.cs | 1 - 5 files changed, 874 insertions(+), 875 deletions(-) (limited to 'src') diff --git a/src/wix/WixToolset.Core.Burn/Bundles/BurnCommon.cs b/src/wix/WixToolset.Core.Burn/Bundles/BurnCommon.cs index 733f7c00..08183f32 100644 --- a/src/wix/WixToolset.Core.Burn/Bundles/BurnCommon.cs +++ b/src/wix/WixToolset.Core.Burn/Bundles/BurnCommon.cs @@ -31,31 +31,31 @@ namespace WixToolset.Core.Burn.Bundles // See WinNT.h for details about the PE format, including the // structure and offsets for IMAGE_DOS_HEADER, IMAGE_NT_HEADERS32, // IMAGE_FILE_HEADER, etc. - protected const UInt32 IMAGE_DOS_HEADER_SIZE = 64; - protected const UInt32 IMAGE_DOS_HEADER_OFFSET_MAGIC = 0; - protected const UInt32 IMAGE_DOS_HEADER_OFFSET_NTHEADER = 60; + protected const uint IMAGE_DOS_HEADER_SIZE = 64; + protected const uint IMAGE_DOS_HEADER_OFFSET_MAGIC = 0; + protected const uint IMAGE_DOS_HEADER_OFFSET_NTHEADER = 60; - protected const UInt32 IMAGE_NT_HEADER_SIZE = 24; // signature DWORD (4) + IMAGE_FILE_HEADER (20) - protected const UInt32 IMAGE_NT_HEADER_OFFSET_SIGNATURE = 0; - protected const UInt32 IMAGE_NT_HEADER_OFFSET_NUMBEROFSECTIONS = 6; - protected const UInt32 IMAGE_NT_HEADER_OFFSET_SIZEOFOPTIONALHEADER = 20; + protected const uint IMAGE_NT_HEADER_SIZE = 24; // signature DWORD (4) + IMAGE_FILE_HEADER (20) + protected const uint IMAGE_NT_HEADER_OFFSET_SIGNATURE = 0; + protected const uint IMAGE_NT_HEADER_OFFSET_NUMBEROFSECTIONS = 6; + protected const uint IMAGE_NT_HEADER_OFFSET_SIZEOFOPTIONALHEADER = 20; - protected const UInt32 IMAGE_OPTIONAL_OFFSET_CHECKSUM = 4 * 16; // checksum is 16 DWORDs into IMAGE_OPTIONAL_HEADER which is right after the IMAGE_NT_HEADER. - protected const UInt32 IMAGE_OPTIONAL_NEGATIVE_OFFSET_CERTIFICATETABLE = (IMAGE_DATA_DIRECTORY_SIZE * (IMAGE_NUMBEROF_DIRECTORY_ENTRIES - IMAGE_DIRECTORY_ENTRY_SECURITY)); + protected const uint IMAGE_OPTIONAL_OFFSET_CHECKSUM = 4 * 16; // checksum is 16 DWORDs into IMAGE_OPTIONAL_HEADER which is right after the IMAGE_NT_HEADER. + protected const uint IMAGE_OPTIONAL_NEGATIVE_OFFSET_CERTIFICATETABLE = (IMAGE_DATA_DIRECTORY_SIZE * (IMAGE_NUMBEROF_DIRECTORY_ENTRIES - IMAGE_DIRECTORY_ENTRY_SECURITY)); - protected const UInt32 IMAGE_SECTION_HEADER_SIZE = 40; - protected const UInt32 IMAGE_SECTION_HEADER_OFFSET_NAME = 0; - protected const UInt32 IMAGE_SECTION_HEADER_OFFSET_VIRTUALSIZE = 8; - protected const UInt32 IMAGE_SECTION_HEADER_OFFSET_SIZEOFRAWDATA = 16; - protected const UInt32 IMAGE_SECTION_HEADER_OFFSET_POINTERTORAWDATA = 20; + protected const uint IMAGE_SECTION_HEADER_SIZE = 40; + protected const uint IMAGE_SECTION_HEADER_OFFSET_NAME = 0; + protected const uint IMAGE_SECTION_HEADER_OFFSET_VIRTUALSIZE = 8; + protected const uint IMAGE_SECTION_HEADER_OFFSET_SIZEOFRAWDATA = 16; + protected const uint IMAGE_SECTION_HEADER_OFFSET_POINTERTORAWDATA = 20; - protected const UInt32 IMAGE_DATA_DIRECTORY_SIZE = 8; // struct of two DWORDs. - protected const UInt32 IMAGE_DIRECTORY_ENTRY_SECURITY = 4; - protected const UInt32 IMAGE_NUMBEROF_DIRECTORY_ENTRIES = 16; + protected const uint IMAGE_DATA_DIRECTORY_SIZE = 8; // struct of two DWORDs. + protected const uint IMAGE_DIRECTORY_ENTRY_SECURITY = 4; + protected const uint IMAGE_NUMBEROF_DIRECTORY_ENTRIES = 16; - protected const UInt16 IMAGE_DOS_SIGNATURE = 0x5A4D; - protected const UInt32 IMAGE_NT_SIGNATURE = 0x00004550; - protected const UInt64 IMAGE_SECTION_WIXBURN_NAME = 0x6E7275627869772E; // ".wixburn", as a qword. + protected const ushort IMAGE_DOS_SIGNATURE = 0x5A4D; + protected const uint IMAGE_NT_SIGNATURE = 0x00004550; + protected const ulong IMAGE_SECTION_WIXBURN_NAME = 0x6E7275627869772E; // ".wixburn", as a qword. // The ".wixburn" section contains: // 0- 3: magic number @@ -69,32 +69,32 @@ namespace WixToolset.Core.Burn.Bundles // 44-47: container count // 48-51: byte count of manifest + UX container // 52-512: byte count of attached containers (4 bytes for each container) - protected const UInt32 BURN_SECTION_OFFSET_MAGIC = 0; - protected const UInt32 BURN_SECTION_OFFSET_VERSION = 4; - protected const UInt32 BURN_SECTION_OFFSET_BUNDLEGUID = 8; - protected const UInt32 BURN_SECTION_OFFSET_STUBSIZE = 24; - protected const UInt32 BURN_SECTION_OFFSET_ORIGINALCHECKSUM = 28; - protected const UInt32 BURN_SECTION_OFFSET_ORIGINALSIGNATUREOFFSET = 32; - protected const UInt32 BURN_SECTION_OFFSET_ORIGINALSIGNATURESIZE = 36; - protected const UInt32 BURN_SECTION_OFFSET_FORMAT = 40; - protected const UInt32 BURN_SECTION_OFFSET_COUNT = 44; - protected const UInt32 BURN_SECTION_OFFSET_UXSIZE = 48; - protected const UInt32 BURN_SECTION_OFFSET_ATTACHEDCONTAINERSIZE0 = 52; - protected const UInt32 BURN_SECTION_MIN_SIZE = BURN_SECTION_OFFSET_ATTACHEDCONTAINERSIZE0; - - protected const UInt32 BURN_SECTION_MAGIC = 0x00f14300; - protected const UInt32 BURN_SECTION_VERSION = 0x00000002; + protected const uint BURN_SECTION_OFFSET_MAGIC = 0; + protected const uint BURN_SECTION_OFFSET_VERSION = 4; + protected const uint BURN_SECTION_OFFSET_BUNDLEGUID = 8; + protected const uint BURN_SECTION_OFFSET_STUBSIZE = 24; + protected const uint BURN_SECTION_OFFSET_ORIGINALCHECKSUM = 28; + protected const uint BURN_SECTION_OFFSET_ORIGINALSIGNATUREOFFSET = 32; + protected const uint BURN_SECTION_OFFSET_ORIGINALSIGNATURESIZE = 36; + protected const uint BURN_SECTION_OFFSET_FORMAT = 40; + protected const uint BURN_SECTION_OFFSET_COUNT = 44; + protected const uint BURN_SECTION_OFFSET_UXSIZE = 48; + protected const uint BURN_SECTION_OFFSET_ATTACHEDCONTAINERSIZE0 = 52; + protected const uint BURN_SECTION_MIN_SIZE = BURN_SECTION_OFFSET_ATTACHEDCONTAINERSIZE0; + + protected const uint BURN_SECTION_MAGIC = 0x00f14300; + protected const uint BURN_SECTION_VERSION = 0x00000002; protected string fileExe; - protected UInt32 peOffset = UInt32.MaxValue; - protected UInt16 sections = UInt16.MaxValue; - protected UInt32 firstSectionOffset = UInt32.MaxValue; - protected UInt32 checksumOffset; - protected UInt32 certificateTableSignatureOffset; - protected UInt32 certificateTableSignatureSize; - protected UInt32 wixburnDataOffset = UInt32.MaxValue; - protected UInt32 wixburnRawDataSize; - protected UInt32 wixburnMaxContainers; + protected uint peOffset = UInt32.MaxValue; + protected ushort sections = UInt16.MaxValue; + protected uint firstSectionOffset = UInt32.MaxValue; + protected uint checksumOffset; + protected uint certificateTableSignatureOffset; + protected uint certificateTableSignatureSize; + protected uint wixburnDataOffset = UInt32.MaxValue; + protected uint wixburnRawDataSize; + protected uint wixburnMaxContainers; // TODO: does this enum exist in another form somewhere? /// @@ -104,7 +104,7 @@ namespace WixToolset.Core.Burn.Bundles { Nothing = 0, UX, - Attached + Attached, } /// @@ -119,16 +119,16 @@ namespace WixToolset.Core.Burn.Bundles this.AttachedContainers = new List(); } - public UInt32 Checksum { get; protected set; } - public UInt32 SignatureOffset { get; protected set; } - public UInt32 SignatureSize { get; protected set; } - public UInt32 Version { get; protected set; } - public UInt32 StubSize { get; protected set; } - public UInt32 OriginalChecksum { get; protected set; } - public UInt32 OriginalSignatureOffset { get; protected set; } - public UInt32 OriginalSignatureSize { get; protected set; } - public UInt32 EngineSize { get; protected set; } - public UInt32 UXAddress { get { return this.StubSize; } } + public uint Checksum { get; protected set; } + public uint SignatureOffset { get; protected set; } + public uint SignatureSize { get; protected set; } + public uint Version { get; protected set; } + public uint StubSize { get; protected set; } + public uint OriginalChecksum { get; protected set; } + public uint OriginalSignatureOffset { get; protected set; } + public uint OriginalSignatureSize { get; protected set; } + public uint EngineSize { get; protected set; } + public uint UXAddress { get { return this.StubSize; } } public List AttachedContainers { get; protected set; } protected IMessaging Messaging { get; } @@ -179,10 +179,9 @@ namespace WixToolset.Core.Burn.Bundles } reader.BaseStream.Seek(this.wixburnDataOffset, SeekOrigin.Begin); - byte[] bytes = reader.ReadBytes((int)this.wixburnRawDataSize); - UInt32 uint32 = 0; + var bytes = reader.ReadBytes((int)this.wixburnRawDataSize); - uint32 = BurnCommon.ReadUInt32(bytes, BURN_SECTION_OFFSET_MAGIC); + var uint32 = BurnCommon.ReadUInt32(bytes, BURN_SECTION_OFFSET_MAGIC); if (BURN_SECTION_MAGIC != uint32) { this.Messaging.Write(ErrorMessages.InvalidBundle(this.fileExe)); @@ -208,7 +207,7 @@ namespace WixToolset.Core.Burn.Bundles this.OriginalSignatureOffset = BurnCommon.ReadUInt32(bytes, BURN_SECTION_OFFSET_ORIGINALSIGNATUREOFFSET); this.OriginalSignatureSize = BurnCommon.ReadUInt32(bytes, BURN_SECTION_OFFSET_ORIGINALSIGNATURESIZE); - uint containerCount = BurnCommon.ReadUInt32(bytes, BURN_SECTION_OFFSET_COUNT); + var containerCount = BurnCommon.ReadUInt32(bytes, BURN_SECTION_OFFSET_COUNT); uint uxSize = 0; if (this.wixburnMaxContainers < containerCount) { @@ -221,7 +220,7 @@ namespace WixToolset.Core.Burn.Bundles for (uint i = 0; i < containerCount; ++i) { uint sizeOffset = BURN_SECTION_OFFSET_UXSIZE + (i * 4); - uint size = BurnCommon.ReadUInt32(bytes, sizeOffset); + var size = BurnCommon.ReadUInt32(bytes, sizeOffset); this.AttachedContainers.Add(new ContainerSlot(size)); } uxSize = this.AttachedContainers[0].Size; @@ -261,11 +260,11 @@ namespace WixToolset.Core.Burn.Bundles return false; } - UInt32 wixburnSectionOffset = UInt32.MaxValue; - byte[] bytes = new byte[IMAGE_SECTION_HEADER_SIZE]; + var wixburnSectionOffset = UInt32.MaxValue; + var bytes = new byte[IMAGE_SECTION_HEADER_SIZE]; reader.BaseStream.Seek(this.firstSectionOffset, SeekOrigin.Begin); - for (UInt16 sectionIndex = 0; sectionIndex < this.sections; ++sectionIndex) + for (ushort sectionIndex = 0; sectionIndex < this.sections; ++sectionIndex) { reader.Read(bytes, 0, bytes.Length); @@ -292,7 +291,7 @@ namespace WixToolset.Core.Burn.Bundles return false; } - this.wixburnMaxContainers = (this.wixburnRawDataSize - BURN_SECTION_OFFSET_UXSIZE) / sizeof(UInt32); + this.wixburnMaxContainers = (this.wixburnRawDataSize - BURN_SECTION_OFFSET_UXSIZE) / sizeof(uint); this.wixburnDataOffset = BurnCommon.ReadUInt32(bytes, IMAGE_SECTION_HEADER_OFFSET_POINTERTORAWDATA); } @@ -313,7 +312,7 @@ namespace WixToolset.Core.Burn.Bundles } reader.BaseStream.Seek(this.peOffset, SeekOrigin.Begin); - byte[] bytes = reader.ReadBytes((int)IMAGE_NT_HEADER_SIZE); + var bytes = reader.ReadBytes((int)IMAGE_NT_HEADER_SIZE); // Verify the NT signature... if (IMAGE_NT_SIGNATURE != BurnCommon.ReadUInt32(bytes, IMAGE_NT_HEADER_OFFSET_SIGNATURE)) @@ -322,7 +321,7 @@ namespace WixToolset.Core.Burn.Bundles return false; } - ushort sizeOptionalHeader = BurnCommon.ReadUInt16(bytes, IMAGE_NT_HEADER_OFFSET_SIZEOFOPTIONALHEADER); + var sizeOptionalHeader = BurnCommon.ReadUInt16(bytes, IMAGE_NT_HEADER_OFFSET_SIZEOFOPTIONALHEADER); this.sections = BurnCommon.ReadUInt16(bytes, IMAGE_NT_HEADER_OFFSET_NUMBEROFSECTIONS); this.firstSectionOffset = this.peOffset + IMAGE_NT_HEADER_SIZE + sizeOptionalHeader; @@ -348,7 +347,7 @@ namespace WixToolset.Core.Burn.Bundles { if (UInt32.MaxValue == this.peOffset) { - byte[] bytes = reader.ReadBytes((int)IMAGE_DOS_HEADER_SIZE); + var bytes = reader.ReadBytes((int)IMAGE_DOS_HEADER_SIZE); // Verify the DOS 'MZ' signature. if (IMAGE_DOS_SIGNATURE != BurnCommon.ReadUInt16(bytes, IMAGE_DOS_HEADER_OFFSET_MAGIC)) @@ -369,10 +368,10 @@ namespace WixToolset.Core.Burn.Bundles /// Array from which to read. /// Beginning offset from which to read. /// value at offset - internal static UInt16 ReadUInt16(byte[] bytes, UInt32 offset) + internal static ushort ReadUInt16(byte[] bytes, uint offset) { Debug.Assert(offset + 2 <= bytes.Length); - return (UInt16)(bytes[offset] + (bytes[offset + 1] << 8)); + return (ushort)(bytes[offset] + (bytes[offset + 1] << 8)); } /// @@ -381,10 +380,10 @@ namespace WixToolset.Core.Burn.Bundles /// Array from which to read. /// Beginning offset from which to read. /// value at offset - internal static UInt32 ReadUInt32(byte[] bytes, UInt32 offset) + internal static uint ReadUInt32(byte[] bytes, uint offset) { Debug.Assert(offset + 4 <= bytes.Length); - return BurnCommon.ReadUInt16(bytes, offset) + ((UInt32)BurnCommon.ReadUInt16(bytes, offset + 2) << 16); + return BurnCommon.ReadUInt16(bytes, offset) + ((uint)BurnCommon.ReadUInt16(bytes, offset + 2) << 16); } /// @@ -393,10 +392,10 @@ namespace WixToolset.Core.Burn.Bundles /// Array from which to read. /// Beginning offset from which to read. /// value at offset - internal static UInt64 ReadUInt64(byte[] bytes, UInt32 offset) + internal static ulong ReadUInt64(byte[] bytes, uint offset) { Debug.Assert(offset + 8 <= bytes.Length); - return BurnCommon.ReadUInt32(bytes, offset) + ((UInt64)BurnCommon.ReadUInt32(bytes, offset + 4) << 32); + return BurnCommon.ReadUInt32(bytes, offset) + ((ulong)BurnCommon.ReadUInt32(bytes, offset + 4) << 32); } } diff --git a/src/wix/WixToolset.Core.Burn/Bundles/BurnWriter.cs b/src/wix/WixToolset.Core.Burn/Bundles/BurnWriter.cs index 46835974..5800f5c0 100644 --- a/src/wix/WixToolset.Core.Burn/Bundles/BurnWriter.cs +++ b/src/wix/WixToolset.Core.Burn/Bundles/BurnWriter.cs @@ -44,9 +44,9 @@ namespace WixToolset.Core.Burn.Bundles /// Burn writer. public static BurnWriter Open(IMessaging messaging, string fileExe) { - BurnWriter writer = new BurnWriter(messaging, fileExe); + var writer = new BurnWriter(messaging, fileExe); - using (BinaryReader binaryReader = new BinaryReader(File.Open(fileExe, FileMode.Open, FileAccess.Read, FileShare.Read | FileShare.Delete))) + using (var binaryReader = new BinaryReader(File.Open(fileExe, FileMode.Open, FileAccess.Read, FileShare.Read | FileShare.Delete))) { if (!writer.Initialize(binaryReader)) { @@ -93,7 +93,7 @@ namespace WixToolset.Core.Burn.Bundles this.WriteToBurnSectionOffset(BURN_SECTION_OFFSET_FORMAT, 1); // Hard-coded to CAB for now. this.AttachedContainers.Clear(); this.WriteToBurnSectionOffset(BURN_SECTION_OFFSET_COUNT, 0); - for (uint i = BURN_SECTION_OFFSET_UXSIZE; i < this.wixburnMaxContainers; i += sizeof(UInt32)) + for (var i = BURN_SECTION_OFFSET_UXSIZE; i < this.wixburnMaxContainers; i += sizeof(uint)) { this.WriteToBurnSectionOffset(i, 0); } @@ -112,7 +112,7 @@ namespace WixToolset.Core.Burn.Bundles /// true if the container data is successfully appended; false otherwise public bool AppendContainer(string fileContainer, BurnCommon.Container container) { - using (FileStream reader = File.OpenRead(fileContainer)) + using (var reader = File.OpenRead(fileContainer)) { return this.AppendContainer(reader, reader.Length, container); } @@ -136,10 +136,10 @@ namespace WixToolset.Core.Burn.Bundles this.AttachedContainers.Clear(); this.AttachedContainers.Add(uxContainerSlot); - uint nextAddress = this.EngineSize; - for (int i = 1; i < reader.AttachedContainers.Count; i++) + var nextAddress = this.EngineSize; + for (var i = 1; i < reader.AttachedContainers.Count; i++) { - ContainerSlot cntnr = reader.AttachedContainers[i]; + var cntnr = reader.AttachedContainers[i]; reader.Stream.Seek(nextAddress, SeekOrigin.Begin); // TODO: verify that the size in the section data is 0 or the same size. @@ -160,8 +160,8 @@ namespace WixToolset.Core.Burn.Bundles /// true if the container data is successfully appended; false otherwise public bool AppendContainer(Stream containerStream, long containerSize, BurnCommon.Container container) { - uint containerCount = (uint)this.AttachedContainers.Count; - uint burnSectionOffsetSize = BURN_SECTION_OFFSET_UXSIZE + (containerCount * sizeof(UInt32)); + var containerCount = (uint)this.AttachedContainers.Count; + uint burnSectionOffsetSize = BURN_SECTION_OFFSET_UXSIZE + (containerCount * sizeof(uint)); var containerSlot = new ContainerSlot((uint)containerSize); switch (container) @@ -239,13 +239,14 @@ namespace WixToolset.Core.Burn.Bundles /// Offset of size field for this container in ".wixburn" section data. /// Number of Burn sections. /// true if the container data is successfully appended; false otherwise - private bool AppendContainer(Stream containerStream, UInt32 containerSize, UInt32 burnSectionOffsetSize, UInt32 burnSectionCount) + private bool AppendContainer(Stream containerStream, uint containerSize, uint burnSectionOffsetSize, uint burnSectionCount) { if (this.invalidBundle) { return false; } - if (burnSectionOffsetSize > (this.wixburnRawDataSize - sizeof(UInt32))) + + if (burnSectionOffsetSize > (this.wixburnRawDataSize - sizeof(uint))) { this.invalidBundle = true; this.Messaging.Write(BurnBackendErrors.TooManyAttachedContainers(this.wixburnMaxContainers)); diff --git a/src/wix/WixToolset.Core.Burn/Bundles/GetPackageFacadesCommand.cs b/src/wix/WixToolset.Core.Burn/Bundles/GetPackageFacadesCommand.cs index b8b256fd..2bf22a3d 100644 --- a/src/wix/WixToolset.Core.Burn/Bundles/GetPackageFacadesCommand.cs +++ b/src/wix/WixToolset.Core.Burn/Bundles/GetPackageFacadesCommand.cs @@ -129,49 +129,49 @@ namespace WixToolset.Core.Burn.Bundles switch (package.Type) { - case WixBundlePackageType.Exe: - if (exePackages.TryGetValue(id, out var exePackage)) - { - facades.Add(id, new PackageFacade(package, exePackage)); - } - else - { - this.Messaging.Write(ErrorMessages.IdentifierNotFound("WixBundleExePackage", id)); - } - break; + case WixBundlePackageType.Exe: + if (exePackages.TryGetValue(id, out var exePackage)) + { + facades.Add(id, new PackageFacade(package, exePackage)); + } + else + { + this.Messaging.Write(ErrorMessages.IdentifierNotFound("WixBundleExePackage", id)); + } + break; - case WixBundlePackageType.Msi: - if (msiPackages.TryGetValue(id, out var msiPackage)) - { - facades.Add(id, new PackageFacade(package, msiPackage)); - } - else - { - this.Messaging.Write(ErrorMessages.IdentifierNotFound("WixBundleMsiPackage", id)); - } - break; + case WixBundlePackageType.Msi: + if (msiPackages.TryGetValue(id, out var msiPackage)) + { + facades.Add(id, new PackageFacade(package, msiPackage)); + } + else + { + this.Messaging.Write(ErrorMessages.IdentifierNotFound("WixBundleMsiPackage", id)); + } + break; - case WixBundlePackageType.Msp: - if (mspPackages.TryGetValue(id, out var mspPackage)) - { - facades.Add(id, new PackageFacade(package, mspPackage)); - } - else - { - this.Messaging.Write(ErrorMessages.IdentifierNotFound("WixBundleMspPackage", id)); - } - break; + case WixBundlePackageType.Msp: + if (mspPackages.TryGetValue(id, out var mspPackage)) + { + facades.Add(id, new PackageFacade(package, mspPackage)); + } + else + { + this.Messaging.Write(ErrorMessages.IdentifierNotFound("WixBundleMspPackage", id)); + } + break; - case WixBundlePackageType.Msu: - if (msuPackages.TryGetValue(id, out var msuPackage)) - { - facades.Add(id, new PackageFacade(package, msuPackage)); - } - else - { - this.Messaging.Write(ErrorMessages.IdentifierNotFound("WixBundleMsuPackage", id)); - } - break; + case WixBundlePackageType.Msu: + if (msuPackages.TryGetValue(id, out var msuPackage)) + { + facades.Add(id, new PackageFacade(package, msuPackage)); + } + else + { + this.Messaging.Write(ErrorMessages.IdentifierNotFound("WixBundleMsuPackage", id)); + } + break; } } diff --git a/src/wix/WixToolset.Core/Compiler_Bundle.cs b/src/wix/WixToolset.Core/Compiler_Bundle.cs index 2f31c774..f671e90b 100644 --- a/src/wix/WixToolset.Core/Compiler_Bundle.cs +++ b/src/wix/WixToolset.Core/Compiler_Bundle.cs @@ -40,36 +40,36 @@ namespace WixToolset.Core { switch (attrib.Name.LocalName) { - case "Id": - id = this.Core.GetAttributeIdentifier(sourceLineNumbers, attrib); - break; - case "Bitness": - var bitnessValue = this.Core.GetAttributeValue(sourceLineNumbers, attrib); - switch (bitnessValue) - { - case "always32": - win64 = false; + case "Id": + id = this.Core.GetAttributeIdentifier(sourceLineNumbers, attrib); + break; + case "Bitness": + var bitnessValue = this.Core.GetAttributeValue(sourceLineNumbers, attrib); + switch (bitnessValue) + { + case "always32": + win64 = false; + break; + case "always64": + win64 = true; + break; + case "default": + case "": + break; + default: + this.Core.Write(ErrorMessages.IllegalAttributeValue(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, bitnessValue, "default", "always32", "always64")); + break; + } break; - case "always64": - win64 = true; + case "Key": + key = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; - case "default": - case "": + case "Value": + valueName = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; default: - this.Core.Write(ErrorMessages.IllegalAttributeValue(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, bitnessValue, "default", "always32", "always64")); + this.Core.UnexpectedAttribute(node, attrib); break; - } - break; - case "Key": - key = this.Core.GetAttributeValue(sourceLineNumbers, attrib); - break; - case "Value": - valueName = this.Core.GetAttributeValue(sourceLineNumbers, attrib); - break; - default: - this.Core.UnexpectedAttribute(node, attrib); - break; } } else @@ -133,7 +133,7 @@ namespace WixToolset.Core string parentName = null; string fileSystemSafeBundleName = null; - string logVariablePrefixAndExtension = null; + string logVariablePrefixAndExtension; string iconSourceFile = null; string splashScreenSourceFile = null; @@ -144,98 +144,98 @@ namespace WixToolset.Core { switch (attrib.Name.LocalName) { - case "AboutUrl": - aboutUrl = this.Core.GetAttributeValue(sourceLineNumbers, attrib); - break; - case "CommandLineVariables": - var commandLineVariablesValue = this.Core.GetAttributeValue(sourceLineNumbers, attrib); - switch (commandLineVariablesValue) - { - case "upperCase": - commandLineVariables = WixBundleCommandLineVariables.UpperCase; + case "AboutUrl": + aboutUrl = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; - case "caseSensitive": - commandLineVariables = WixBundleCommandLineVariables.CaseSensitive; + case "CommandLineVariables": + var commandLineVariablesValue = this.Core.GetAttributeValue(sourceLineNumbers, attrib); + switch (commandLineVariablesValue) + { + case "upperCase": + commandLineVariables = WixBundleCommandLineVariables.UpperCase; + break; + case "caseSensitive": + commandLineVariables = WixBundleCommandLineVariables.CaseSensitive; + break; + default: + this.Core.Write(ErrorMessages.IllegalAttributeValue(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, commandLineVariablesValue, "upperCase", "caseSensitive")); + break; + } break; - default: - this.Core.Write(ErrorMessages.IllegalAttributeValue(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, commandLineVariablesValue, "upperCase", "caseSensitive")); + case "Compressed": + compressed = this.Core.GetAttributeYesNoDefaultValue(sourceLineNumbers, attrib); break; - } - break; - case "Compressed": - compressed = this.Core.GetAttributeYesNoDefaultValue(sourceLineNumbers, attrib); - break; - case "Condition": - condition = this.Core.GetAttributeValue(sourceLineNumbers, attrib); - break; - case "Copyright": - copyright = this.Core.GetAttributeValue(sourceLineNumbers, attrib); - break; - case "DisableModify": - var value = this.Core.GetAttributeValue(sourceLineNumbers, attrib); - switch (value) - { - case "button": - attributes |= WixBundleAttributes.SingleChangeUninstallButton; + case "Condition": + condition = this.Core.GetAttributeValue(sourceLineNumbers, attrib); + break; + case "Copyright": + copyright = this.Core.GetAttributeValue(sourceLineNumbers, attrib); + break; + case "DisableModify": + var value = this.Core.GetAttributeValue(sourceLineNumbers, attrib); + switch (value) + { + case "button": + attributes |= WixBundleAttributes.SingleChangeUninstallButton; + break; + case "yes": + attributes |= WixBundleAttributes.DisableModify; + break; + case "no": + break; + default: + this.Core.Write(ErrorMessages.IllegalAttributeValue(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, value, "button", "yes", "no")); + break; + } + break; + case "DisableRemove": + if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) + { + attributes |= WixBundleAttributes.DisableRemove; + } + break; + case "HelpTelephone": + helpTelephone = this.Core.GetAttributeValue(sourceLineNumbers, attrib); + break; + case "HelpUrl": + helpUrl = this.Core.GetAttributeValue(sourceLineNumbers, attrib); + break; + case "Manufacturer": + manufacturer = this.Core.GetAttributeValue(sourceLineNumbers, attrib); + break; + case "IconSourceFile": + iconSourceFile = this.Core.GetAttributeValue(sourceLineNumbers, attrib); + break; + case "InProgressName": + inProgressName = this.Core.GetAttributeValue(sourceLineNumbers, attrib); + break; + case "Name": + name = this.Core.GetAttributeValue(sourceLineNumbers, attrib); + break; + case "ParentName": + parentName = this.Core.GetAttributeValue(sourceLineNumbers, attrib); + break; + case "ProviderKey": + // This can't be processed until we create the section. + break; + case "SplashScreenSourceFile": + splashScreenSourceFile = this.Core.GetAttributeValue(sourceLineNumbers, attrib); + break; + case "Tag": + tag = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; - case "yes": - attributes |= WixBundleAttributes.DisableModify; + case "UpdateUrl": + updateUrl = this.Core.GetAttributeValue(sourceLineNumbers, attrib); break; - case "no": + case "UpgradeCode": + upgradeCode = this.Core.GetAttributeGuidValue(sourceLineNumbers, attrib, false); + break; + case "Version": + version = this.Core.GetAttributeVersionValue(sourceLineNumbers, attrib); break; default: - this.Core.Write(ErrorMessages.IllegalAttributeValue(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, value, "button", "yes", "no")); + this.Core.UnexpectedAttribute(node, attrib); break; - } - break; - case "DisableRemove": - if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) - { - attributes |= WixBundleAttributes.DisableRemove; - } - break; - case "HelpTelephone": - helpTelephone = this.Core.GetAttributeValue(sourceLineNumbers, attrib); - break; - case "HelpUrl": - helpUrl = this.Core.GetAttributeValue(sourceLineNumbers, attrib); - break; - case "Manufacturer": - manufacturer = this.Core.GetAttributeValue(sourceLineNumbers, attrib); - break; - case "IconSourceFile": - iconSourceFile = this.Core.GetAttributeValue(sourceLineNumbers, attrib); - break; - case "InProgressName": - inProgressName = this.Core.GetAttributeValue(sourceLineNumbers, attrib); - break; - case "Name": - name = this.Core.GetAttributeValue(sourceLineNumbers, attrib); - break; - case "ParentName": - parentName = this.Core.GetAttributeValue(sourceLineNumbers, attrib); - break; - case "ProviderKey": - // This can't be processed until we create the section. - break; - case "SplashScreenSourceFile": - splashScreenSourceFile = this.Core.GetAttributeValue(sourceLineNumbers, attrib); - break; - case "Tag": - tag = this.Core.GetAttributeValue(sourceLineNumbers, attrib); - break; - case "UpdateUrl": - updateUrl = this.Core.GetAttributeValue(sourceLineNumbers, attrib); - break; - case "UpgradeCode": - upgradeCode = this.Core.GetAttributeGuidValue(sourceLineNumbers, attrib, false); - break; - case "Version": - version = this.Core.GetAttributeVersionValue(sourceLineNumbers, attrib); - break; - default: - this.Core.UnexpectedAttribute(node, attrib); - break; } } } @@ -314,87 +314,87 @@ namespace WixToolset.Core { switch (child.Name.LocalName) { - case "ApprovedExeForElevation": - this.ParseApprovedExeForElevation(child); - break; - case "BootstrapperApplication": - this.ParseBootstrapperApplicationElement(child); - break; - case "BootstrapperApplicationRef": - this.ParseBootstrapperApplicationRefElement(child); - break; - case "BundleCustomData": - this.ParseBundleCustomDataElement(child); - break; - case "BundleCustomDataRef": - this.ParseBundleCustomDataRefElement(child); - break; - case "BundleExtension": - this.ParseBundleExtensionElement(child); - break; - case "BundleExtensionRef": - this.ParseSimpleRefElement(child, SymbolDefinitions.WixBundleExtension); - break; - case "OptionalUpdateRegistration": - this.ParseOptionalUpdateRegistrationElement(child, manufacturer, parentName, name); - break; - case "Chain": - if (chainSeen) - { - var childSourceLineNumbers = Preprocessor.GetSourceLineNumbers(child); - this.Core.Write(ErrorMessages.TooManyChildren(childSourceLineNumbers, node.Name.LocalName, "Chain")); - } - this.ParseChainElement(child); - chainSeen = true; - break; - case "Container": - this.ParseContainerElement(child); - break; - case "ContainerRef": - this.ParseSimpleRefElement(child, SymbolDefinitions.WixBundleContainer); - break; - case "Log": - if (logSeen) - { - var childSourceLineNumbers = Preprocessor.GetSourceLineNumbers(child); - this.Core.Write(ErrorMessages.TooManyChildren(childSourceLineNumbers, node.Name.LocalName, "Log")); - } - logVariablePrefixAndExtension = this.ParseLogElement(child, fileSystemSafeBundleName); - logSeen = true; - break; - case "PayloadGroup": - this.ParsePayloadGroupElement(child, ComplexReferenceParentType.Layout, Compiler.BundleLayoutOnlyPayloads); - break; - case "PayloadGroupRef": - this.ParsePayloadGroupRefElement(child, ComplexReferenceParentType.Layout, Compiler.BundleLayoutOnlyPayloads); - break; - case "RelatedBundle": - this.ParseRelatedBundleElement(child); - break; - case "Requires": - this.ParseRequiresElement(child, null); - break; - case "SetVariable": - this.ParseSetVariableElement(child); - break; - case "SetVariableRef": - this.ParseSimpleRefElement(child, SymbolDefinitions.WixSetVariable); - break; - case "SoftwareTag": - this.ParseBundleTagElement(child); - break; - case "Update": - this.ParseUpdateElement(child); - break; - case "Variable": - this.ParseVariableElement(child); - break; - case "WixVariable": - this.ParseWixVariableElement(child); - break; - default: - this.Core.UnexpectedElement(node, child); - break; + case "ApprovedExeForElevation": + this.ParseApprovedExeForElevation(child); + break; + case "BootstrapperApplication": + this.ParseBootstrapperApplicationElement(child); + break; + case "BootstrapperApplicationRef": + this.ParseBootstrapperApplicationRefElement(child); + break; + case "BundleCustomData": + this.ParseBundleCustomDataElement(child); + break; + case "BundleCustomDataRef": + this.ParseBundleCustomDataRefElement(child); + break; + case "BundleExtension": + this.ParseBundleExtensionElement(child); + break; + case "BundleExtensionRef": + this.ParseSimpleRefElement(child, SymbolDefinitions.WixBundleExtension); + break; + case "OptionalUpdateRegistration": + this.ParseOptionalUpdateRegistrationElement(child, manufacturer, parentName, name); + break; + case "Chain": + if (chainSeen) + { + var childSourceLineNumbers = Preprocessor.GetSourceLineNumbers(child); + this.Core.Write(ErrorMessages.TooManyChildren(childSourceLineNumbers, node.Name.LocalName, "Chain")); + } + this.ParseChainElement(child); + chainSeen = true; + break; + case "Container": + this.ParseContainerElement(child); + break; + case "ContainerRef": + this.ParseSimpleRefElement(child, SymbolDefinitions.WixBundleContainer); + break; + case "Log": + if (logSeen) + { + var childSourceLineNumbers = Preprocessor.GetSourceLineNumbers(child); + this.Core.Write(ErrorMessages.TooManyChildren(childSourceLineNumbers, node.Name.LocalName, "Log")); + } + logVariablePrefixAndExtension = this.ParseLogElement(child, fileSystemSafeBundleName); + logSeen = true; + break; + case "PayloadGroup": + this.ParsePayloadGroupElement(child, ComplexReferenceParentType.Layout, Compiler.BundleLayoutOnlyPayloads); + break; + case "PayloadGroupRef": + this.ParsePayloadGroupRefElement(child, ComplexReferenceParentType.Layout, Compiler.BundleLayoutOnlyPayloads); + break; + case "RelatedBundle": + this.ParseRelatedBundleElement(child); + break; + case "Requires": + this.ParseRequiresElement(child, null); + break; + case "SetVariable": + this.ParseSetVariableElement(child); + break; + case "SetVariableRef": + this.ParseSimpleRefElement(child, SymbolDefinitions.WixSetVariable); + break; + case "SoftwareTag": + this.ParseBundleTagElement(child); + break; + case "Update": + this.ParseUpdateElement(child); + break; + case "Variable": + this.ParseVariableElement(child); + break; + case "WixVariable": + this.ParseWixVariableElement(child); + break; + default: + this.Core.UnexpectedElement(node, child); + break; } } else @@ -508,21 +508,21 @@ namespace WixToolset.Core { switch (attrib.Name.LocalName) { - case "Disable": - disableLog = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); - break; - case "PathVariable": - variable = this.Core.GetAttributeValue(sourceLineNumbers, attrib, EmptyRule.CanBeEmpty); - break; - case "Prefix": - logPrefix = this.Core.GetAttributeValue(sourceLineNumbers, attrib); - break; - case "Extension": - logExtension = this.Core.GetAttributeValue(sourceLineNumbers, attrib); - break; - default: - this.Core.UnexpectedAttribute(node, attrib); - break; + case "Disable": + disableLog = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); + break; + case "PathVariable": + variable = this.Core.GetAttributeValue(sourceLineNumbers, attrib, EmptyRule.CanBeEmpty); + break; + case "Prefix": + logPrefix = this.Core.GetAttributeValue(sourceLineNumbers, attrib); + break; + case "Extension": + logExtension = this.Core.GetAttributeValue(sourceLineNumbers, attrib); + break; + default: + this.Core.UnexpectedAttribute(node, attrib); + break; } } else @@ -559,37 +559,37 @@ namespace WixToolset.Core { switch (attrib.Name.LocalName) { - case "Id": - id = this.Core.GetAttributeIdentifier(sourceLineNumbers, attrib); - if (id?.Id == BurnConstants.BurnUXContainerName || id?.Id == BurnConstants.BurnDefaultAttachedContainerName) - { - this.Messaging.Write(CompilerErrors.ReservedValue(sourceLineNumbers, node.Name.LocalName, "Id", id.Id)); - } - break; - case "DownloadUrl": - downloadUrl = this.Core.GetAttributeValue(sourceLineNumbers, attrib); - break; - case "Name": - name = this.Core.GetAttributeValue(sourceLineNumbers, attrib); - break; - case "Type": - var typeString = this.Core.GetAttributeValue(sourceLineNumbers, attrib); - switch (typeString) - { - case "attached": - type = ContainerType.Attached; - break; - case "detached": - type = ContainerType.Detached; - break; - default: - this.Core.Write(ErrorMessages.IllegalAttributeValueWithLegalList(sourceLineNumbers, node.Name.LocalName, "Type", typeString, "attached, detached")); - break; - } - break; - default: - this.Core.UnexpectedAttribute(node, attrib); - break; + case "Id": + id = this.Core.GetAttributeIdentifier(sourceLineNumbers, attrib); + if (id?.Id == BurnConstants.BurnUXContainerName || id?.Id == BurnConstants.BurnDefaultAttachedContainerName) + { + this.Messaging.Write(CompilerErrors.ReservedValue(sourceLineNumbers, node.Name.LocalName, "Id", id.Id)); + } + break; + case "DownloadUrl": + downloadUrl = this.Core.GetAttributeValue(sourceLineNumbers, attrib); + break; + case "Name": + name = this.Core.GetAttributeValue(sourceLineNumbers, attrib); + break; + case "Type": + var typeString = this.Core.GetAttributeValue(sourceLineNumbers, attrib); + switch (typeString) + { + case "attached": + type = ContainerType.Attached; + break; + case "detached": + type = ContainerType.Detached; + break; + default: + this.Core.Write(ErrorMessages.IllegalAttributeValueWithLegalList(sourceLineNumbers, node.Name.LocalName, "Type", typeString, "attached, detached")); + break; + } + break; + default: + this.Core.UnexpectedAttribute(node, attrib); + break; } } else @@ -631,12 +631,12 @@ namespace WixToolset.Core { switch (child.Name.LocalName) { - case "PackageGroupRef": - this.ParsePackageGroupRefElement(child, ComplexReferenceParentType.Container, id.Id); - break; - default: - this.Core.UnexpectedElement(node, child); - break; + case "PackageGroupRef": + this.ParsePackageGroupRefElement(child, ComplexReferenceParentType.Container, id.Id); + break; + default: + this.Core.UnexpectedElement(node, child); + break; } } else @@ -845,12 +845,12 @@ namespace WixToolset.Core { switch (attrib.Name.LocalName) { - case "Id": - id = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); - break; - default: - this.Core.UnexpectedAttribute(node, attrib); - break; + case "Id": + id = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); + break; + default: + this.Core.UnexpectedAttribute(node, attrib); + break; } } else @@ -865,15 +865,15 @@ namespace WixToolset.Core { switch (child.Name.LocalName) { - case "Payload": - this.ParsePayloadElement(child, ComplexReferenceParentType.Container, Compiler.BurnUXContainerId); - break; - case "PayloadGroupRef": - this.ParsePayloadGroupRefElement(child, ComplexReferenceParentType.Container, Compiler.BurnUXContainerId); - break; - default: - this.Core.UnexpectedElement(node, child); - break; + case "Payload": + this.ParsePayloadElement(child, ComplexReferenceParentType.Container, Compiler.BurnUXContainerId); + break; + case "PayloadGroupRef": + this.ParsePayloadGroupRefElement(child, ComplexReferenceParentType.Container, Compiler.BurnUXContainerId); + break; + default: + this.Core.UnexpectedElement(node, child); + break; } } else @@ -1303,24 +1303,24 @@ namespace WixToolset.Core { switch (attrib.Name.LocalName) { - case "Manufacturer": - manufacturer = this.Core.GetAttributeValue(sourceLineNumbers, attrib); - break; - case "Department": - department = this.Core.GetAttributeValue(sourceLineNumbers, attrib); - break; - case "ProductFamily": - productFamily = this.Core.GetAttributeValue(sourceLineNumbers, attrib); - break; - case "Name": - name = this.Core.GetAttributeValue(sourceLineNumbers, attrib); - break; - case "Classification": - classification = this.Core.GetAttributeValue(sourceLineNumbers, attrib); - break; - default: - this.Core.UnexpectedAttribute(node, attrib); - break; + case "Manufacturer": + manufacturer = this.Core.GetAttributeValue(sourceLineNumbers, attrib); + break; + case "Department": + department = this.Core.GetAttributeValue(sourceLineNumbers, attrib); + break; + case "ProductFamily": + productFamily = this.Core.GetAttributeValue(sourceLineNumbers, attrib); + break; + case "Name": + name = this.Core.GetAttributeValue(sourceLineNumbers, attrib); + break; + case "Classification": + classification = this.Core.GetAttributeValue(sourceLineNumbers, attrib); + break; + default: + this.Core.UnexpectedAttribute(node, attrib); + break; } } else @@ -1490,12 +1490,12 @@ namespace WixToolset.Core { switch (attrib.Name.LocalName) { - case "Id": - id = this.Core.GetAttributeIdentifier(sourceLineNumbers, attrib); - break; - default: - this.Core.UnexpectedAttribute(node, attrib); - break; + case "Id": + id = this.Core.GetAttributeIdentifier(sourceLineNumbers, attrib); + break; + default: + this.Core.UnexpectedAttribute(node, attrib); + break; } } else @@ -1517,27 +1517,27 @@ namespace WixToolset.Core WixBundlePackageType? packageType = null; switch (child.Name.LocalName) { - case "ExePackagePayload": - packageType = WixBundlePackageType.Exe; - break; - case "MsiPackagePayload": - packageType = WixBundlePackageType.Msi; - break; - case "MspPackagePayload": - packageType = WixBundlePackageType.Msp; - break; - case "MsuPackagePayload": - packageType = WixBundlePackageType.Msu; - break; - case "Payload": - this.ParsePayloadElement(child, ComplexReferenceParentType.PayloadGroup, id); - break; - case "PayloadGroupRef": - this.ParsePayloadGroupRefElement(child, ComplexReferenceParentType.PayloadGroup, id); - break; - default: - this.Core.UnexpectedElement(node, child); - break; + case "ExePackagePayload": + packageType = WixBundlePackageType.Exe; + break; + case "MsiPackagePayload": + packageType = WixBundlePackageType.Msi; + break; + case "MspPackagePayload": + packageType = WixBundlePackageType.Msp; + break; + case "MsuPackagePayload": + packageType = WixBundlePackageType.Msu; + break; + case "Payload": + this.ParsePayloadElement(child, ComplexReferenceParentType.PayloadGroup, id); + break; + case "PayloadGroupRef": + this.ParsePayloadGroupRefElement(child, ComplexReferenceParentType.PayloadGroup, id); + break; + default: + this.Core.UnexpectedElement(node, child); + break; } if (packageType.HasValue) @@ -1584,13 +1584,13 @@ namespace WixToolset.Core { switch (attrib.Name.LocalName) { - case "Id": - id = this.Core.GetAttributeIdentifier(sourceLineNumbers, attrib); - this.Core.CreateSimpleReference(sourceLineNumbers, SymbolDefinitions.WixBundlePayloadGroup, id.Id); - break; - default: - this.Core.UnexpectedAttribute(node, attrib); - break; + case "Id": + id = this.Core.GetAttributeIdentifier(sourceLineNumbers, attrib); + this.Core.CreateSimpleReference(sourceLineNumbers, SymbolDefinitions.WixBundlePayloadGroup, id.Id); + break; + default: + this.Core.UnexpectedAttribute(node, attrib); + break; } } else @@ -1628,34 +1628,34 @@ namespace WixToolset.Core { switch (attrib.Name.LocalName) { - case "Value": - value = this.Core.GetAttributeIntegerValue(sourceLineNumbers, attrib, Int32.MinValue + 2, Int32.MaxValue); - break; - case "Behavior": - var behaviorString = this.Core.GetAttributeValue(sourceLineNumbers, attrib); - switch (behaviorString) - { - case "error": - behavior = ExitCodeBehaviorType.Error; - break; - case "forceReboot": - behavior = ExitCodeBehaviorType.ForceReboot; - break; - case "scheduleReboot": - behavior = ExitCodeBehaviorType.ScheduleReboot; - break; - case "success": - behavior = ExitCodeBehaviorType.Success; - break; - default: - this.Core.Write(ErrorMessages.IllegalAttributeValueWithLegalList(sourceLineNumbers, node.Name.LocalName, "Behavior", behaviorString, "success, error, scheduleReboot, forceReboot")); - behavior = ExitCodeBehaviorType.Success; // set value to avoid ExpectedAttribute below. - break; - } - break; - default: - this.Core.UnexpectedAttribute(node, attrib); - break; + case "Value": + value = this.Core.GetAttributeIntegerValue(sourceLineNumbers, attrib, Int32.MinValue + 2, Int32.MaxValue); + break; + case "Behavior": + var behaviorString = this.Core.GetAttributeValue(sourceLineNumbers, attrib); + switch (behaviorString) + { + case "error": + behavior = ExitCodeBehaviorType.Error; + break; + case "forceReboot": + behavior = ExitCodeBehaviorType.ForceReboot; + break; + case "scheduleReboot": + behavior = ExitCodeBehaviorType.ScheduleReboot; + break; + case "success": + behavior = ExitCodeBehaviorType.Success; + break; + default: + this.Core.Write(ErrorMessages.IllegalAttributeValueWithLegalList(sourceLineNumbers, node.Name.LocalName, "Behavior", behaviorString, "success, error, scheduleReboot, forceReboot")); + behavior = ExitCodeBehaviorType.Success; // set value to avoid ExpectedAttribute below. + break; + } + break; + default: + this.Core.UnexpectedAttribute(node, attrib); + break; } } else @@ -1697,27 +1697,27 @@ namespace WixToolset.Core { switch (attrib.Name.LocalName) { - case "DisableRollback": - if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) - { - attributes |= WixChainAttributes.DisableRollback; - } - break; - case "DisableSystemRestore": - if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) - { - attributes |= WixChainAttributes.DisableSystemRestore; - } - break; - case "ParallelCache": - if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) - { - attributes |= WixChainAttributes.ParallelCache; - } - break; - default: - this.Core.UnexpectedAttribute(node, attrib); - break; + case "DisableRollback": + if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) + { + attributes |= WixChainAttributes.DisableRollback; + } + break; + case "DisableSystemRestore": + if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) + { + attributes |= WixChainAttributes.DisableSystemRestore; + } + break; + case "ParallelCache": + if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) + { + attributes |= WixChainAttributes.ParallelCache; + } + break; + default: + this.Core.UnexpectedAttribute(node, attrib); + break; } } else @@ -1735,33 +1735,33 @@ namespace WixToolset.Core { switch (child.Name.LocalName) { - case "MsiPackage": - previousId = this.ParseMsiPackageElement(child, ComplexReferenceParentType.PackageGroup, BurnConstants.BundleChainPackageGroupId, previousType, previousId); - previousType = ComplexReferenceChildType.Package; - break; - case "MspPackage": - previousId = this.ParseMspPackageElement(child, ComplexReferenceParentType.PackageGroup, BurnConstants.BundleChainPackageGroupId, previousType, previousId); - previousType = ComplexReferenceChildType.Package; - break; - case "MsuPackage": - previousId = this.ParseMsuPackageElement(child, ComplexReferenceParentType.PackageGroup, BurnConstants.BundleChainPackageGroupId, previousType, previousId); - previousType = ComplexReferenceChildType.Package; - break; - case "ExePackage": - previousId = this.ParseExePackageElement(child, ComplexReferenceParentType.PackageGroup, BurnConstants.BundleChainPackageGroupId, previousType, previousId); - previousType = ComplexReferenceChildType.Package; - break; - case "RollbackBoundary": - previousId = this.ParseRollbackBoundaryElement(child, ComplexReferenceParentType.PackageGroup, BurnConstants.BundleChainPackageGroupId, previousType, previousId); - previousType = ComplexReferenceChildType.Package; - break; - case "PackageGroupRef": - previousId = this.ParsePackageGroupRefElement(child, ComplexReferenceParentType.PackageGroup, BurnConstants.BundleChainPackageGroupId, previousType, previousId); - previousType = ComplexReferenceChildType.PackageGroup; - break; - default: - this.Core.UnexpectedElement(node, child); - break; + case "MsiPackage": + previousId = this.ParseMsiPackageElement(child, ComplexReferenceParentType.PackageGroup, BurnConstants.BundleChainPackageGroupId, previousType, previousId); + previousType = ComplexReferenceChildType.Package; + break; + case "MspPackage": + previousId = this.ParseMspPackageElement(child, ComplexReferenceParentType.PackageGroup, BurnConstants.BundleChainPackageGroupId, previousType, previousId); + previousType = ComplexReferenceChildType.Package; + break; + case "MsuPackage": + previousId = this.ParseMsuPackageElement(child, ComplexReferenceParentType.PackageGroup, BurnConstants.BundleChainPackageGroupId, previousType, previousId); + previousType = ComplexReferenceChildType.Package; + break; + case "ExePackage": + previousId = this.ParseExePackageElement(child, ComplexReferenceParentType.PackageGroup, BurnConstants.BundleChainPackageGroupId, previousType, previousId); + previousType = ComplexReferenceChildType.Package; + break; + case "RollbackBoundary": + previousId = this.ParseRollbackBoundaryElement(child, ComplexReferenceParentType.PackageGroup, BurnConstants.BundleChainPackageGroupId, previousType, previousId); + previousType = ComplexReferenceChildType.Package; + break; + case "PackageGroupRef": + previousId = this.ParsePackageGroupRefElement(child, ComplexReferenceParentType.PackageGroup, BurnConstants.BundleChainPackageGroupId, previousType, previousId); + previousType = ComplexReferenceChildType.PackageGroup; + break; + default: + this.Core.UnexpectedElement(node, child); + break; } } else @@ -1872,25 +1872,25 @@ namespace WixToolset.Core var allowed = true; switch (attrib.Name.LocalName) { - case "Id": - id = this.Core.GetAttributeIdentifier(sourceLineNumbers, attrib); - if (id?.Id == BurnConstants.BundleDefaultBoundaryId) - { - this.Messaging.Write(CompilerErrors.ReservedValue(sourceLineNumbers, node.Name.LocalName, "Id", id.Id)); - } - break; - case "Vital": - vital = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); - break; - case "Transaction": - transaction = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); - break; - case "LogPathVariable": - logPathVariable = this.Core.GetAttributeValue(sourceLineNumbers, attrib, EmptyRule.CanBeEmpty); - break; - default: - allowed = false; - break; + case "Id": + id = this.Core.GetAttributeIdentifier(sourceLineNumbers, attrib); + if (id?.Id == BurnConstants.BundleDefaultBoundaryId) + { + this.Messaging.Write(CompilerErrors.ReservedValue(sourceLineNumbers, node.Name.LocalName, "Id", id.Id)); + } + break; + case "Vital": + vital = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); + break; + case "Transaction": + transaction = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); + break; + case "LogPathVariable": + logPathVariable = this.Core.GetAttributeValue(sourceLineNumbers, attrib, EmptyRule.CanBeEmpty); + break; + default: + allowed = false; + break; } if (!allowed) @@ -2016,126 +2016,126 @@ namespace WixToolset.Core var allowed = true; switch (attrib.Name.LocalName) { - case "Id": - compilerPayload.ParseId(attrib); - break; - case "Name": - compilerPayload.ParseName(attrib); - hasPayloadInfo = true; - break; - case "SourceFile": - compilerPayload.ParseSourceFile(attrib); - hasPayloadInfo = true; - break; - case "DownloadUrl": - compilerPayload.ParseDownloadUrl(attrib); - hasPayloadInfo = true; - break; - case "After": - after = this.Core.GetAttributeValue(sourceLineNumbers, attrib); - break; - case "InstallCondition": - installCondition = this.Core.GetAttributeValue(sourceLineNumbers, attrib); - break; - case "Cache": - var value = this.Core.GetAttributeValue(sourceLineNumbers, attrib); - switch (value) - { - case "force": - cache = BundleCacheType.Force; + case "Id": + compilerPayload.ParseId(attrib); + break; + case "Name": + compilerPayload.ParseName(attrib); + hasPayloadInfo = true; + break; + case "SourceFile": + compilerPayload.ParseSourceFile(attrib); + hasPayloadInfo = true; + break; + case "DownloadUrl": + compilerPayload.ParseDownloadUrl(attrib); + hasPayloadInfo = true; + break; + case "After": + after = this.Core.GetAttributeValue(sourceLineNumbers, attrib); + break; + case "InstallCondition": + installCondition = this.Core.GetAttributeValue(sourceLineNumbers, attrib); + break; + case "Cache": + var value = this.Core.GetAttributeValue(sourceLineNumbers, attrib); + switch (value) + { + case "force": + cache = BundleCacheType.Force; + break; + case "keep": + cache = BundleCacheType.Keep; + break; + case "remove": + cache = BundleCacheType.Remove; + break; + case "": + break; + default: + this.Core.Write(ErrorMessages.IllegalAttributeValue(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, value, "force", "keep", "remove")); + break; + } + break; + case "CacheId": + cacheId = this.Core.GetAttributeValue(sourceLineNumbers, attrib); + break; + case "Description": + description = this.Core.GetAttributeValue(sourceLineNumbers, attrib); + break; + case "DisplayName": + displayName = this.Core.GetAttributeValue(sourceLineNumbers, attrib); + break; + case "EnableFeatureSelection": + enableFeatureSelection = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); + allowed = (packageType == WixBundlePackageType.Msi); + break; + case "ForcePerMachine": + forcePerMachine = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); + allowed = (packageType == WixBundlePackageType.Msi); + break; + case "LogPathVariable": + logPathVariable = this.Core.GetAttributeValue(sourceLineNumbers, attrib, EmptyRule.CanBeEmpty); + break; + case "RollbackLogPathVariable": + rollbackPathVariable = this.Core.GetAttributeValue(sourceLineNumbers, attrib, EmptyRule.CanBeEmpty); + break; + case "Permanent": + permanent = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); + break; + case "Visible": + visible = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); + allowed = (packageType == WixBundlePackageType.Msi); + break; + case "Vital": + vital = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); + break; + case "Bundle": + bundle = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); + allowed = (packageType == WixBundlePackageType.Exe); break; - case "keep": - cache = BundleCacheType.Keep; + case "InstallArguments": + installArguments = this.Core.GetAttributeValue(sourceLineNumbers, attrib); + allowed = (packageType == WixBundlePackageType.Exe); break; - case "remove": - cache = BundleCacheType.Remove; + case "RepairArguments": + repairArguments = this.Core.GetAttributeValue(sourceLineNumbers, attrib, EmptyRule.CanBeEmpty); + allowed = (packageType == WixBundlePackageType.Exe); break; - case "": + case "UninstallArguments": + uninstallArguments = this.Core.GetAttributeValue(sourceLineNumbers, attrib, EmptyRule.CanBeEmpty); + allowed = (packageType == WixBundlePackageType.Exe); + break; + case "PerMachine": + perMachine = this.Core.GetAttributeYesNoDefaultValue(sourceLineNumbers, attrib); + allowed = (packageType == WixBundlePackageType.Exe || packageType == WixBundlePackageType.Msp); + break; + case "DetectCondition": + detectCondition = this.Core.GetAttributeValue(sourceLineNumbers, attrib, EmptyRule.CanBeEmpty); + allowed = (packageType == WixBundlePackageType.Exe || packageType == WixBundlePackageType.Msu); + break; + case "Protocol": + protocol = this.Core.GetAttributeValue(sourceLineNumbers, attrib); + allowed = (packageType == WixBundlePackageType.Exe); + break; + case "InstallSize": + installSize = this.Core.GetAttributeLongValue(sourceLineNumbers, attrib, 0, Int64.MaxValue); + break; + case "KB": + msuKB = this.Core.GetAttributeValue(sourceLineNumbers, attrib); + allowed = (packageType == WixBundlePackageType.Msu); + break; + case "Compressed": + compilerPayload.ParseCompressed(attrib); + hasPayloadInfo = true; + break; + case "Slipstream": + slipstream = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); + allowed = (packageType == WixBundlePackageType.Msp); break; default: - this.Core.Write(ErrorMessages.IllegalAttributeValue(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, value, "force", "keep", "remove")); + allowed = false; break; - } - break; - case "CacheId": - cacheId = this.Core.GetAttributeValue(sourceLineNumbers, attrib); - break; - case "Description": - description = this.Core.GetAttributeValue(sourceLineNumbers, attrib); - break; - case "DisplayName": - displayName = this.Core.GetAttributeValue(sourceLineNumbers, attrib); - break; - case "EnableFeatureSelection": - enableFeatureSelection = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); - allowed = (packageType == WixBundlePackageType.Msi); - break; - case "ForcePerMachine": - forcePerMachine = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); - allowed = (packageType == WixBundlePackageType.Msi); - break; - case "LogPathVariable": - logPathVariable = this.Core.GetAttributeValue(sourceLineNumbers, attrib, EmptyRule.CanBeEmpty); - break; - case "RollbackLogPathVariable": - rollbackPathVariable = this.Core.GetAttributeValue(sourceLineNumbers, attrib, EmptyRule.CanBeEmpty); - break; - case "Permanent": - permanent = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); - break; - case "Visible": - visible = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); - allowed = (packageType == WixBundlePackageType.Msi); - break; - case "Vital": - vital = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); - break; - case "Bundle": - bundle = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); - allowed = (packageType == WixBundlePackageType.Exe); - break; - case "InstallArguments": - installArguments = this.Core.GetAttributeValue(sourceLineNumbers, attrib); - allowed = (packageType == WixBundlePackageType.Exe); - break; - case "RepairArguments": - repairArguments = this.Core.GetAttributeValue(sourceLineNumbers, attrib, EmptyRule.CanBeEmpty); - allowed = (packageType == WixBundlePackageType.Exe); - break; - case "UninstallArguments": - uninstallArguments = this.Core.GetAttributeValue(sourceLineNumbers, attrib, EmptyRule.CanBeEmpty); - allowed = (packageType == WixBundlePackageType.Exe); - break; - case "PerMachine": - perMachine = this.Core.GetAttributeYesNoDefaultValue(sourceLineNumbers, attrib); - allowed = (packageType == WixBundlePackageType.Exe || packageType == WixBundlePackageType.Msp); - break; - case "DetectCondition": - detectCondition = this.Core.GetAttributeValue(sourceLineNumbers, attrib, EmptyRule.CanBeEmpty); - allowed = (packageType == WixBundlePackageType.Exe || packageType == WixBundlePackageType.Msu); - break; - case "Protocol": - protocol = this.Core.GetAttributeValue(sourceLineNumbers, attrib); - allowed = (packageType == WixBundlePackageType.Exe); - break; - case "InstallSize": - installSize = this.Core.GetAttributeLongValue(sourceLineNumbers, attrib, 0, Int64.MaxValue); - break; - case "KB": - msuKB = this.Core.GetAttributeValue(sourceLineNumbers, attrib); - allowed = (packageType == WixBundlePackageType.Msu); - break; - case "Compressed": - compilerPayload.ParseCompressed(attrib); - hasPayloadInfo = true; - break; - case "Slipstream": - slipstream = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); - allowed = (packageType == WixBundlePackageType.Msp); - break; - default: - allowed = false; - break; } if (!allowed) @@ -2315,53 +2315,53 @@ namespace WixToolset.Core var allowed = true; switch (child.Name.LocalName) { - case "SlipstreamMsp": - allowed = (packageType == WixBundlePackageType.Msi); - if (allowed) - { - this.ParseSlipstreamMspElement(child, id.Id); - } - break; - case "MsiProperty": - allowed = (packageType == WixBundlePackageType.Msi || packageType == WixBundlePackageType.Msp); - if (allowed) - { - this.ParseMsiPropertyElement(child, id.Id); - } - break; - case "Payload": - this.ParsePayloadElement(child, ComplexReferenceParentType.Package, id); - break; - case "PayloadGroupRef": - this.ParsePayloadGroupRefElement(child, ComplexReferenceParentType.Package, id); - break; - case "Provides": - this.ParseProvidesElement(child, packageType, id.Id, out _); - break; - case "ExitCode": - allowed = (packageType == WixBundlePackageType.Exe); - if (allowed) - { - this.ParseExitCodeElement(child, id.Id); - } - break; - case "CommandLine": - allowed = (packageType == WixBundlePackageType.Exe); - if (allowed) - { - this.ParseCommandLineElement(child, id.Id); - } - break; - case "ExePackagePayload": - case "MsiPackagePayload": - case "MspPackagePayload": - case "MsuPackagePayload": - allowed = packagePayloadElementName == child.Name.LocalName; - // Handled previously - break; - default: - allowed = false; - break; + case "SlipstreamMsp": + allowed = (packageType == WixBundlePackageType.Msi); + if (allowed) + { + this.ParseSlipstreamMspElement(child, id.Id); + } + break; + case "MsiProperty": + allowed = (packageType == WixBundlePackageType.Msi || packageType == WixBundlePackageType.Msp); + if (allowed) + { + this.ParseMsiPropertyElement(child, id.Id); + } + break; + case "Payload": + this.ParsePayloadElement(child, ComplexReferenceParentType.Package, id); + break; + case "PayloadGroupRef": + this.ParsePayloadGroupRefElement(child, ComplexReferenceParentType.Package, id); + break; + case "Provides": + this.ParseProvidesElement(child, packageType, id.Id, out _); + break; + case "ExitCode": + allowed = (packageType == WixBundlePackageType.Exe); + if (allowed) + { + this.ParseExitCodeElement(child, id.Id); + } + break; + case "CommandLine": + allowed = (packageType == WixBundlePackageType.Exe); + if (allowed) + { + this.ParseCommandLineElement(child, id.Id); + } + break; + case "ExePackagePayload": + case "MsiPackagePayload": + case "MspPackagePayload": + case "MsuPackagePayload": + allowed = packagePayloadElementName == child.Name.LocalName; + // Handled previously + break; + default: + allowed = false; + break; } if (!allowed) @@ -2422,49 +2422,49 @@ namespace WixToolset.Core switch (packageType) { - case WixBundlePackageType.Exe: - WixBundleExePackageAttributes exeAttributes = 0; - exeAttributes |= (YesNoType.Yes == bundle) ? WixBundleExePackageAttributes.Bundle : 0; + case WixBundlePackageType.Exe: + WixBundleExePackageAttributes exeAttributes = 0; + exeAttributes |= (YesNoType.Yes == bundle) ? WixBundleExePackageAttributes.Bundle : 0; - this.Core.AddSymbol(new WixBundleExePackageSymbol(sourceLineNumbers, id) - { - Attributes = exeAttributes, - DetectCondition = detectCondition, - InstallCommand = installArguments, - RepairCommand = repairArguments, - UninstallCommand = uninstallArguments, - ExeProtocol = protocol - }); - break; + this.Core.AddSymbol(new WixBundleExePackageSymbol(sourceLineNumbers, id) + { + Attributes = exeAttributes, + DetectCondition = detectCondition, + InstallCommand = installArguments, + RepairCommand = repairArguments, + UninstallCommand = uninstallArguments, + ExeProtocol = protocol + }); + break; - case WixBundlePackageType.Msi: - WixBundleMsiPackageAttributes msiAttributes = 0; - msiAttributes |= (YesNoType.Yes == enableFeatureSelection) ? WixBundleMsiPackageAttributes.EnableFeatureSelection : 0; - msiAttributes |= (YesNoType.Yes == forcePerMachine) ? WixBundleMsiPackageAttributes.ForcePerMachine : 0; + case WixBundlePackageType.Msi: + WixBundleMsiPackageAttributes msiAttributes = 0; + msiAttributes |= (YesNoType.Yes == enableFeatureSelection) ? WixBundleMsiPackageAttributes.EnableFeatureSelection : 0; + msiAttributes |= (YesNoType.Yes == forcePerMachine) ? WixBundleMsiPackageAttributes.ForcePerMachine : 0; - this.Core.AddSymbol(new WixBundleMsiPackageSymbol(sourceLineNumbers, id) - { - Attributes = msiAttributes - }); - break; + this.Core.AddSymbol(new WixBundleMsiPackageSymbol(sourceLineNumbers, id) + { + Attributes = msiAttributes + }); + break; - case WixBundlePackageType.Msp: - WixBundleMspPackageAttributes mspAttributes = 0; - mspAttributes |= (YesNoType.Yes == slipstream) ? WixBundleMspPackageAttributes.Slipstream : 0; + case WixBundlePackageType.Msp: + WixBundleMspPackageAttributes mspAttributes = 0; + mspAttributes |= (YesNoType.Yes == slipstream) ? WixBundleMspPackageAttributes.Slipstream : 0; - this.Core.AddSymbol(new WixBundleMspPackageSymbol(sourceLineNumbers, id) - { - Attributes = mspAttributes - }); - break; + this.Core.AddSymbol(new WixBundleMspPackageSymbol(sourceLineNumbers, id) + { + Attributes = mspAttributes + }); + break; - case WixBundlePackageType.Msu: - this.Core.AddSymbol(new WixBundleMsuPackageSymbol(sourceLineNumbers, id) - { - DetectCondition = detectCondition, - MsuKB = msuKB - }); - break; + case WixBundlePackageType.Msu: + this.Core.AddSymbol(new WixBundleMsuPackageSymbol(sourceLineNumbers, id) + { + DetectCondition = detectCondition, + MsuKB = msuKB + }); + break; } this.CreateChainPackageMetaRows(sourceLineNumbers, parentType, parentId, ComplexReferenceChildType.Package, id.Id, previousType, previousId, after); @@ -2635,21 +2635,21 @@ namespace WixToolset.Core { switch (attrib.Name.LocalName) { - case "InstallArgument": - installArgument = this.Core.GetAttributeValue(sourceLineNumbers, attrib); - break; - case "UninstallArgument": - uninstallArgument = this.Core.GetAttributeValue(sourceLineNumbers, attrib); - break; - case "RepairArgument": - repairArgument = this.Core.GetAttributeValue(sourceLineNumbers, attrib); - break; - case "Condition": - condition = this.Core.GetAttributeValue(sourceLineNumbers, attrib); - break; - default: - this.Core.UnexpectedAttribute(node, attrib); - break; + case "InstallArgument": + installArgument = this.Core.GetAttributeValue(sourceLineNumbers, attrib); + break; + case "UninstallArgument": + uninstallArgument = this.Core.GetAttributeValue(sourceLineNumbers, attrib); + break; + case "RepairArgument": + repairArgument = this.Core.GetAttributeValue(sourceLineNumbers, attrib); + break; + case "Condition": + condition = this.Core.GetAttributeValue(sourceLineNumbers, attrib); + break; + default: + this.Core.UnexpectedAttribute(node, attrib); + break; } } else @@ -2693,16 +2693,16 @@ namespace WixToolset.Core { switch (attrib.Name.LocalName) { - case "Id": - id = this.Core.GetAttributeIdentifier(sourceLineNumbers, attrib); - if (id?.Id == BurnConstants.BundleChainPackageGroupId) - { - this.Messaging.Write(CompilerErrors.ReservedValue(sourceLineNumbers, node.Name.LocalName, "Id", id.Id)); - } - break; - default: - this.Core.UnexpectedAttribute(node, attrib); - break; + case "Id": + id = this.Core.GetAttributeIdentifier(sourceLineNumbers, attrib); + if (id?.Id == BurnConstants.BundleChainPackageGroupId) + { + this.Messaging.Write(CompilerErrors.ReservedValue(sourceLineNumbers, node.Name.LocalName, "Id", id.Id)); + } + break; + default: + this.Core.UnexpectedAttribute(node, attrib); + break; } } else @@ -2725,33 +2725,33 @@ namespace WixToolset.Core { switch (child.Name.LocalName) { - case "MsiPackage": - previousId = this.ParseMsiPackageElement(child, ComplexReferenceParentType.PackageGroup, id.Id, previousType, previousId); - previousType = ComplexReferenceChildType.Package; - break; - case "MspPackage": - previousId = this.ParseMspPackageElement(child, ComplexReferenceParentType.PackageGroup, id.Id, previousType, previousId); - previousType = ComplexReferenceChildType.Package; - break; - case "MsuPackage": - previousId = this.ParseMsuPackageElement(child, ComplexReferenceParentType.PackageGroup, id.Id, previousType, previousId); - previousType = ComplexReferenceChildType.Package; - break; - case "ExePackage": - previousId = this.ParseExePackageElement(child, ComplexReferenceParentType.PackageGroup, id.Id, previousType, previousId); - previousType = ComplexReferenceChildType.Package; - break; - case "RollbackBoundary": - previousId = this.ParseRollbackBoundaryElement(child, ComplexReferenceParentType.PackageGroup, id.Id, previousType, previousId); - previousType = ComplexReferenceChildType.Package; - break; - case "PackageGroupRef": - previousId = this.ParsePackageGroupRefElement(child, ComplexReferenceParentType.PackageGroup, id.Id, previousType, previousId); - previousType = ComplexReferenceChildType.PackageGroup; - break; - default: - this.Core.UnexpectedElement(node, child); - break; + case "MsiPackage": + previousId = this.ParseMsiPackageElement(child, ComplexReferenceParentType.PackageGroup, id.Id, previousType, previousId); + previousType = ComplexReferenceChildType.Package; + break; + case "MspPackage": + previousId = this.ParseMspPackageElement(child, ComplexReferenceParentType.PackageGroup, id.Id, previousType, previousId); + previousType = ComplexReferenceChildType.Package; + break; + case "MsuPackage": + previousId = this.ParseMsuPackageElement(child, ComplexReferenceParentType.PackageGroup, id.Id, previousType, previousId); + previousType = ComplexReferenceChildType.Package; + break; + case "ExePackage": + previousId = this.ParseExePackageElement(child, ComplexReferenceParentType.PackageGroup, id.Id, previousType, previousId); + previousType = ComplexReferenceChildType.Package; + break; + case "RollbackBoundary": + previousId = this.ParseRollbackBoundaryElement(child, ComplexReferenceParentType.PackageGroup, id.Id, previousType, previousId); + previousType = ComplexReferenceChildType.Package; + break; + case "PackageGroupRef": + previousId = this.ParsePackageGroupRefElement(child, ComplexReferenceParentType.PackageGroup, id.Id, previousType, previousId); + previousType = ComplexReferenceChildType.PackageGroup; + break; + default: + this.Core.UnexpectedElement(node, child); + break; } } else @@ -2803,23 +2803,23 @@ namespace WixToolset.Core { switch (attrib.Name.LocalName) { - case "Id": - id = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); - if (id == BurnConstants.BundleChainPackageGroupId) - { - this.Messaging.Write(CompilerErrors.ReservedValue(sourceLineNumbers, node.Name.LocalName, "Id", id)); - } - else - { - this.Core.CreateSimpleReference(sourceLineNumbers, SymbolDefinitions.WixBundlePackageGroup, id); - } - break; - case "After": - after = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); - break; - default: - this.Core.UnexpectedAttribute(node, attrib); - break; + case "Id": + id = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); + if (id == BurnConstants.BundleChainPackageGroupId) + { + this.Messaging.Write(CompilerErrors.ReservedValue(sourceLineNumbers, node.Name.LocalName, "Id", id)); + } + else + { + this.Core.CreateSimpleReference(sourceLineNumbers, SymbolDefinitions.WixBundlePackageGroup, id); + } + break; + case "After": + after = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); + break; + default: + this.Core.UnexpectedAttribute(node, attrib); + break; } } else @@ -2933,18 +2933,18 @@ namespace WixToolset.Core { switch (attrib.Name.LocalName) { - case "Name": - name = this.Core.GetAttributeMsiPropertyNameValue(sourceLineNumbers, attrib); - break; - case "Value": - value = this.Core.GetAttributeValue(sourceLineNumbers, attrib); - break; - case "Condition": - condition = this.Core.GetAttributeValue(sourceLineNumbers, attrib); - break; - default: - this.Core.UnexpectedAttribute(node, attrib); - break; + case "Name": + name = this.Core.GetAttributeMsiPropertyNameValue(sourceLineNumbers, attrib); + break; + case "Value": + value = this.Core.GetAttributeValue(sourceLineNumbers, attrib); + break; + case "Condition": + condition = this.Core.GetAttributeValue(sourceLineNumbers, attrib); + break; + default: + this.Core.UnexpectedAttribute(node, attrib); + break; } } else @@ -2997,13 +2997,13 @@ namespace WixToolset.Core { switch (attrib.Name.LocalName) { - case "Id": - id = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); - this.Core.CreateSimpleReference(sourceLineNumbers, SymbolDefinitions.WixBundlePackage, id); - break; - default: - this.Core.UnexpectedAttribute(node, attrib); - break; + case "Id": + id = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); + this.Core.CreateSimpleReference(sourceLineNumbers, SymbolDefinitions.WixBundlePackage, id); + break; + default: + this.Core.UnexpectedAttribute(node, attrib); + break; } } else @@ -3045,39 +3045,39 @@ namespace WixToolset.Core { switch (attrib.Name.LocalName) { - case "Id": - id = this.Core.GetAttributeGuidValue(sourceLineNumbers, attrib, false); - break; - case "Action": - var action = this.Core.GetAttributeValue(sourceLineNumbers, attrib); - switch (action) - { - case "Detect": - case "detect": - actionType = RelatedBundleActionType.Detect; - break; - case "Upgrade": - case "upgrade": - actionType = RelatedBundleActionType.Upgrade; - break; - case "Addon": - case "addon": - actionType = RelatedBundleActionType.Addon; - break; - case "Patch": - case "patch": - actionType = RelatedBundleActionType.Patch; + case "Id": + id = this.Core.GetAttributeGuidValue(sourceLineNumbers, attrib, false); break; - case "": + case "Action": + var action = this.Core.GetAttributeValue(sourceLineNumbers, attrib); + switch (action) + { + case "Detect": + case "detect": + actionType = RelatedBundleActionType.Detect; + break; + case "Upgrade": + case "upgrade": + actionType = RelatedBundleActionType.Upgrade; + break; + case "Addon": + case "addon": + actionType = RelatedBundleActionType.Addon; + break; + case "Patch": + case "patch": + actionType = RelatedBundleActionType.Patch; + break; + case "": + break; + default: + this.Core.Write(ErrorMessages.IllegalAttributeValue(sourceLineNumbers, node.Name.LocalName, "Action", action, "Detect", "Upgrade", "Addon", "Patch")); + break; + } break; default: - this.Core.Write(ErrorMessages.IllegalAttributeValue(sourceLineNumbers, node.Name.LocalName, "Action", action, "Detect", "Upgrade", "Addon", "Patch")); + this.Core.UnexpectedAttribute(node, attrib); break; - } - break; - default: - this.Core.UnexpectedAttribute(node, attrib); - break; } } else @@ -3118,12 +3118,12 @@ namespace WixToolset.Core { switch (attrib.Name.LocalName) { - case "Location": - location = this.Core.GetAttributeValue(sourceLineNumbers, attrib); - break; - default: - this.Core.UnexpectedAttribute(node, attrib); - break; + case "Location": + location = this.Core.GetAttributeValue(sourceLineNumbers, attrib); + break; + default: + this.Core.UnexpectedAttribute(node, attrib); + break; } } else @@ -3238,30 +3238,30 @@ namespace WixToolset.Core { switch (attrib.Name.LocalName) { - case "Hidden": - if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) - { - hidden = true; - } - break; - case "Name": - name = this.Core.GetAttributeBundleVariableValue(sourceLineNumbers, attrib); - break; - case "Persisted": - if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) - { - persisted = true; - } - break; - case "Value": - value = this.Core.GetAttributeValue(sourceLineNumbers, attrib, EmptyRule.CanBeEmpty); - break; - case "Type": - typeValue = this.Core.GetAttributeValue(sourceLineNumbers, attrib); - break; - default: - this.Core.UnexpectedAttribute(node, attrib); - break; + case "Hidden": + if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) + { + hidden = true; + } + break; + case "Name": + name = this.Core.GetAttributeBundleVariableValue(sourceLineNumbers, attrib); + break; + case "Persisted": + if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) + { + persisted = true; + } + break; + case "Value": + value = this.Core.GetAttributeValue(sourceLineNumbers, attrib, EmptyRule.CanBeEmpty); + break; + case "Type": + typeValue = this.Core.GetAttributeValue(sourceLineNumbers, attrib); + break; + default: + this.Core.UnexpectedAttribute(node, attrib); + break; } } else diff --git a/src/wix/WixToolset.Core/Link/FlattenAndProcessBundleTablesCommand.cs b/src/wix/WixToolset.Core/Link/FlattenAndProcessBundleTablesCommand.cs index 16593c7d..6c1c0cf3 100644 --- a/src/wix/WixToolset.Core/Link/FlattenAndProcessBundleTablesCommand.cs +++ b/src/wix/WixToolset.Core/Link/FlattenAndProcessBundleTablesCommand.cs @@ -188,7 +188,6 @@ namespace WixToolset.Core.Link } } } - } } } -- cgit v1.2.3-55-g6feb