This commit is contained in:
Paul Chote
2011-06-24 17:08:58 +12:00
parent 8122d63a74
commit 916e63710c
2 changed files with 9 additions and 15 deletions

View File

@@ -48,8 +48,6 @@ namespace OpenRA.FileFormats
destStream.Write(sourceStream.ReadAllBytes()); destStream.Write(sourceStream.ReadAllBytes());
} }
} }
onProgress("Extraction complete");
return true; return true;
} }
@@ -67,7 +65,6 @@ namespace OpenRA.FileFormats
onProgress("Extracting "+destFile); onProgress("Extracting "+destFile);
File.Copy(fromPath, Path.Combine(destPath, destFile), true); File.Copy(fromPath, Path.Combine(destPath, destFile), true);
} }
onProgress("Extraction complete");
return true; return true;
} }
@@ -84,7 +81,6 @@ namespace OpenRA.FileFormats
{ {
var z = new ZipInputStream(File.OpenRead(zipFile)); var z = new ZipInputStream(File.OpenRead(zipFile));
z.ExtractZip(dest, extracted, s => onProgress("Extracting "+s)); z.ExtractZip(dest, extracted, s => onProgress("Extracting "+s));
onProgress("Extraction complete");
} }
catch (SharpZipBaseException) catch (SharpZipBaseException)
{ {

View File

@@ -71,23 +71,21 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic
progressBar.SetIndeterminate(false); progressBar.SetIndeterminate(false);
var installCounter = 0; var installCounter = 0;
var onProgress = (Action<string>)(s => var installTotal = copyFiles.Count() + extractFiles.Count();
var onProgress = (Action<string>)(s => Game.RunAfterTick(() =>
{ {
progressBar.Percentage = installCounter*100/(copyFiles.Count() + extractFiles.Count()); progressBar.Percentage = installCounter*100/installTotal;
installCounter++; installCounter++;
statusLabel.GetText = () => s; statusLabel.GetText = () => s;
}); }));
var onError = (Action<string>)(s => var onError = (Action<string>)(s => Game.RunAfterTick(() =>
{ {
Game.RunAfterTick(() => statusLabel.GetText = () => "Error: "+s;
{ panel.GetWidget("RETRY_BUTTON").IsVisible = () => true;
statusLabel.GetText = () => "Error: "+s; panel.GetWidget("BACK_BUTTON").IsVisible = () => true;
panel.GetWidget("RETRY_BUTTON").IsVisible = () => true; }));
panel.GetWidget("BACK_BUTTON").IsVisible = () => true;
});
});
string source; string source;
try try