diff options
author | Sean Hall <r.sean.hall@gmail.com> | 2021-12-10 11:42:44 -0600 |
---|---|---|
committer | Sean Hall <r.sean.hall@gmail.com> | 2021-12-11 20:03:13 -0600 |
commit | fc30db9fa3aa1d25a6ef078452864673caa67ec5 (patch) | |
tree | e3415a5a1329a867b2934a038243e95098214ec3 /src/api/burn/WixToolset.Mba.Core | |
parent | 1d58b3333d1d694d08b68f6c87223aa504bfe773 (diff) | |
download | wix-fc30db9fa3aa1d25a6ef078452864673caa67ec5.tar.gz wix-fc30db9fa3aa1d25a6ef078452864673caa67ec5.tar.bz2 wix-fc30db9fa3aa1d25a6ef078452864673caa67ec5.zip |
Add BA events for setting the update bundle.
Fixes #6410
Diffstat (limited to 'src/api/burn/WixToolset.Mba.Core')
7 files changed, 147 insertions, 0 deletions
diff --git a/src/api/burn/WixToolset.Mba.Core/BootstrapperApplication.cs b/src/api/burn/WixToolset.Mba.Core/BootstrapperApplication.cs index 0520463f..a78bf43f 100644 --- a/src/api/burn/WixToolset.Mba.Core/BootstrapperApplication.cs +++ b/src/api/burn/WixToolset.Mba.Core/BootstrapperApplication.cs | |||
@@ -253,6 +253,12 @@ namespace WixToolset.Mba.Core | |||
253 | /// <inheritdoc/> | 253 | /// <inheritdoc/> |
254 | public event EventHandler<CachePayloadExtractCompleteEventArgs> CachePayloadExtractComplete; | 254 | public event EventHandler<CachePayloadExtractCompleteEventArgs> CachePayloadExtractComplete; |
255 | 255 | ||
256 | /// <inheritdoc/> | ||
257 | public event EventHandler<SetUpdateBeginEventArgs> SetUpdateBegin; | ||
258 | |||
259 | /// <inheritdoc/> | ||
260 | public event EventHandler<SetUpdateCompleteEventArgs> SetUpdateComplete; | ||
261 | |||
256 | /// <summary> | 262 | /// <summary> |
257 | /// Entry point that is called when the bootstrapper application is ready to run. | 263 | /// Entry point that is called when the bootstrapper application is ready to run. |
258 | /// </summary> | 264 | /// </summary> |
@@ -1225,6 +1231,32 @@ namespace WixToolset.Mba.Core | |||
1225 | } | 1231 | } |
1226 | } | 1232 | } |
1227 | 1233 | ||
1234 | /// <summary> | ||
1235 | /// Called by the engine, raises the <see cref="SetUpdateBegin"/> event. | ||
1236 | /// </summary> | ||
1237 | /// <param name="args"></param> | ||
1238 | protected virtual void OnSetUpdateBegin(SetUpdateBeginEventArgs args) | ||
1239 | { | ||
1240 | EventHandler<SetUpdateBeginEventArgs> handler = this.SetUpdateBegin; | ||
1241 | if (null != handler) | ||
1242 | { | ||
1243 | handler(this, args); | ||
1244 | } | ||
1245 | } | ||
1246 | |||
1247 | /// <summary> | ||
1248 | /// Called by the engine, raises the <see cref="SetUpdateComplete"/> event. | ||
1249 | /// </summary> | ||
1250 | /// <param name="args"></param> | ||
1251 | protected virtual void OnSetUpdateComplete(SetUpdateCompleteEventArgs args) | ||
1252 | { | ||
1253 | EventHandler<SetUpdateCompleteEventArgs> handler = this.SetUpdateComplete; | ||
1254 | if (null != handler) | ||
1255 | { | ||
1256 | handler(this, args); | ||
1257 | } | ||
1258 | } | ||
1259 | |||
1228 | #region IBootstrapperApplication Members | 1260 | #region IBootstrapperApplication Members |
1229 | 1261 | ||
1230 | int IBootstrapperApplication.BAProc(int message, IntPtr pvArgs, IntPtr pvResults, IntPtr pvContext) | 1262 | int IBootstrapperApplication.BAProc(int message, IntPtr pvArgs, IntPtr pvResults, IntPtr pvContext) |
@@ -1895,6 +1927,22 @@ namespace WixToolset.Mba.Core | |||
1895 | return args.HResult; | 1927 | return args.HResult; |
1896 | } | 1928 | } |
1897 | 1929 | ||
1930 | int IBootstrapperApplication.OnSetUpdateBegin() | ||
1931 | { | ||
1932 | SetUpdateBeginEventArgs args = new SetUpdateBeginEventArgs(); | ||
1933 | this.OnSetUpdateBegin(args); | ||
1934 | |||
1935 | return args.HResult; | ||
1936 | } | ||
1937 | |||
1938 | int IBootstrapperApplication.OnSetUpdateComplete(int hrStatus, string wzPreviousPackageId, string wzNewPackageId) | ||
1939 | { | ||
1940 | SetUpdateCompleteEventArgs args = new SetUpdateCompleteEventArgs(hrStatus, wzPreviousPackageId, wzNewPackageId); | ||
1941 | this.OnSetUpdateComplete(args); | ||
1942 | |||
1943 | return args.HResult; | ||
1944 | } | ||
1945 | |||
1898 | #endregion | 1946 | #endregion |
1899 | } | 1947 | } |
1900 | } | 1948 | } |
diff --git a/src/api/burn/WixToolset.Mba.Core/BundleInfo.cs b/src/api/burn/WixToolset.Mba.Core/BundleInfo.cs index 4a533bf9..ee751ebf 100644 --- a/src/api/burn/WixToolset.Mba.Core/BundleInfo.cs +++ b/src/api/burn/WixToolset.Mba.Core/BundleInfo.cs | |||
@@ -41,6 +41,14 @@ namespace WixToolset.Mba.Core | |||
41 | return package; | 41 | return package; |
42 | } | 42 | } |
43 | 43 | ||
44 | /// <inheritdoc/> | ||
45 | public IPackageInfo AddUpdateBundleAsPackage(SetUpdateCompleteEventArgs e) | ||
46 | { | ||
47 | var package = PackageInfo.GetUpdateBundleAsPackage(e.NewPackageId); | ||
48 | this.Packages.Add(package.Id, package); | ||
49 | return package; | ||
50 | } | ||
51 | |||
44 | /// <summary> | 52 | /// <summary> |
45 | /// Parses BA manifest from the given stream. | 53 | /// Parses BA manifest from the given stream. |
46 | /// </summary> | 54 | /// </summary> |
diff --git a/src/api/burn/WixToolset.Mba.Core/EventArgs.cs b/src/api/burn/WixToolset.Mba.Core/EventArgs.cs index 556db821..55c9e74c 100644 --- a/src/api/burn/WixToolset.Mba.Core/EventArgs.cs +++ b/src/api/burn/WixToolset.Mba.Core/EventArgs.cs | |||
@@ -2230,4 +2230,41 @@ namespace WixToolset.Mba.Core | |||
2230 | /// </summary> | 2230 | /// </summary> |
2231 | public string PayloadId { get; private set; } | 2231 | public string PayloadId { get; private set; } |
2232 | } | 2232 | } |
2233 | |||
2234 | /// <summary> | ||
2235 | /// EventArgs for <see cref="IDefaultBootstrapperApplication.SetUpdateBegin"/>. | ||
2236 | /// </summary> | ||
2237 | [Serializable] | ||
2238 | public class SetUpdateBeginEventArgs : HResultEventArgs | ||
2239 | { | ||
2240 | /// <summary /> | ||
2241 | public SetUpdateBeginEventArgs() | ||
2242 | { | ||
2243 | } | ||
2244 | } | ||
2245 | |||
2246 | /// <summary> | ||
2247 | /// Event arguments for <see cref="IDefaultBootstrapperApplication.SetUpdateComplete"/> | ||
2248 | /// </summary> | ||
2249 | [Serializable] | ||
2250 | public class SetUpdateCompleteEventArgs : StatusEventArgs | ||
2251 | { | ||
2252 | /// <summary /> | ||
2253 | public SetUpdateCompleteEventArgs(int hrStatus, string previousPackageId, string newPackageId) | ||
2254 | : base(hrStatus) | ||
2255 | { | ||
2256 | this.PreviousPackageId = previousPackageId; | ||
2257 | this.NewPackageId = newPackageId; | ||
2258 | } | ||
2259 | |||
2260 | /// <summary> | ||
2261 | /// Gets the identifier of the update package that was removed. | ||
2262 | /// </summary> | ||
2263 | public string PreviousPackageId { get; private set; } | ||
2264 | |||
2265 | /// <summary> | ||
2266 | /// Gets the identifier of the update package that was added. | ||
2267 | /// </summary> | ||
2268 | public string NewPackageId { get; private set; } | ||
2269 | } | ||
2233 | } | 2270 | } |
diff --git a/src/api/burn/WixToolset.Mba.Core/IBootstrapperApplication.cs b/src/api/burn/WixToolset.Mba.Core/IBootstrapperApplication.cs index 259c407f..f0c0b7ec 100644 --- a/src/api/burn/WixToolset.Mba.Core/IBootstrapperApplication.cs +++ b/src/api/burn/WixToolset.Mba.Core/IBootstrapperApplication.cs | |||
@@ -1097,6 +1097,24 @@ namespace WixToolset.Mba.Core | |||
1097 | [MarshalAs(UnmanagedType.LPWStr)] string wzPayloadId, | 1097 | [MarshalAs(UnmanagedType.LPWStr)] string wzPayloadId, |
1098 | int hrStatus | 1098 | int hrStatus |
1099 | ); | 1099 | ); |
1100 | |||
1101 | /// <summary> | ||
1102 | /// See <see cref="IDefaultBootstrapperApplication.SetUpdateBegin"/>. | ||
1103 | /// </summary> | ||
1104 | [PreserveSig] | ||
1105 | [return: MarshalAs(UnmanagedType.I4)] | ||
1106 | int OnSetUpdateBegin(); | ||
1107 | |||
1108 | /// <summary> | ||
1109 | /// See <see cref="IDefaultBootstrapperApplication.SetUpdateComplete"/>. | ||
1110 | /// </summary> | ||
1111 | [PreserveSig] | ||
1112 | [return: MarshalAs(UnmanagedType.I4)] | ||
1113 | int OnSetUpdateComplete( | ||
1114 | int hrStatus, | ||
1115 | [MarshalAs(UnmanagedType.LPWStr)] string wzPreviousPackageId, | ||
1116 | [MarshalAs(UnmanagedType.LPWStr)] string wzNewPackageId | ||
1117 | ); | ||
1100 | } | 1118 | } |
1101 | 1119 | ||
1102 | /// <summary> | 1120 | /// <summary> |
diff --git a/src/api/burn/WixToolset.Mba.Core/IBundleInfo.cs b/src/api/burn/WixToolset.Mba.Core/IBundleInfo.cs index 35decc88..3227b72d 100644 --- a/src/api/burn/WixToolset.Mba.Core/IBundleInfo.cs +++ b/src/api/burn/WixToolset.Mba.Core/IBundleInfo.cs | |||
@@ -40,5 +40,12 @@ namespace WixToolset.Mba.Core | |||
40 | /// <param name="e"></param> | 40 | /// <param name="e"></param> |
41 | /// <returns>The created <see cref="IPackageInfo"/>.</returns> | 41 | /// <returns>The created <see cref="IPackageInfo"/>.</returns> |
42 | IPackageInfo AddRelatedBundleAsPackage(DetectRelatedBundleEventArgs e); | 42 | IPackageInfo AddRelatedBundleAsPackage(DetectRelatedBundleEventArgs e); |
43 | |||
44 | /// <summary> | ||
45 | /// Adds an update bundle as a package. | ||
46 | /// </summary> | ||
47 | /// <param name="e"></param> | ||
48 | /// <returns>The created <see cref="IPackageInfo"/>.</returns> | ||
49 | IPackageInfo AddUpdateBundleAsPackage(SetUpdateCompleteEventArgs e); | ||
43 | } | 50 | } |
44 | } \ No newline at end of file | 51 | } \ No newline at end of file |
diff --git a/src/api/burn/WixToolset.Mba.Core/IDefaultBootstrapperApplication.cs b/src/api/burn/WixToolset.Mba.Core/IDefaultBootstrapperApplication.cs index 20ce9f88..e809a965 100644 --- a/src/api/burn/WixToolset.Mba.Core/IDefaultBootstrapperApplication.cs +++ b/src/api/burn/WixToolset.Mba.Core/IDefaultBootstrapperApplication.cs | |||
@@ -344,6 +344,16 @@ namespace WixToolset.Mba.Core | |||
344 | event EventHandler<RollbackMsiTransactionCompleteEventArgs> RollbackMsiTransactionComplete; | 344 | event EventHandler<RollbackMsiTransactionCompleteEventArgs> RollbackMsiTransactionComplete; |
345 | 345 | ||
346 | /// <summary> | 346 | /// <summary> |
347 | /// Fired when the engine has begun to setup the update package. | ||
348 | /// </summary> | ||
349 | event EventHandler<SetUpdateBeginEventArgs> SetUpdateBegin; | ||
350 | |||
351 | /// <summary> | ||
352 | /// Fired when the engine has completed setting up the update package. | ||
353 | /// </summary> | ||
354 | event EventHandler<SetUpdateCompleteEventArgs> SetUpdateComplete; | ||
355 | |||
356 | /// <summary> | ||
347 | /// Fired when the engine is shutting down the bootstrapper application. | 357 | /// Fired when the engine is shutting down the bootstrapper application. |
348 | /// </summary> | 358 | /// </summary> |
349 | event EventHandler<ShutdownEventArgs> Shutdown; | 359 | event EventHandler<ShutdownEventArgs> Shutdown; |
diff --git a/src/api/burn/WixToolset.Mba.Core/PackageInfo.cs b/src/api/burn/WixToolset.Mba.Core/PackageInfo.cs index 567a7cdd..3681a497 100644 --- a/src/api/burn/WixToolset.Mba.Core/PackageInfo.cs +++ b/src/api/burn/WixToolset.Mba.Core/PackageInfo.cs | |||
@@ -51,6 +51,11 @@ namespace WixToolset.Mba.Core | |||
51 | /// | 51 | /// |
52 | /// </summary> | 52 | /// </summary> |
53 | PatchBundle, | 53 | PatchBundle, |
54 | |||
55 | /// <summary> | ||
56 | /// | ||
57 | /// </summary> | ||
58 | UpdateBundle, | ||
54 | } | 59 | } |
55 | 60 | ||
56 | /// <summary> | 61 | /// <summary> |
@@ -269,6 +274,20 @@ namespace WixToolset.Mba.Core | |||
269 | return package; | 274 | return package; |
270 | } | 275 | } |
271 | 276 | ||
277 | /// <summary> | ||
278 | /// | ||
279 | /// </summary> | ||
280 | /// <param name="id"></param> | ||
281 | /// <returns></returns> | ||
282 | public static IPackageInfo GetUpdateBundleAsPackage(string id) | ||
283 | { | ||
284 | PackageInfo package = new PackageInfo(); | ||
285 | package.Id = id; | ||
286 | package.Type = PackageType.UpdateBundle; | ||
287 | |||
288 | return package; | ||
289 | } | ||
290 | |||
272 | internal static void ParseBalPackageInfoFromXml(XPathNavigator root, XmlNamespaceManager namespaceManager, Dictionary<string, IPackageInfo> packagesById) | 291 | internal static void ParseBalPackageInfoFromXml(XPathNavigator root, XmlNamespaceManager namespaceManager, Dictionary<string, IPackageInfo> packagesById) |
273 | { | 292 | { |
274 | XPathNodeIterator nodes = root.Select("/p:BootstrapperApplicationData/p:WixBalPackageInfo", namespaceManager); | 293 | XPathNodeIterator nodes = root.Select("/p:BootstrapperApplicationData/p:WixBalPackageInfo", namespaceManager); |