diff options
| author | Sean Hall <r.sean.hall@gmail.com> | 2021-04-19 17:32:32 -0500 |
|---|---|---|
| committer | Sean Hall <r.sean.hall@gmail.com> | 2021-04-19 23:23:39 -0500 |
| commit | 62b32cd6f21292c73dae8d5cfcd3a1cb13a1fd7d (patch) | |
| tree | 428818dcb1ab7f1f79b236db7c67e82a6ea0774d /src/WixToolset.Mba.Core | |
| parent | 1a898496aae8189efb966abd9445e6200fdea0b7 (diff) | |
| download | wix-62b32cd6f21292c73dae8d5cfcd3a1cb13a1fd7d.tar.gz wix-62b32cd6f21292c73dae8d5cfcd3a1cb13a1fd7d.tar.bz2 wix-62b32cd6f21292c73dae8d5cfcd3a1cb13a1fd7d.zip | |
Replace OnResolveSource with OnCacheAcquireResolving.
Update balretry to have a separate type for container vs payload.
#3640
Diffstat (limited to 'src/WixToolset.Mba.Core')
| -rw-r--r-- | src/WixToolset.Mba.Core/BootstrapperApplication.cs | 24 | ||||
| -rw-r--r-- | src/WixToolset.Mba.Core/EventArgs.cs | 143 | ||||
| -rw-r--r-- | src/WixToolset.Mba.Core/IBootstrapperApplication.cs | 100 | ||||
| -rw-r--r-- | src/WixToolset.Mba.Core/IDefaultBootstrapperApplication.cs | 19 |
4 files changed, 168 insertions, 118 deletions
diff --git a/src/WixToolset.Mba.Core/BootstrapperApplication.cs b/src/WixToolset.Mba.Core/BootstrapperApplication.cs index b6c0dd0d..79cbfa86 100644 --- a/src/WixToolset.Mba.Core/BootstrapperApplication.cs +++ b/src/WixToolset.Mba.Core/BootstrapperApplication.cs | |||
| @@ -146,7 +146,7 @@ namespace WixToolset.Mba.Core | |||
| 146 | public event EventHandler<CacheAcquireProgressEventArgs> CacheAcquireProgress; | 146 | public event EventHandler<CacheAcquireProgressEventArgs> CacheAcquireProgress; |
| 147 | 147 | ||
| 148 | /// <inheritdoc/> | 148 | /// <inheritdoc/> |
| 149 | public event EventHandler<ResolveSourceEventArgs> ResolveSource; | 149 | public event EventHandler<CacheAcquireResolvingEventArgs> CacheAcquireResolving; |
| 150 | 150 | ||
| 151 | /// <inheritdoc/> | 151 | /// <inheritdoc/> |
| 152 | public event EventHandler<CacheAcquireCompleteEventArgs> CacheAcquireComplete; | 152 | public event EventHandler<CacheAcquireCompleteEventArgs> CacheAcquireComplete; |
| @@ -736,12 +736,12 @@ namespace WixToolset.Mba.Core | |||
| 736 | } | 736 | } |
| 737 | 737 | ||
| 738 | /// <summary> | 738 | /// <summary> |
| 739 | /// Called by the engine, raises the <see cref="ResolveSource"/> event. | 739 | /// Called by the engine, raises the <see cref="CacheAcquireResolving"/> event. |
| 740 | /// </summary> | 740 | /// </summary> |
| 741 | /// <param name="args">Additional arguments for this event.</param> | 741 | /// <param name="args">Additional arguments for this event.</param> |
| 742 | protected virtual void OnResolveSource(ResolveSourceEventArgs args) | 742 | protected virtual void OnCacheAcquireResolving(CacheAcquireResolvingEventArgs args) |
| 743 | { | 743 | { |
| 744 | EventHandler<ResolveSourceEventArgs> handler = this.ResolveSource; | 744 | EventHandler<CacheAcquireResolvingEventArgs> handler = this.CacheAcquireResolving; |
| 745 | if (null != handler) | 745 | if (null != handler) |
| 746 | { | 746 | { |
| 747 | handler(this, args); | 747 | handler(this, args); |
| @@ -1126,9 +1126,9 @@ namespace WixToolset.Mba.Core | |||
| 1126 | return args.HResult; | 1126 | return args.HResult; |
| 1127 | } | 1127 | } |
| 1128 | 1128 | ||
| 1129 | int IBootstrapperApplication.OnDetectBegin(bool fInstalled, int cPackages, ref bool fCancel) | 1129 | int IBootstrapperApplication.OnDetectBegin(bool fCached, bool fInstalled, int cPackages, ref bool fCancel) |
| 1130 | { | 1130 | { |
| 1131 | DetectBeginEventArgs args = new DetectBeginEventArgs(fInstalled, cPackages, fCancel); | 1131 | DetectBeginEventArgs args = new DetectBeginEventArgs(fCached, fInstalled, cPackages, fCancel); |
| 1132 | this.OnDetectBegin(args); | 1132 | this.OnDetectBegin(args); |
| 1133 | 1133 | ||
| 1134 | fCancel = args.Cancel; | 1134 | fCancel = args.Cancel; |
| @@ -1400,11 +1400,12 @@ namespace WixToolset.Mba.Core | |||
| 1400 | return args.HResult; | 1400 | return args.HResult; |
| 1401 | } | 1401 | } |
| 1402 | 1402 | ||
| 1403 | int IBootstrapperApplication.OnCacheAcquireBegin(string wzPackageOrContainerId, string wzPayloadId, CacheOperation operation, string wzSource, ref bool fCancel) | 1403 | int IBootstrapperApplication.OnCacheAcquireBegin(string wzPackageOrContainerId, string wzPayloadId, string wzSource, string wzDownloadUrl, string wzPayloadContainerId, CacheOperation recommendation, ref CacheOperation action, ref bool fCancel) |
| 1404 | { | 1404 | { |
| 1405 | CacheAcquireBeginEventArgs args = new CacheAcquireBeginEventArgs(wzPackageOrContainerId, wzPayloadId, operation, wzSource, fCancel); | 1405 | CacheAcquireBeginEventArgs args = new CacheAcquireBeginEventArgs(wzPackageOrContainerId, wzPayloadId, wzSource, wzDownloadUrl, wzPayloadContainerId, recommendation, action, fCancel); |
| 1406 | this.OnCacheAcquireBegin(args); | 1406 | this.OnCacheAcquireBegin(args); |
| 1407 | 1407 | ||
| 1408 | action = args.Action; | ||
| 1408 | fCancel = args.Cancel; | 1409 | fCancel = args.Cancel; |
| 1409 | return args.HResult; | 1410 | return args.HResult; |
| 1410 | } | 1411 | } |
| @@ -1418,11 +1419,12 @@ namespace WixToolset.Mba.Core | |||
| 1418 | return args.HResult; | 1419 | return args.HResult; |
| 1419 | } | 1420 | } |
| 1420 | 1421 | ||
| 1421 | int IBootstrapperApplication.OnResolveSource(string wzPackageOrContainerId, string wzPayloadId, string wzLocalSource, string wzDownloadSource, BOOTSTRAPPER_RESOLVESOURCE_ACTION recommendation, ref BOOTSTRAPPER_RESOLVESOURCE_ACTION action, ref bool fCancel) | 1422 | int IBootstrapperApplication.OnCacheAcquireResolving(string wzPackageOrContainerId, string wzPayloadId, string[] searchPaths, int cSearchPaths, bool fFoundLocal, int dwRecommendedSearchPath, string wzDownloadUrl, string wzPayloadContainerId, CacheResolveOperation recommendation, ref int dwChosenSearchPath, ref CacheResolveOperation action, ref bool fCancel) |
| 1422 | { | 1423 | { |
| 1423 | ResolveSourceEventArgs args = new ResolveSourceEventArgs(wzPackageOrContainerId, wzPayloadId, wzLocalSource, wzDownloadSource, action, recommendation, fCancel); | 1424 | CacheAcquireResolvingEventArgs args = new CacheAcquireResolvingEventArgs(wzPackageOrContainerId, wzPayloadId, searchPaths, fFoundLocal, dwRecommendedSearchPath, wzDownloadUrl, wzPayloadContainerId, recommendation, dwChosenSearchPath, action, fCancel); |
| 1424 | this.OnResolveSource(args); | 1425 | this.OnCacheAcquireResolving(args); |
| 1425 | 1426 | ||
| 1427 | dwChosenSearchPath = args.ChosenSearchPath; | ||
| 1426 | action = args.Action; | 1428 | action = args.Action; |
| 1427 | fCancel = args.Cancel; | 1429 | fCancel = args.Cancel; |
| 1428 | return args.HResult; | 1430 | return args.HResult; |
diff --git a/src/WixToolset.Mba.Core/EventArgs.cs b/src/WixToolset.Mba.Core/EventArgs.cs index 7e7cbd11..ee89b583 100644 --- a/src/WixToolset.Mba.Core/EventArgs.cs +++ b/src/WixToolset.Mba.Core/EventArgs.cs | |||
| @@ -123,6 +123,31 @@ namespace WixToolset.Mba.Core | |||
| 123 | } | 123 | } |
| 124 | 124 | ||
| 125 | /// <summary> | 125 | /// <summary> |
| 126 | /// Base class for cancellable action BA <see cref="EventArgs"/> classes. | ||
| 127 | /// </summary> | ||
| 128 | [Serializable] | ||
| 129 | public abstract class CancellableActionEventArgs<T> : CancellableHResultEventArgs | ||
| 130 | { | ||
| 131 | /// <summary /> | ||
| 132 | public CancellableActionEventArgs(bool cancelRecommendation, T recommendation, T action) | ||
| 133 | : base(cancelRecommendation) | ||
| 134 | { | ||
| 135 | this.Recommendation = recommendation; | ||
| 136 | this.Action = action; | ||
| 137 | } | ||
| 138 | |||
| 139 | /// <summary> | ||
| 140 | /// Gets the recommended action from the engine. | ||
| 141 | /// </summary> | ||
| 142 | public T Recommendation { get; private set; } | ||
| 143 | |||
| 144 | /// <summary> | ||
| 145 | /// Gets or sets the action to be performed. This is passed back to the engine. | ||
| 146 | /// </summary> | ||
| 147 | public T Action { get; set; } | ||
| 148 | } | ||
| 149 | |||
| 150 | /// <summary> | ||
| 126 | /// Additional arguments used when startup has begun. | 151 | /// Additional arguments used when startup has begun. |
| 127 | /// </summary> | 152 | /// </summary> |
| 128 | [Serializable] | 153 | [Serializable] |
| @@ -196,25 +221,26 @@ namespace WixToolset.Mba.Core | |||
| 196 | } | 221 | } |
| 197 | 222 | ||
| 198 | /// <summary> | 223 | /// <summary> |
| 199 | /// Additional arguments used when the overall detection phase has begun. | 224 | /// Event arguments for <see cref="IDefaultBootstrapperApplication.DetectBegin"/> |
| 200 | /// </summary> | 225 | /// </summary> |
| 201 | [Serializable] | 226 | [Serializable] |
| 202 | public class DetectBeginEventArgs : CancellableHResultEventArgs | 227 | public class DetectBeginEventArgs : CancellableHResultEventArgs |
| 203 | { | 228 | { |
| 204 | /// <summary> | 229 | /// <summary /> |
| 205 | /// Creates a new instance of the <see cref="DetectBeginEventArgs"/> class. | 230 | public DetectBeginEventArgs(bool cached, bool installed, int packageCount, bool cancelRecommendation) |
| 206 | /// </summary> | ||
| 207 | /// <param name="installed">Specifies whether the bundle is installed.</param> | ||
| 208 | /// <param name="packageCount">The number of packages to detect.</param> | ||
| 209 | /// <param name="cancelRecommendation">The recommendation from the engine.</param> | ||
| 210 | public DetectBeginEventArgs(bool installed, int packageCount, bool cancelRecommendation) | ||
| 211 | : base(cancelRecommendation) | 231 | : base(cancelRecommendation) |
| 212 | { | 232 | { |
| 233 | this.Cached = cached; | ||
| 213 | this.Installed = installed; | 234 | this.Installed = installed; |
| 214 | this.PackageCount = packageCount; | 235 | this.PackageCount = packageCount; |
| 215 | } | 236 | } |
| 216 | 237 | ||
| 217 | /// <summary> | 238 | /// <summary> |
| 239 | /// Gets whether the bundle is cached. | ||
| 240 | /// </summary> | ||
| 241 | public bool Cached { get; private set; } | ||
| 242 | |||
| 243 | /// <summary> | ||
| 218 | /// Gets whether the bundle is installed. | 244 | /// Gets whether the bundle is installed. |
| 219 | /// </summary> | 245 | /// </summary> |
| 220 | public bool Installed { get; private set; } | 246 | public bool Installed { get; private set; } |
| @@ -290,6 +316,7 @@ namespace WixToolset.Mba.Core | |||
| 290 | : base(cancelRecommendation) | 316 | : base(cancelRecommendation) |
| 291 | { | 317 | { |
| 292 | this.UpdateLocation = updateLocation; | 318 | this.UpdateLocation = updateLocation; |
| 319 | this.Skip = skipRecommendation; | ||
| 293 | } | 320 | } |
| 294 | 321 | ||
| 295 | /// <summary> | 322 | /// <summary> |
| @@ -1242,6 +1269,8 @@ namespace WixToolset.Mba.Core | |||
| 1242 | /// <param name="forceKeepRegistration"></param> | 1269 | /// <param name="forceKeepRegistration"></param> |
| 1243 | public UnregisterBeginEventArgs(bool keepRegistration, bool forceKeepRegistration) | 1270 | public UnregisterBeginEventArgs(bool keepRegistration, bool forceKeepRegistration) |
| 1244 | { | 1271 | { |
| 1272 | this.KeepRegistration = keepRegistration; | ||
| 1273 | this.ForceKeepRegistration = forceKeepRegistration; | ||
| 1245 | } | 1274 | } |
| 1246 | 1275 | ||
| 1247 | /// <summary> | 1276 | /// <summary> |
| @@ -1288,21 +1317,20 @@ namespace WixToolset.Mba.Core | |||
| 1288 | } | 1317 | } |
| 1289 | 1318 | ||
| 1290 | /// <summary> | 1319 | /// <summary> |
| 1291 | /// Additional arguments used when the engine begins to acquire containers or payloads. | 1320 | /// EventArgs for <see cref="IDefaultBootstrapperApplication.CacheAcquireBegin"/>. |
| 1292 | /// </summary> | 1321 | /// </summary> |
| 1293 | [Serializable] | 1322 | [Serializable] |
| 1294 | public class CacheAcquireBeginEventArgs : CancellableHResultEventArgs | 1323 | public class CacheAcquireBeginEventArgs : CancellableActionEventArgs<CacheOperation> |
| 1295 | { | 1324 | { |
| 1296 | /// <summary> | 1325 | /// <summary /> |
| 1297 | /// Creates a new instance of the <see cref="CacheAcquireBeginEventArgs"/> class. | 1326 | public CacheAcquireBeginEventArgs(string packageOrContainerId, string payloadId, string source, string downloadUrl, string payloadContainerId, CacheOperation recommendation, CacheOperation action, bool cancelRecommendation) |
| 1298 | /// </summary> | 1327 | : base(cancelRecommendation, recommendation, action) |
| 1299 | public CacheAcquireBeginEventArgs(string packageOrContainerId, string payloadId, CacheOperation operation, string source, bool cancelRecommendation) | ||
| 1300 | : base(cancelRecommendation) | ||
| 1301 | { | 1328 | { |
| 1302 | this.PackageOrContainerId = packageOrContainerId; | 1329 | this.PackageOrContainerId = packageOrContainerId; |
| 1303 | this.PayloadId = payloadId; | 1330 | this.PayloadId = payloadId; |
| 1304 | this.Operation = operation; | ||
| 1305 | this.Source = source; | 1331 | this.Source = source; |
| 1332 | this.DownloadUrl = downloadUrl; | ||
| 1333 | this.PayloadContainerId = payloadContainerId; | ||
| 1306 | } | 1334 | } |
| 1307 | 1335 | ||
| 1308 | /// <summary> | 1336 | /// <summary> |
| @@ -1316,25 +1344,28 @@ namespace WixToolset.Mba.Core | |||
| 1316 | public string PayloadId { get; private set; } | 1344 | public string PayloadId { get; private set; } |
| 1317 | 1345 | ||
| 1318 | /// <summary> | 1346 | /// <summary> |
| 1319 | /// Gets the cache acquire operation. | 1347 | /// Gets the source of the container or payload. |
| 1320 | /// </summary> | 1348 | /// </summary> |
| 1321 | public CacheOperation Operation { get; private set; } | 1349 | public string Source { get; private set; } |
| 1322 | 1350 | ||
| 1323 | /// <summary> | 1351 | /// <summary> |
| 1324 | /// Gets the source of the container or payload. | 1352 | /// Gets the optional URL to download container or payload. |
| 1325 | /// </summary> | 1353 | /// </summary> |
| 1326 | public string Source { get; private set; } | 1354 | public string DownloadUrl { get; private set; } |
| 1355 | |||
| 1356 | /// <summary> | ||
| 1357 | /// Gets the optional identity of the container that contains the payload being acquired. | ||
| 1358 | /// </summary> | ||
| 1359 | public string PayloadContainerId { get; private set; } | ||
| 1327 | } | 1360 | } |
| 1328 | 1361 | ||
| 1329 | /// <summary> | 1362 | /// <summary> |
| 1330 | /// Additional arguments used when the engine acquires some part of a container or payload. | 1363 | /// EventArgs for <see cref="IDefaultBootstrapperApplication.CacheAcquireProgress"/>. |
| 1331 | /// </summary> | 1364 | /// </summary> |
| 1332 | [Serializable] | 1365 | [Serializable] |
| 1333 | public class CacheAcquireProgressEventArgs : CancellableHResultEventArgs | 1366 | public class CacheAcquireProgressEventArgs : CancellableHResultEventArgs |
| 1334 | { | 1367 | { |
| 1335 | /// <summary> | 1368 | /// <summary /> |
| 1336 | /// Creates a new instance of the <see cref="CacheAcquireBeginEventArgs"/> class. | ||
| 1337 | /// </summary> | ||
| 1338 | public CacheAcquireProgressEventArgs(string packageOrContainerId, string payloadId, long progress, long total, int overallPercentage, bool cancelRecommendation) | 1369 | public CacheAcquireProgressEventArgs(string packageOrContainerId, string payloadId, long progress, long total, int overallPercentage, bool cancelRecommendation) |
| 1339 | : base(cancelRecommendation) | 1370 | : base(cancelRecommendation) |
| 1340 | { | 1371 | { |
| @@ -1372,14 +1403,12 @@ namespace WixToolset.Mba.Core | |||
| 1372 | } | 1403 | } |
| 1373 | 1404 | ||
| 1374 | /// <summary> | 1405 | /// <summary> |
| 1375 | /// Additional arguments used when the engine completes the acquisition of a container or payload. | 1406 | /// EventArgs for <see cref="IDefaultBootstrapperApplication.CacheAcquireComplete"/>. |
| 1376 | /// </summary> | 1407 | /// </summary> |
| 1377 | [Serializable] | 1408 | [Serializable] |
| 1378 | public class CacheAcquireCompleteEventArgs : ActionEventArgs<BOOTSTRAPPER_CACHEACQUIRECOMPLETE_ACTION> | 1409 | public class CacheAcquireCompleteEventArgs : ActionEventArgs<BOOTSTRAPPER_CACHEACQUIRECOMPLETE_ACTION> |
| 1379 | { | 1410 | { |
| 1380 | /// <summary> | 1411 | /// <summary /> |
| 1381 | /// Creates a new instance of the <see cref="CacheAcquireCompleteEventArgs"/> class. | ||
| 1382 | /// </summary> | ||
| 1383 | public CacheAcquireCompleteEventArgs(string packageOrContainerId, string payloadId, int hrStatus, BOOTSTRAPPER_CACHEACQUIRECOMPLETE_ACTION recommendation, BOOTSTRAPPER_CACHEACQUIRECOMPLETE_ACTION action) | 1412 | public CacheAcquireCompleteEventArgs(string packageOrContainerId, string payloadId, int hrStatus, BOOTSTRAPPER_CACHEACQUIRECOMPLETE_ACTION recommendation, BOOTSTRAPPER_CACHEACQUIRECOMPLETE_ACTION action) |
| 1384 | : base(hrStatus, recommendation, action) | 1413 | : base(hrStatus, recommendation, action) |
| 1385 | { | 1414 | { |
| @@ -1729,62 +1758,64 @@ namespace WixToolset.Mba.Core | |||
| 1729 | } | 1758 | } |
| 1730 | 1759 | ||
| 1731 | /// <summary> | 1760 | /// <summary> |
| 1732 | /// Additional arguments used by the engine to allow the BA to change the source | 1761 | /// EventArgs for <see cref="IDefaultBootstrapperApplication.CacheAcquireResolving"/>. |
| 1733 | /// using <see cref="Engine.SetLocalSource"/> or <see cref="Engine.SetDownloadSource"/>. | ||
| 1734 | /// </summary> | 1762 | /// </summary> |
| 1735 | [Serializable] | 1763 | [Serializable] |
| 1736 | public class ResolveSourceEventArgs : CancellableHResultEventArgs | 1764 | public class CacheAcquireResolvingEventArgs : CancellableActionEventArgs<CacheResolveOperation> |
| 1737 | { | 1765 | { |
| 1738 | /// <summary> | 1766 | /// <summary /> |
| 1739 | /// Creates a new instance of the <see cref="ResolveSourceEventArgs"/> class. | 1767 | public CacheAcquireResolvingEventArgs(string packageOrContainerId, string payloadId, string[] searchPaths, bool foundLocal, int recommendedSearchPath, string downloadUrl, string payloadContainerId, CacheResolveOperation recommendation, int chosenSearchPath, CacheResolveOperation action, bool cancel) |
| 1740 | /// </summary> | 1768 | : base(cancel, recommendation, action) |
| 1741 | /// <param name="packageOrContainerId">The identity of the package or container that requires source.</param> | ||
| 1742 | /// <param name="payloadId">The identity of the payload that requires source.</param> | ||
| 1743 | /// <param name="localSource">The current path used for source resolution.</param> | ||
| 1744 | /// <param name="downloadSource">Optional URL to download container or payload.</param> | ||
| 1745 | /// <param name="recommendation">The recommended action from the engine.</param> | ||
| 1746 | /// <param name="action">The action to perform.</param> | ||
| 1747 | /// <param name="cancelRecommendation">The recommendation from the engine.</param> | ||
| 1748 | public ResolveSourceEventArgs(string packageOrContainerId, string payloadId, string localSource, string downloadSource, BOOTSTRAPPER_RESOLVESOURCE_ACTION recommendation, BOOTSTRAPPER_RESOLVESOURCE_ACTION action, bool cancelRecommendation) | ||
| 1749 | : base(cancelRecommendation) | ||
| 1750 | { | 1769 | { |
| 1751 | this.PackageOrContainerId = packageOrContainerId; | 1770 | this.PackageOrContainerId = packageOrContainerId; |
| 1752 | this.PayloadId = payloadId; | 1771 | this.PayloadId = payloadId; |
| 1753 | this.LocalSource = localSource; | 1772 | this.SearchPaths = searchPaths; |
| 1754 | this.DownloadSource = downloadSource; | 1773 | this.FoundLocal = foundLocal; |
| 1755 | this.Recommendation = recommendation; | 1774 | this.RecommendedSearchPath = recommendedSearchPath; |
| 1756 | this.Action = action; | 1775 | this.DownloadUrl = downloadUrl; |
| 1776 | this.PayloadContainerId = payloadContainerId; | ||
| 1777 | this.ChosenSearchPath = chosenSearchPath; | ||
| 1757 | } | 1778 | } |
| 1758 | 1779 | ||
| 1759 | /// <summary> | 1780 | /// <summary> |
| 1760 | /// Gets the identity of the package or container that requires source. | 1781 | /// Gets the identity of the package or container that is being acquired. |
| 1761 | /// </summary> | 1782 | /// </summary> |
| 1762 | public string PackageOrContainerId { get; private set; } | 1783 | public string PackageOrContainerId { get; private set; } |
| 1763 | 1784 | ||
| 1764 | /// <summary> | 1785 | /// <summary> |
| 1765 | /// Gets the identity of the payload that requires source. | 1786 | /// Gets the identity of the payload that is being acquired. |
| 1766 | /// </summary> | 1787 | /// </summary> |
| 1767 | public string PayloadId { get; private set; } | 1788 | public string PayloadId { get; private set; } |
| 1768 | 1789 | ||
| 1769 | /// <summary> | 1790 | /// <summary> |
| 1770 | /// Gets the current path used for source resolution. | 1791 | /// Gets the search paths used for source resolution. |
| 1771 | /// </summary> | 1792 | /// </summary> |
| 1772 | public string LocalSource { get; private set; } | 1793 | public string[] SearchPaths { get; private set; } |
| 1794 | |||
| 1795 | /// <summary> | ||
| 1796 | /// Gets whether <see cref="RecommendedSearchPath"/> indicates that a file was found at that search path. | ||
| 1797 | /// </summary> | ||
| 1798 | public bool FoundLocal { get; private set; } | ||
| 1799 | |||
| 1800 | /// <summary> | ||
| 1801 | /// When <see cref="FoundLocal"/> is true, the index to <see cref="SearchPaths"/> for the recommended local file. | ||
| 1802 | /// </summary> | ||
| 1803 | public int RecommendedSearchPath { get; private set; } | ||
| 1773 | 1804 | ||
| 1774 | /// <summary> | 1805 | /// <summary> |
| 1775 | /// Gets the optional URL to download container or payload. | 1806 | /// Gets the optional URL to download container or payload. |
| 1776 | /// </summary> | 1807 | /// </summary> |
| 1777 | public string DownloadSource { get; private set; } | 1808 | public string DownloadUrl { get; private set; } |
| 1778 | 1809 | ||
| 1779 | /// <summary> | 1810 | /// <summary> |
| 1780 | /// Gets the recommended action from the engine. | 1811 | /// Gets the optional identity of the container that contains the payload being acquired. |
| 1781 | /// </summary> | 1812 | /// </summary> |
| 1782 | public BOOTSTRAPPER_RESOLVESOURCE_ACTION Recommendation { get; private set; } | 1813 | public string PayloadContainerId { get; private set; } |
| 1783 | 1814 | ||
| 1784 | /// <summary> | 1815 | /// <summary> |
| 1785 | /// Gets or sets the action to perform. | 1816 | /// Gets or sets the index to <see cref="SearchPaths"/> to use when <see cref="CancellableActionEventArgs{T}.Action"/> is set to <see cref="CacheOperation.Copy"/>. |
| 1786 | /// </summary> | 1817 | /// </summary> |
| 1787 | public BOOTSTRAPPER_RESOLVESOURCE_ACTION Action { get; set; } | 1818 | public int ChosenSearchPath { get; set; } |
| 1788 | } | 1819 | } |
| 1789 | 1820 | ||
| 1790 | /// <summary> | 1821 | /// <summary> |
diff --git a/src/WixToolset.Mba.Core/IBootstrapperApplication.cs b/src/WixToolset.Mba.Core/IBootstrapperApplication.cs index 14cb8fd5..88c65674 100644 --- a/src/WixToolset.Mba.Core/IBootstrapperApplication.cs +++ b/src/WixToolset.Mba.Core/IBootstrapperApplication.cs | |||
| @@ -44,13 +44,10 @@ namespace WixToolset.Mba.Core | |||
| 44 | /// <summary> | 44 | /// <summary> |
| 45 | /// See <see cref="IDefaultBootstrapperApplication.DetectBegin"/>. | 45 | /// See <see cref="IDefaultBootstrapperApplication.DetectBegin"/>. |
| 46 | /// </summary> | 46 | /// </summary> |
| 47 | /// <param name="fInstalled"></param> | ||
| 48 | /// <param name="cPackages"></param> | ||
| 49 | /// <param name="fCancel"></param> | ||
| 50 | /// <returns></returns> | ||
| 51 | [PreserveSig] | 47 | [PreserveSig] |
| 52 | [return: MarshalAs(UnmanagedType.I4)] | 48 | [return: MarshalAs(UnmanagedType.I4)] |
| 53 | int OnDetectBegin( | 49 | int OnDetectBegin( |
| 50 | [MarshalAs(UnmanagedType.Bool)] bool fCached, | ||
| 54 | [MarshalAs(UnmanagedType.Bool)] bool fInstalled, | 51 | [MarshalAs(UnmanagedType.Bool)] bool fInstalled, |
| 55 | [MarshalAs(UnmanagedType.U4)] int cPackages, | 52 | [MarshalAs(UnmanagedType.U4)] int cPackages, |
| 56 | [MarshalAs(UnmanagedType.Bool)] ref bool fCancel | 53 | [MarshalAs(UnmanagedType.Bool)] ref bool fCancel |
| @@ -540,32 +537,22 @@ namespace WixToolset.Mba.Core | |||
| 540 | /// <summary> | 537 | /// <summary> |
| 541 | /// See <see cref="IDefaultBootstrapperApplication.CacheAcquireBegin"/>. | 538 | /// See <see cref="IDefaultBootstrapperApplication.CacheAcquireBegin"/>. |
| 542 | /// </summary> | 539 | /// </summary> |
| 543 | /// <param name="wzPackageOrContainerId"></param> | ||
| 544 | /// <param name="wzPayloadId"></param> | ||
| 545 | /// <param name="operation"></param> | ||
| 546 | /// <param name="wzSource"></param> | ||
| 547 | /// <param name="fCancel"></param> | ||
| 548 | /// <returns></returns> | ||
| 549 | [PreserveSig] | 540 | [PreserveSig] |
| 550 | [return: MarshalAs(UnmanagedType.I4)] | 541 | [return: MarshalAs(UnmanagedType.I4)] |
| 551 | int OnCacheAcquireBegin( | 542 | int OnCacheAcquireBegin( |
| 552 | [MarshalAs(UnmanagedType.LPWStr)] string wzPackageOrContainerId, | 543 | [MarshalAs(UnmanagedType.LPWStr)] string wzPackageOrContainerId, |
| 553 | [MarshalAs(UnmanagedType.LPWStr)] string wzPayloadId, | 544 | [MarshalAs(UnmanagedType.LPWStr)] string wzPayloadId, |
| 554 | [MarshalAs(UnmanagedType.U4)] CacheOperation operation, | ||
| 555 | [MarshalAs(UnmanagedType.LPWStr)] string wzSource, | 545 | [MarshalAs(UnmanagedType.LPWStr)] string wzSource, |
| 546 | [MarshalAs(UnmanagedType.LPWStr)] string wzDownloadUrl, | ||
| 547 | [MarshalAs(UnmanagedType.LPWStr)] string wzPayloadContainerId, | ||
| 548 | [MarshalAs(UnmanagedType.U4)] CacheOperation recommendation, | ||
| 549 | [MarshalAs(UnmanagedType.I4)] ref CacheOperation action, | ||
| 556 | [MarshalAs(UnmanagedType.Bool)] ref bool fCancel | 550 | [MarshalAs(UnmanagedType.Bool)] ref bool fCancel |
| 557 | ); | 551 | ); |
| 558 | 552 | ||
| 559 | /// <summary> | 553 | /// <summary> |
| 560 | /// See <see cref="IDefaultBootstrapperApplication.CacheAcquireProgress"/>. | 554 | /// See <see cref="IDefaultBootstrapperApplication.CacheAcquireProgress"/>. |
| 561 | /// </summary> | 555 | /// </summary> |
| 562 | /// <param name="wzPackageOrContainerId"></param> | ||
| 563 | /// <param name="wzPayloadId"></param> | ||
| 564 | /// <param name="dw64Progress"></param> | ||
| 565 | /// <param name="dw64Total"></param> | ||
| 566 | /// <param name="dwOverallPercentage"></param> | ||
| 567 | /// <param name="fCancel"></param> | ||
| 568 | /// <returns></returns> | ||
| 569 | [PreserveSig] | 556 | [PreserveSig] |
| 570 | [return: MarshalAs(UnmanagedType.I4)] | 557 | [return: MarshalAs(UnmanagedType.I4)] |
| 571 | int OnCacheAcquireProgress( | 558 | int OnCacheAcquireProgress( |
| @@ -578,37 +565,28 @@ namespace WixToolset.Mba.Core | |||
| 578 | ); | 565 | ); |
| 579 | 566 | ||
| 580 | /// <summary> | 567 | /// <summary> |
| 581 | /// See <see cref="IDefaultBootstrapperApplication.ResolveSource"/>. | 568 | /// See <see cref="IDefaultBootstrapperApplication.CacheAcquireResolving"/>. |
| 582 | /// </summary> | 569 | /// </summary> |
| 583 | /// <param name="wzPackageOrContainerId"></param> | ||
| 584 | /// <param name="wzPayloadId"></param> | ||
| 585 | /// <param name="wzLocalSource"></param> | ||
| 586 | /// <param name="wzDownloadSource"></param> | ||
| 587 | /// <param name="recommendation"></param> | ||
| 588 | /// <param name="action"></param> | ||
| 589 | /// <param name="fCancel"></param> | ||
| 590 | /// <returns></returns> | ||
| 591 | [PreserveSig] | 570 | [PreserveSig] |
| 592 | [return: MarshalAs(UnmanagedType.I4)] | 571 | [return: MarshalAs(UnmanagedType.I4)] |
| 593 | int OnResolveSource( | 572 | int OnCacheAcquireResolving( |
| 594 | [MarshalAs(UnmanagedType.LPWStr)] string wzPackageOrContainerId, | 573 | [MarshalAs(UnmanagedType.LPWStr)] string wzPackageOrContainerId, |
| 595 | [MarshalAs(UnmanagedType.LPWStr)] string wzPayloadId, | 574 | [MarshalAs(UnmanagedType.LPWStr)] string wzPayloadId, |
| 596 | [MarshalAs(UnmanagedType.LPWStr)] string wzLocalSource, | 575 | [MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 3, ArraySubType = UnmanagedType.LPWStr), In] string[] searchPaths, |
| 597 | [MarshalAs(UnmanagedType.LPWStr)] string wzDownloadSource, | 576 | [MarshalAs(UnmanagedType.U4)] int cSearchPaths, |
| 598 | BOOTSTRAPPER_RESOLVESOURCE_ACTION recommendation, | 577 | [MarshalAs(UnmanagedType.Bool)] bool fFoundLocal, |
| 599 | ref BOOTSTRAPPER_RESOLVESOURCE_ACTION action, | 578 | [MarshalAs(UnmanagedType.U4)] int dwRecommendedSearchPath, |
| 579 | [MarshalAs(UnmanagedType.LPWStr)] string wzDownloadUrl, | ||
| 580 | [MarshalAs(UnmanagedType.LPWStr)] string wzPayloadContainerId, | ||
| 581 | [MarshalAs(UnmanagedType.I4)] CacheResolveOperation recommendation, | ||
| 582 | [MarshalAs(UnmanagedType.U4)] ref int dwChosenSearchPath, | ||
| 583 | [MarshalAs(UnmanagedType.I4)] ref CacheResolveOperation action, | ||
| 600 | [MarshalAs(UnmanagedType.Bool)] ref bool fCancel | 584 | [MarshalAs(UnmanagedType.Bool)] ref bool fCancel |
| 601 | ); | 585 | ); |
| 602 | 586 | ||
| 603 | /// <summary> | 587 | /// <summary> |
| 604 | /// See <see cref="IDefaultBootstrapperApplication.CacheAcquireComplete"/>. | 588 | /// See <see cref="IDefaultBootstrapperApplication.CacheAcquireComplete"/>. |
| 605 | /// </summary> | 589 | /// </summary> |
| 606 | /// <param name="wzPackageOrContainerId"></param> | ||
| 607 | /// <param name="wzPayloadId"></param> | ||
| 608 | /// <param name="hrStatus"></param> | ||
| 609 | /// <param name="recommendation"></param> | ||
| 610 | /// <param name="pAction"></param> | ||
| 611 | /// <returns></returns> | ||
| 612 | [PreserveSig] | 590 | [PreserveSig] |
| 613 | [return: MarshalAs(UnmanagedType.I4)] | 591 | [return: MarshalAs(UnmanagedType.I4)] |
| 614 | int OnCacheAcquireComplete( | 592 | int OnCacheAcquireComplete( |
| @@ -1419,19 +1397,55 @@ namespace WixToolset.Mba.Core | |||
| 1419 | public enum CacheOperation | 1397 | public enum CacheOperation |
| 1420 | { | 1398 | { |
| 1421 | /// <summary> | 1399 | /// <summary> |
| 1422 | /// Container or payload is being copied. | 1400 | /// There is no source available. |
| 1401 | /// </summary> | ||
| 1402 | None, | ||
| 1403 | |||
| 1404 | /// <summary> | ||
| 1405 | /// Copy the payload or container from the chosen local source. | ||
| 1423 | /// </summary> | 1406 | /// </summary> |
| 1424 | Copy, | 1407 | Copy, |
| 1425 | 1408 | ||
| 1426 | /// <summary> | 1409 | /// <summary> |
| 1427 | /// Container or payload is being downloaded. | 1410 | /// Download the payload or container using the download URL. |
| 1428 | /// </summary> | 1411 | /// </summary> |
| 1429 | Download, | 1412 | Download, |
| 1430 | 1413 | ||
| 1431 | /// <summary> | 1414 | /// <summary> |
| 1432 | /// Container or payload is being extracted. | 1415 | /// Extract the payload from the container. |
| 1416 | /// </summary> | ||
| 1417 | Extract, | ||
| 1418 | } | ||
| 1419 | |||
| 1420 | /// <summary> | ||
| 1421 | /// The source to be used to acquire a container or payload. | ||
| 1422 | /// </summary> | ||
| 1423 | public enum CacheResolveOperation | ||
| 1424 | { | ||
| 1425 | /// <summary> | ||
| 1426 | /// There is no source available. | ||
| 1427 | /// </summary> | ||
| 1428 | None, | ||
| 1429 | |||
| 1430 | /// <summary> | ||
| 1431 | /// Copy the payload or container from the chosen local source. | ||
| 1433 | /// </summary> | 1432 | /// </summary> |
| 1434 | Extract | 1433 | Local, |
| 1434 | |||
| 1435 | /// <summary> | ||
| 1436 | /// Download the payload or container from the download URL. | ||
| 1437 | /// </summary> | ||
| 1438 | Download, | ||
| 1439 | |||
| 1440 | /// <summary> | ||
| 1441 | /// Extract the payload from the container. | ||
| 1442 | /// </summary> | ||
| 1443 | Container, | ||
| 1444 | |||
| 1445 | /// <summary> | ||
| 1446 | /// Look again for the payload or container locally. | ||
| 1447 | /// </summary> | ||
| 1448 | Retry, | ||
| 1435 | } | 1449 | } |
| 1436 | 1450 | ||
| 1437 | /// <summary> | 1451 | /// <summary> |
| @@ -1637,7 +1651,7 @@ namespace WixToolset.Mba.Core | |||
| 1637 | } | 1651 | } |
| 1638 | 1652 | ||
| 1639 | /// <summary> | 1653 | /// <summary> |
| 1640 | /// The available actions for <see cref="IDefaultBootstrapperApplication.ResolveSource"/>. | 1654 | /// The available actions for <see cref="IDefaultBootstrapperApplication.CacheAcquireResolving"/>. |
| 1641 | /// </summary> | 1655 | /// </summary> |
| 1642 | public enum BOOTSTRAPPER_RESOLVESOURCE_ACTION | 1656 | public enum BOOTSTRAPPER_RESOLVESOURCE_ACTION |
| 1643 | { | 1657 | { |
diff --git a/src/WixToolset.Mba.Core/IDefaultBootstrapperApplication.cs b/src/WixToolset.Mba.Core/IDefaultBootstrapperApplication.cs index 269d4955..03f94d37 100644 --- a/src/WixToolset.Mba.Core/IDefaultBootstrapperApplication.cs +++ b/src/WixToolset.Mba.Core/IDefaultBootstrapperApplication.cs | |||
| @@ -30,12 +30,16 @@ namespace WixToolset.Mba.Core | |||
| 30 | event EventHandler<BeginMsiTransactionCompleteEventArgs> BeginMsiTransactionComplete; | 30 | event EventHandler<BeginMsiTransactionCompleteEventArgs> BeginMsiTransactionComplete; |
| 31 | 31 | ||
| 32 | /// <summary> | 32 | /// <summary> |
| 33 | /// Fired when the engine has begun acquiring the installation sources. | 33 | /// Fired when the engine has begun acquiring the payload or container. |
| 34 | /// The BA can change the source using <see cref="IEngine.SetLocalSource(string, string, string)"/> | ||
| 35 | /// or <see cref="IEngine.SetDownloadSource(string, string, string, string, string)"/>. | ||
| 34 | /// </summary> | 36 | /// </summary> |
| 35 | event EventHandler<CacheAcquireBeginEventArgs> CacheAcquireBegin; | 37 | event EventHandler<CacheAcquireBeginEventArgs> CacheAcquireBegin; |
| 36 | 38 | ||
| 37 | /// <summary> | 39 | /// <summary> |
| 38 | /// Fired when the engine has completed the acquisition of the installation sources. | 40 | /// Fired when the engine has completed the acquisition of the payload or container. |
| 41 | /// The BA can change the source using <see cref="IEngine.SetLocalSource(string, string, string)"/> | ||
| 42 | /// or <see cref="IEngine.SetDownloadSource(string, string, string, string, string)"/>. | ||
| 39 | /// </summary> | 43 | /// </summary> |
| 40 | event EventHandler<CacheAcquireCompleteEventArgs> CacheAcquireComplete; | 44 | event EventHandler<CacheAcquireCompleteEventArgs> CacheAcquireComplete; |
| 41 | 45 | ||
| @@ -45,6 +49,11 @@ namespace WixToolset.Mba.Core | |||
| 45 | event EventHandler<CacheAcquireProgressEventArgs> CacheAcquireProgress; | 49 | event EventHandler<CacheAcquireProgressEventArgs> CacheAcquireProgress; |
| 46 | 50 | ||
| 47 | /// <summary> | 51 | /// <summary> |
| 52 | /// Fired by the engine to allow the BA to override the acquisition action. | ||
| 53 | /// </summary> | ||
| 54 | event EventHandler<CacheAcquireResolvingEventArgs> CacheAcquireResolving; | ||
| 55 | |||
| 56 | /// <summary> | ||
| 48 | /// Fired when the engine has begun caching the installation sources. | 57 | /// Fired when the engine has begun caching the installation sources. |
| 49 | /// </summary> | 58 | /// </summary> |
| 50 | event EventHandler<CacheBeginEventArgs> CacheBegin; | 59 | event EventHandler<CacheBeginEventArgs> CacheBegin; |
| @@ -285,12 +294,6 @@ namespace WixToolset.Mba.Core | |||
| 285 | event EventHandler<RegisterCompleteEventArgs> RegisterComplete; | 294 | event EventHandler<RegisterCompleteEventArgs> RegisterComplete; |
| 286 | 295 | ||
| 287 | /// <summary> | 296 | /// <summary> |
| 288 | /// Fired by the engine to allow the BA to change the source | ||
| 289 | /// using <see cref="IEngine.SetLocalSource(string, string, string)"/> or <see cref="IEngine.SetDownloadSource(string, string, string, string, string)"/>. | ||
| 290 | /// </summary> | ||
| 291 | event EventHandler<ResolveSourceEventArgs> ResolveSource; | ||
| 292 | |||
| 293 | /// <summary> | ||
| 294 | /// Fired when the engine is about to rollback an MSI transaction. | 297 | /// Fired when the engine is about to rollback an MSI transaction. |
| 295 | /// </summary> | 298 | /// </summary> |
| 296 | event EventHandler<RollbackMsiTransactionBeginEventArgs> RollbackMsiTransactionBegin; | 299 | event EventHandler<RollbackMsiTransactionBeginEventArgs> RollbackMsiTransactionBegin; |
