From 3c88529e8e29f9763a6830f8d3ac29cd56a4cb33 Mon Sep 17 00:00:00 2001 From: Sean Hall Date: Wed, 5 May 2021 21:01:28 -0500 Subject: Update WixBA to Mba.Core 4.0.58. --- src/WixToolset.WixBA/InstallationViewModel.cs | 35 ++++++++++++++++++--------- src/WixToolset.WixBA/ProgressViewModel.cs | 33 +++++++++++++++++++++++++ src/WixToolset.WixBA/WixToolset.WixBA.csproj | 2 +- 3 files changed, 58 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/WixToolset.WixBA/InstallationViewModel.cs b/src/WixToolset.WixBA/InstallationViewModel.cs index c7b736ff..2beebd02 100644 --- a/src/WixToolset.WixBA/InstallationViewModel.cs +++ b/src/WixToolset.WixBA/InstallationViewModel.cs @@ -79,11 +79,11 @@ namespace WixToolset.WixBA WixBA.Model.Bootstrapper.PlanComplete += this.PlanComplete; WixBA.Model.Bootstrapper.ApplyBegin += this.ApplyBegin; WixBA.Model.Bootstrapper.CacheAcquireBegin += this.CacheAcquireBegin; + WixBA.Model.Bootstrapper.CacheAcquireResolving += this.CacheAcquireResolving; WixBA.Model.Bootstrapper.CacheAcquireComplete += this.CacheAcquireComplete; WixBA.Model.Bootstrapper.ExecutePackageBegin += this.ExecutePackageBegin; WixBA.Model.Bootstrapper.ExecutePackageComplete += this.ExecutePackageComplete; WixBA.Model.Bootstrapper.Error += this.ExecuteError; - WixBA.Model.Bootstrapper.ResolveSource += this.ResolveSource; WixBA.Model.Bootstrapper.ApplyComplete += this.ApplyComplete; } @@ -492,9 +492,32 @@ namespace WixToolset.WixBA this.cachePackageStart = DateTime.Now; } + private void CacheAcquireResolving(object sender, CacheAcquireResolvingEventArgs e) + { + if (e.Action == CacheResolveOperation.Download && !this.downloadRetries.ContainsKey(e.PackageOrContainerId)) + { + this.downloadRetries.Add(e.PackageOrContainerId, 0); + } + } + private void CacheAcquireComplete(object sender, CacheAcquireCompleteEventArgs e) { this.AddPackageTelemetry("Cache", e.PackageOrContainerId ?? String.Empty, DateTime.Now.Subtract(this.cachePackageStart).TotalMilliseconds, e.Status); + + if (e.Status < 0 && this.downloadRetries.TryGetValue(e.PackageOrContainerId, out var retries) && retries < 3) + { + this.downloadRetries[e.PackageOrContainerId] = retries + 1; + switch (e.Status) + { + case -2147023294: //HRESULT_FROM_WIN32(ERROR_INSTALL_USEREXIT) + case -2147024894: //HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND) + case -2147012889: //HRESULT_FROM_WIN32(ERROR_INTERNET_NAME_NOT_RESOLVED) + break; + default: + e.Action = BOOTSTRAPPER_CACHEACQUIRECOMPLETE_ACTION.Retry; + break; + } + } } private void ExecutePackageBegin(object sender, ExecutePackageBeginEventArgs e) @@ -584,16 +607,6 @@ namespace WixToolset.WixBA } } - private void ResolveSource(object sender, ResolveSourceEventArgs e) - { - int retries = 0; - - this.downloadRetries.TryGetValue(e.PackageOrContainerId, out retries); - this.downloadRetries[e.PackageOrContainerId] = retries + 1; - - e.Action = retries < 3 && !String.IsNullOrEmpty(e.DownloadSource) ? BOOTSTRAPPER_RESOLVESOURCE_ACTION.Download : BOOTSTRAPPER_RESOLVESOURCE_ACTION.None; - } - private void ApplyComplete(object sender, ApplyCompleteEventArgs e) { WixBA.Model.Result = e.Status; // remember the final result of the apply. diff --git a/src/WixToolset.WixBA/ProgressViewModel.cs b/src/WixToolset.WixBA/ProgressViewModel.cs index 17af5cfe..6f7bb028 100644 --- a/src/WixToolset.WixBA/ProgressViewModel.cs +++ b/src/WixToolset.WixBA/ProgressViewModel.cs @@ -40,6 +40,9 @@ namespace WixToolset.WixBA WixBA.Model.Bootstrapper.ApplyBegin += this.ApplyBegin; WixBA.Model.Bootstrapper.Progress += this.ApplyProgress; WixBA.Model.Bootstrapper.CacheAcquireProgress += this.CacheAcquireProgress; + WixBA.Model.Bootstrapper.CacheContainerOrPayloadVerifyProgress += CacheContainerOrPayloadVerifyProgress; + WixBA.Model.Bootstrapper.CachePayloadExtractProgress += CachePayloadExtractProgress; + WixBA.Model.Bootstrapper.CacheVerifyProgress += CacheVerifyProgress; WixBA.Model.Bootstrapper.CacheComplete += this.CacheComplete; } @@ -184,6 +187,36 @@ namespace WixToolset.WixBA } } + private void CacheContainerOrPayloadVerifyProgress(object sender, CacheContainerOrPayloadVerifyProgressEventArgs e) + { + lock (this) + { + this.cacheProgress = e.OverallPercentage; + this.Progress = (this.cacheProgress + this.executeProgress) / this.progressPhases; + e.Cancel = this.root.Canceled; + } + } + + private void CachePayloadExtractProgress(object sender, CachePayloadExtractProgressEventArgs e) + { + lock (this) + { + this.cacheProgress = e.OverallPercentage; + this.Progress = (this.cacheProgress + this.executeProgress) / this.progressPhases; + e.Cancel = this.root.Canceled; + } + } + + private void CacheVerifyProgress(object sender, CacheVerifyProgressEventArgs e) + { + lock (this) + { + this.cacheProgress = e.OverallPercentage; + this.Progress = (this.cacheProgress + this.executeProgress) / this.progressPhases; + e.Cancel = this.root.Canceled; + } + } + private void CacheComplete(object sender, CacheCompleteEventArgs e) { lock (this) diff --git a/src/WixToolset.WixBA/WixToolset.WixBA.csproj b/src/WixToolset.WixBA/WixToolset.WixBA.csproj index 5bc44b38..8f834cd8 100644 --- a/src/WixToolset.WixBA/WixToolset.WixBA.csproj +++ b/src/WixToolset.WixBA/WixToolset.WixBA.csproj @@ -41,6 +41,6 @@ - + \ No newline at end of file -- cgit v1.2.3-55-g6feb