From 916e63710c34152a4845e3483133ed5e86493e9d Mon Sep 17 00:00:00 2001 From: Paul Chote Date: Fri, 24 Jun 2011 17:08:58 +1200 Subject: [PATCH] Fix #892 --- OpenRA.FileFormats/InstallUtils.cs | 4 ---- .../Widgets/Logic/CncInstallFromCDLogic.cs | 20 +++++++++---------- 2 files changed, 9 insertions(+), 15 deletions(-) diff --git a/OpenRA.FileFormats/InstallUtils.cs b/OpenRA.FileFormats/InstallUtils.cs index f699778ed8..41b6fe926c 100644 --- a/OpenRA.FileFormats/InstallUtils.cs +++ b/OpenRA.FileFormats/InstallUtils.cs @@ -48,8 +48,6 @@ namespace OpenRA.FileFormats destStream.Write(sourceStream.ReadAllBytes()); } } - - onProgress("Extraction complete"); return true; } @@ -67,7 +65,6 @@ namespace OpenRA.FileFormats onProgress("Extracting "+destFile); File.Copy(fromPath, Path.Combine(destPath, destFile), true); } - onProgress("Extraction complete"); return true; } @@ -84,7 +81,6 @@ namespace OpenRA.FileFormats { var z = new ZipInputStream(File.OpenRead(zipFile)); z.ExtractZip(dest, extracted, s => onProgress("Extracting "+s)); - onProgress("Extraction complete"); } catch (SharpZipBaseException) { diff --git a/OpenRA.Mods.Cnc/Widgets/Logic/CncInstallFromCDLogic.cs b/OpenRA.Mods.Cnc/Widgets/Logic/CncInstallFromCDLogic.cs index 82bf77c908..f58ad22efa 100644 --- a/OpenRA.Mods.Cnc/Widgets/Logic/CncInstallFromCDLogic.cs +++ b/OpenRA.Mods.Cnc/Widgets/Logic/CncInstallFromCDLogic.cs @@ -71,23 +71,21 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic progressBar.SetIndeterminate(false); var installCounter = 0; - var onProgress = (Action)(s => + var installTotal = copyFiles.Count() + extractFiles.Count(); + var onProgress = (Action)(s => Game.RunAfterTick(() => { - progressBar.Percentage = installCounter*100/(copyFiles.Count() + extractFiles.Count()); + progressBar.Percentage = installCounter*100/installTotal; installCounter++; statusLabel.GetText = () => s; - }); + })); - var onError = (Action)(s => + var onError = (Action)(s => Game.RunAfterTick(() => { - Game.RunAfterTick(() => - { - statusLabel.GetText = () => "Error: "+s; - panel.GetWidget("RETRY_BUTTON").IsVisible = () => true; - panel.GetWidget("BACK_BUTTON").IsVisible = () => true; - }); - }); + statusLabel.GetText = () => "Error: "+s; + panel.GetWidget("RETRY_BUTTON").IsVisible = () => true; + panel.GetWidget("BACK_BUTTON").IsVisible = () => true; + })); string source; try