Updates now install properly
* Will need to continue testing and refining
This commit is contained in:
parent
ce5f4b2a91
commit
d469f294f0
4 changed files with 54 additions and 26 deletions
|
@ -73,7 +73,11 @@ namespace Ryujinx
|
||||||
case "/U":
|
case "/U":
|
||||||
//Do that update stuffs
|
//Do that update stuffs
|
||||||
Updater.Update.PerformUpdate();
|
Updater.Update.PerformUpdate();
|
||||||
return;
|
break;
|
||||||
|
case "/C":
|
||||||
|
//Do that update stuffs
|
||||||
|
Updater.Update.Cleanup();
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
mainWindow.LoadApplication(args[0]);
|
mainWindow.LoadApplication(args[0]);
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -61,7 +61,7 @@ namespace Ryujinx.Ui
|
||||||
return messageDialog;
|
return messageDialog;
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static async System.Threading.Tasks.Task<MessageDialog> CreateProgressDialogAsync(bool isInstall, string iconType, string titleMessage, string textMessage, string secText)
|
internal static MessageDialog CreateProgressDialog(string iconType, string titleMessage, string textMessage, string secText)
|
||||||
{
|
{
|
||||||
MessageDialog messageDialog = new MessageDialog(null, DialogFlags.Modal, MessageType.Info, ButtonsType.None, null)
|
MessageDialog messageDialog = new MessageDialog(null, DialogFlags.Modal, MessageType.Info, ButtonsType.None, null)
|
||||||
{
|
{
|
||||||
|
@ -71,16 +71,9 @@ namespace Ryujinx.Ui
|
||||||
SecondaryText = secText,
|
SecondaryText = secText,
|
||||||
WindowPosition = WindowPosition.Center
|
WindowPosition = WindowPosition.Center
|
||||||
};
|
};
|
||||||
|
Uri URL = new Uri(UpdateParser._BuildArt);
|
||||||
|
UpdateParser._Package.DownloadFileAsync(URL, Path.Combine(UpdateParser._RyuDir, "Data", "Update", "RyujinxPackage.zip"));
|
||||||
messageDialog.SetSizeRequest(100, 20);
|
messageDialog.SetSizeRequest(100, 20);
|
||||||
if (isInstall == true)
|
|
||||||
{
|
|
||||||
await UpdateParser.ExtractPackageAsync();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Uri URL = new Uri(UpdateParser._BuildArt);
|
|
||||||
UpdateParser._Package.DownloadFileAsync(URL, Path.Combine(UpdateParser._RyuDir, "Data", "Update", "RyujinxPackage.zip"));
|
|
||||||
}
|
|
||||||
return messageDialog;
|
return messageDialog;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -98,11 +98,10 @@ namespace Ryujinx.Updater.Parser
|
||||||
{
|
{
|
||||||
_Package.DownloadProgressChanged += new DownloadProgressChangedEventHandler(PackageDownloadProgress);
|
_Package.DownloadProgressChanged += new DownloadProgressChangedEventHandler(PackageDownloadProgress);
|
||||||
_Package.DownloadFileCompleted += new AsyncCompletedEventHandler(PackageDownloadedAsync);
|
_Package.DownloadFileCompleted += new AsyncCompletedEventHandler(PackageDownloadedAsync);
|
||||||
using (MessageDialog dialog = await GtkDialog.CreateProgressDialogAsync(false, "Update", "Ryujinx - Update", "Downloading update " + _BuildVer, "Please wait while we download the latest package"))
|
using (MessageDialog dialog = GtkDialog.CreateProgressDialog("Update", "Ryujinx - Update", "Downloading update " + _BuildVer, "Please wait while we download the latest package and extract it."))
|
||||||
{
|
{
|
||||||
dialog.Run();
|
dialog.Run();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
@ -121,11 +120,8 @@ namespace Ryujinx.Updater.Parser
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Logger.PrintWarning(LogClass.Application, "Package is now installing");
|
Logger.PrintWarning(LogClass.Application, "Package is now installing");
|
||||||
using (MessageDialog dialog = await GtkDialog.CreateProgressDialogAsync(true, "Update", "Ryujinx - Update", "Installing update " + _BuildVer + "...", "Please wait while we install the latest package"))
|
await ExtractPackageAsync();
|
||||||
{
|
return;
|
||||||
dialog.Dispose();
|
|
||||||
dialog.Run();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -145,11 +141,12 @@ namespace Ryujinx.Updater.Parser
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Process.Start(new ProcessStartInfo(Path.Combine(Environment.CurrentDirectory, "temp", "Ryujinx.exe"), "/U") { UseShellExecute = true });
|
Process.Start(new ProcessStartInfo(Path.Combine(Environment.CurrentDirectory, "temp", "publish", "Ryujinx.exe"), "/U") { UseShellExecute = true });
|
||||||
}
|
}
|
||||||
catch (System.ComponentModel.Win32Exception)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
GtkDialog.CreateErrorDialog("Update canceled by user or the installation was not found");
|
GtkDialog.CreateErrorDialog("Package installation has failed\nCheck the log for more information.");
|
||||||
|
Logger.PrintError(LogClass.Application, "Package installation has failed\n" + ex.InnerException.ToString());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Application.Quit();
|
Application.Quit();
|
||||||
|
|
|
@ -1,5 +1,9 @@
|
||||||
using System;
|
using Gtk;
|
||||||
|
using Ryujinx.Common.Logging;
|
||||||
|
using Ryujinx.Ui;
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Diagnostics;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
|
||||||
|
@ -7,15 +11,45 @@ namespace Ryujinx.Updater
|
||||||
{
|
{
|
||||||
public class Update
|
public class Update
|
||||||
{
|
{
|
||||||
public static string _RyuDir = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "Ryujinx");
|
public static string RyuDir = Environment.CurrentDirectory;
|
||||||
|
private static string[] UpdateFiles = Directory.GetFiles(Path.Combine(Environment.CurrentDirectory),"*", SearchOption.AllDirectories);
|
||||||
|
private static string ParentDir = Path.Combine(@"..\..");
|
||||||
public static void PerformUpdate()
|
public static void PerformUpdate()
|
||||||
{
|
{
|
||||||
|
try
|
||||||
return;
|
{
|
||||||
|
foreach (string _PathDir in Directory.GetDirectories(RyuDir, "*",
|
||||||
|
SearchOption.AllDirectories))
|
||||||
|
Directory.CreateDirectory(_PathDir.Replace(RyuDir, ParentDir));
|
||||||
|
foreach (string _PathNew in Directory.GetFiles(RyuDir, "*.*",
|
||||||
|
SearchOption.AllDirectories))
|
||||||
|
File.Copy(_PathNew, _PathNew.Replace(RyuDir, ParentDir), true);
|
||||||
|
Logger.PrintInfo(LogClass.Application, "Package installation was completed.\n");
|
||||||
|
GtkDialog.CreateInfoDialog("Update", "Ryujinx - Update", "Almost finished","The package was installed.\nPlease click ok, and the update will complete.");
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Process.Start(new ProcessStartInfo(Path.Combine(ParentDir, "Ryujinx.exe"), "/C") { UseShellExecute = true });
|
||||||
|
}
|
||||||
|
catch (System.ComponentModel.Win32Exception)
|
||||||
|
{
|
||||||
|
GtkDialog.CreateErrorDialog("Update canceled by user or the installation was not found");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Application.Quit();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Cleanup()
|
public static void Cleanup()
|
||||||
{
|
{
|
||||||
|
Directory.Delete(Path.Combine(RyuDir, "temp"), true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue