Added some comments

- Also changed some catch exceptions
This commit is contained in:
DrHacknik 2020-01-23 13:35:03 -05:00 committed by Ash
commit 8538f2f46f
2 changed files with 14 additions and 10 deletions

View file

@ -42,6 +42,7 @@ namespace Ryujinx.Updater.Parser
else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
_PlatformExt = "linux_x64.tar.gz";
//Begin the Appveyor parsing
WebClient JSONClient = new WebClient();
string FetchedJSON = JSONClient.DownloadString(_BuildURL);
var __JSONRoot = JObject.Parse(FetchedJSON);
@ -74,19 +75,20 @@ namespace Ryujinx.Updater.Parser
GtkDialog.CreateErrorDialog("Update canceled by user or failed to grab or parse the information.\nPlease try at a later time, or report the error to our GitHub.");
return;
}
UpdateData data = new UpdateData()
{
JobID = _JobID,
BuildVer = _BuildVer,
BuildURL = _BuildURL,
BuildArt = _BuildArt,
BuildCommit = _BuildCommit,
Branch = _Branch
};
//UpdateData data = new UpdateData()
//{
// JobID = _JobID,
// BuildVer = _BuildVer,
// BuildURL = _BuildURL,
// BuildArt = _BuildArt,
// BuildCommit = _BuildCommit,
// Branch = _Branch
//};
}
private static async void GrabPackage()
{
//Check if paths exist
if (!Directory.Exists(Path.Combine(_RyuDir, "Data", "Update")) || !Directory.Exists(Path.Combine(_RyuDir, "Data")) || !Directory.Exists(Path.Combine(Environment.CurrentDirectory, "temp")))
{
Directory.CreateDirectory(Path.Combine(_RyuDir, "Data", "Update"));
@ -96,6 +98,7 @@ namespace Ryujinx.Updater.Parser
try
{
//Attempt to grab the latest package
_Package.DownloadProgressChanged += new DownloadProgressChangedEventHandler(PackageDownloadProgress);
_Package.DownloadFileCompleted += new AsyncCompletedEventHandler(PackageDownloadedAsync);
using (MessageDialog dialog = GtkDialog.CreateProgressDialog("Update", "Ryujinx - Update", "Downloading update " + _BuildVer, "Please wait while we download the latest package and extract it."))
@ -134,6 +137,7 @@ namespace Ryujinx.Updater.Parser
{
try
{
//Begin the extaction process
using (Ionic.Zip.ZipFile Package = Ionic.Zip.ZipFile.Read(Path.Combine(_RyuDir, "Data", "Update", "RyujinxPackage.zip")))
{
await Task.Run(() => Package.ExtractAll(Path.Combine(Environment.CurrentDirectory,"temp"), ExtractExistingFileAction.OverwriteSilently));

View file

@ -18,6 +18,7 @@ namespace Ryujinx.Updater
{
try
{
//Get list of files from the current directory, and copy them to the parent directory.
foreach (string _PathDir in Directory.GetDirectories(RyuDir, "*",
SearchOption.AllDirectories))
Directory.CreateDirectory(_PathDir.Replace(RyuDir, ParentDir));
@ -40,7 +41,6 @@ namespace Ryujinx.Updater
}
catch (System.ComponentModel.Win32Exception)
{
//Logger.PrintError(LogClass.Application, "Package installation has failed\n" + ex.InnerException.ToString());
GtkDialog.CreateErrorDialog("Package installation has failed\nCheck the log for more information.");
return;
}