| 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.Core.Burn.Bundles |
| 4 | { |
| 5 | using System; |
| 6 | using System.Collections.Generic; |
| 7 | using WixToolset.Data; |
| 8 | using WixToolset.Data.Symbols; |
| 9 | using WixToolset.Extensibility.Services; |
| 10 | |
| 11 | /// <summary> |
| 12 | /// Initializes package state from the Exe contents. |
| 13 | /// </summary> |
| 14 | internal class ProcessExePackageCommand |
| 15 | { |
| 16 | public ProcessExePackageCommand(IMessaging messaging, PackageFacade facade, Dictionary<string, WixBundlePayloadSymbol> payloadSymbols) |
| 17 | { |
| 18 | this.Messaging = messaging; |
| 19 | this.Facade = facade; |
| 20 | this.AuthoredPayloads = payloadSymbols; |
| 21 | } |
| 22 | |
| 23 | public IMessaging Messaging { get; } |
| 24 | |
| 25 | public Dictionary<string, WixBundlePayloadSymbol> AuthoredPayloads { get; } |
| 26 | |
| 27 | public PackageFacade Facade { get; } |
| 28 | |
| 29 | /// <summary> |
| 30 | /// Processes the Exe packages to add properties and payloads from the Exe packages. |
| 31 | /// </summary> |
| 32 | public void Execute() |
| 33 | { |
| 34 | var packagePayload = this.AuthoredPayloads[this.Facade.PackageSymbol.PayloadRef]; |
| 35 | |
| 36 | if (String.IsNullOrEmpty(this.Facade.PackageSymbol.CacheId)) |
| 37 | { |
| 38 | this.Facade.PackageSymbol.CacheId = CacheIdGenerator.GenerateLocalCacheId(this.Messaging, null, packagePayload, this.Facade.PackageSymbol.SourceLineNumbers, "ExePackage"); |
| 39 | } |
| 40 | |
| 41 | this.Facade.PackageSymbol.Version = packagePayload.Version; |
| 42 | } |
| 43 | } |
| 44 | } |