Now showing download percentage!

This commit is contained in:
MelonSpeedruns 2020-02-02 15:23:50 -05:00 committed by Ash
commit 62cec5edf6
2 changed files with 15 additions and 7 deletions

View file

@ -13,6 +13,8 @@ namespace Ryujinx.Updater
public static string updateSaveLocation;
public static int lastPercentage;
private static void MoveAllFilesOver(string root, string dest)
{
foreach (var directory in Directory.GetDirectories(root))
@ -79,14 +81,23 @@ namespace Ryujinx.Updater
Console.WriteLine($"Downloading latest Ryujinx package...");
using (WebClient client = new WebClient())
WebClient client = new WebClient();
client.DownloadProgressChanged += (s, e) =>
{
client.DownloadFile(downloadUrl, updateSaveLocation);
if (e.ProgressPercentage != lastPercentage)
{
Console.WriteLine("Package downloading... " + e.ProgressPercentage + "%");
}
lastPercentage = e.ProgressPercentage;
};
client.DownloadFileTaskAsync(new Uri(downloadUrl), updateSaveLocation).Wait();
// Extract Update .zip
Console.WriteLine($"Extracting Ryujinx...");
Console.WriteLine($"Extracting Ryujinx package...");
ZipFile.ExtractToDirectory(updateSaveLocation, localAppPath, true);
@ -107,6 +118,5 @@ namespace Ryujinx.Updater
startInfo.UseShellExecute = true;
Process.Start(startInfo);
}
}
}

View file

@ -4,8 +4,6 @@ using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.InteropServices;
using Utf8Json;
using Utf8Json.Resolvers;
using GUI = Gtk.Builder.ObjectAttribute;