diff options
author | Rob Mensching <rob@firegiant.com> | 2022-02-25 22:24:42 -0800 |
---|---|---|
committer | Rob Mensching <rob@firegiant.com> | 2022-02-28 16:56:09 -0800 |
commit | 5fd804165587b3b6d2bd6b9844dcb3fa55a4a305 (patch) | |
tree | 2fe3f82b049734845e8a0f1a0719aabaa8bd3d19 /src/wix/heat/PayloadHarvester.cs | |
parent | 82bfd1218699a08c8d9cd775fc9e3eef3ec519a2 (diff) | |
download | wix-5fd804165587b3b6d2bd6b9844dcb3fa55a4a305.tar.gz wix-5fd804165587b3b6d2bd6b9844dcb3fa55a4a305.tar.bz2 wix-5fd804165587b3b6d2bd6b9844dcb3fa55a4a305.zip |
Support certs on remote payloads and generate them from burn subcommand
Bring back Authenticode certificate validation but only on Exe and
Msu remote payloads. Move the generation of remote payload XML to
a subcommand of the "burn command".
Diffstat (limited to 'src/wix/heat/PayloadHarvester.cs')
-rw-r--r-- | src/wix/heat/PayloadHarvester.cs | 129 |
1 files changed, 0 insertions, 129 deletions
diff --git a/src/wix/heat/PayloadHarvester.cs b/src/wix/heat/PayloadHarvester.cs deleted file mode 100644 index d2492512..00000000 --- a/src/wix/heat/PayloadHarvester.cs +++ /dev/null | |||
@@ -1,129 +0,0 @@ | |||
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.Harvesters | ||
4 | { | ||
5 | using System; | ||
6 | using System.IO; | ||
7 | using WixToolset.Core.Burn.Interfaces; | ||
8 | using WixToolset.Data; | ||
9 | using WixToolset.Data.Symbols; | ||
10 | using WixToolset.Harvesters.Data; | ||
11 | using WixToolset.Harvesters.Extensibility; | ||
12 | using Wix = WixToolset.Harvesters.Serialize; | ||
13 | |||
14 | /// <summary> | ||
15 | /// Harvest WiX authoring for a payload from the file system. | ||
16 | /// </summary> | ||
17 | public sealed class PayloadHarvester : BaseHarvesterExtension | ||
18 | { | ||
19 | private bool setUniqueIdentifiers; | ||
20 | private WixBundlePackageType packageType; | ||
21 | |||
22 | private IPayloadHarvester payloadHarvester; | ||
23 | |||
24 | /// <summary> | ||
25 | /// Instantiate a new PayloadHarvester. | ||
26 | /// </summary> | ||
27 | public PayloadHarvester(IPayloadHarvester payloadHarvester, WixBundlePackageType packageType) | ||
28 | { | ||
29 | this.payloadHarvester = payloadHarvester; | ||
30 | |||
31 | this.packageType = packageType; | ||
32 | this.setUniqueIdentifiers = true; | ||
33 | } | ||
34 | |||
35 | /// <summary> | ||
36 | /// Gets of sets the option to set unique identifiers. | ||
37 | /// </summary> | ||
38 | /// <value>The option to set unique identifiers.</value> | ||
39 | public bool SetUniqueIdentifiers | ||
40 | { | ||
41 | get { return this.setUniqueIdentifiers; } | ||
42 | set { this.setUniqueIdentifiers = value; } | ||
43 | } | ||
44 | |||
45 | /// <summary> | ||
46 | /// Harvest a payload. | ||
47 | /// </summary> | ||
48 | /// <param name="argument">The path of the payload.</param> | ||
49 | /// <returns>A harvested payload.</returns> | ||
50 | public override Wix.Fragment[] Harvest(string argument) | ||
51 | { | ||
52 | if (null == argument) | ||
53 | { | ||
54 | throw new ArgumentNullException("argument"); | ||
55 | } | ||
56 | |||
57 | string fullPath = Path.GetFullPath(argument); | ||
58 | |||
59 | var remotePayload = this.HarvestRemotePayload(fullPath); | ||
60 | |||
61 | var fragment = new Wix.Fragment(); | ||
62 | fragment.AddChild(remotePayload); | ||
63 | |||
64 | return new Wix.Fragment[] { fragment }; | ||
65 | } | ||
66 | |||
67 | /// <summary> | ||
68 | /// Harvest a payload. | ||
69 | /// </summary> | ||
70 | /// <param name="path">The path of the payload.</param> | ||
71 | /// <returns>A harvested payload.</returns> | ||
72 | public Wix.RemotePayload HarvestRemotePayload(string path) | ||
73 | { | ||
74 | if (null == path) | ||
75 | { | ||
76 | throw new ArgumentNullException("path"); | ||
77 | } | ||
78 | |||
79 | if (!File.Exists(path)) | ||
80 | { | ||
81 | throw new WixException(HarvesterErrors.FileNotFound(path)); | ||
82 | } | ||
83 | |||
84 | Wix.RemotePayload remotePayload; | ||
85 | |||
86 | switch (this.packageType) | ||
87 | { | ||
88 | case WixBundlePackageType.Exe: | ||
89 | remotePayload = new Wix.ExePackagePayload(); | ||
90 | break; | ||
91 | case WixBundlePackageType.Msu: | ||
92 | remotePayload = new Wix.MsuPackagePayload(); | ||
93 | break; | ||
94 | default: | ||
95 | throw new NotImplementedException(); | ||
96 | } | ||
97 | |||
98 | var payloadSymbol = new WixBundlePayloadSymbol | ||
99 | { | ||
100 | SourceFile = new IntermediateFieldPathValue { Path = path }, | ||
101 | }; | ||
102 | |||
103 | this.payloadHarvester.HarvestStandardInformation(payloadSymbol); | ||
104 | |||
105 | if (payloadSymbol.FileSize.HasValue) | ||
106 | { | ||
107 | remotePayload.Size = payloadSymbol.FileSize.Value; | ||
108 | } | ||
109 | remotePayload.Hash = payloadSymbol.Hash; | ||
110 | |||
111 | if (!String.IsNullOrEmpty(payloadSymbol.Version)) | ||
112 | { | ||
113 | remotePayload.Version = payloadSymbol.Version; | ||
114 | } | ||
115 | |||
116 | if (!String.IsNullOrEmpty(payloadSymbol.Description)) | ||
117 | { | ||
118 | remotePayload.Description = payloadSymbol.Description; | ||
119 | } | ||
120 | |||
121 | if (!String.IsNullOrEmpty(payloadSymbol.DisplayName)) | ||
122 | { | ||
123 | remotePayload.ProductName = payloadSymbol.DisplayName; | ||
124 | } | ||
125 | |||
126 | return remotePayload; | ||
127 | } | ||
128 | } | ||
129 | } | ||