Rewrite the download status over the same console line. May break the windows launcher (which doesn't run under osx, so can't test).

This commit is contained in:
Paul Chote
2010-11-14 14:10:35 +13:00
parent 047d012fff
commit 8cd6d60839

View File

@@ -94,6 +94,7 @@ namespace OpenRA.Utility
wc.DownloadProgressChanged += DownloadProgressChanged; wc.DownloadProgressChanged += DownloadProgressChanged;
wc.DownloadFileCompleted += DownloadFileCompleted; wc.DownloadFileCompleted += DownloadFileCompleted;
Console.WriteLine("Downloading {0}-packages.zip to {1}", mod, destPath); Console.WriteLine("Downloading {0}-packages.zip to {1}", mod, destPath);
Console.WriteLine("Initializing...");
wc.DownloadFileAsync( wc.DownloadFileAsync(
new Uri(string.Format("http://open-ra.org/get-dependency.php?file={0}-packages", mod)), new Uri(string.Format("http://open-ra.org/get-dependency.php?file={0}-packages", mod)),
destFile, destFile,
@@ -118,6 +119,7 @@ namespace OpenRA.Utility
static void DownloadProgressChanged(object sender, DownloadProgressChangedEventArgs e) static void DownloadProgressChanged(object sender, DownloadProgressChangedEventArgs e)
{ {
Console.SetCursorPosition(0, Console.CursorTop-1);
Console.WriteLine("{0}% {1}/{2} bytes", e.ProgressPercentage, e.BytesReceived, e.TotalBytesToReceive); Console.WriteLine("{0}% {1}/{2} bytes", e.ProgressPercentage, e.BytesReceived, e.TotalBytesToReceive);
} }