Working
This commit is contained in:
parent
41d4dbe30f
commit
ce5f4b2a91
4 changed files with 62 additions and 12 deletions
|
@ -64,9 +64,22 @@ namespace Ryujinx
|
||||||
MainWindow mainWindow = new MainWindow();
|
MainWindow mainWindow = new MainWindow();
|
||||||
mainWindow.Show();
|
mainWindow.Show();
|
||||||
|
|
||||||
if (args.Length == 1)
|
if (args.Length > 0)
|
||||||
{
|
{
|
||||||
|
foreach (string arg in args)
|
||||||
|
{
|
||||||
|
switch (arg.Substring(0, 2).ToUpper())
|
||||||
|
{
|
||||||
|
case "/U":
|
||||||
|
//Do that update stuffs
|
||||||
|
Updater.Update.PerformUpdate();
|
||||||
|
return;
|
||||||
|
default:
|
||||||
mainWindow.LoadApplication(args[0]);
|
mainWindow.LoadApplication(args[0]);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Application.Run();
|
Application.Run();
|
||||||
|
|
|
@ -76,6 +76,7 @@
|
||||||
<PackageReference Include="DiscordRichPresence" Version="1.0.147" />
|
<PackageReference Include="DiscordRichPresence" Version="1.0.147" />
|
||||||
<PackageReference Include="GLWidget" Version="1.0.0" />
|
<PackageReference Include="GLWidget" Version="1.0.0" />
|
||||||
<PackageReference Include="GtkSharp" Version="3.22.25.56" />
|
<PackageReference Include="GtkSharp" Version="3.22.25.56" />
|
||||||
|
<PackageReference Include="DotNetZip" Version="1.13.5" />
|
||||||
<PackageReference Include="GtkSharp.Dependencies" Version="1.1.0" Condition="'$(RuntimeIdentifier)' != 'linux-x64' AND '$(RuntimeIdentifier)' != 'osx-x64'" />
|
<PackageReference Include="GtkSharp.Dependencies" Version="1.1.0" Condition="'$(RuntimeIdentifier)' != 'linux-x64' AND '$(RuntimeIdentifier)' != 'osx-x64'" />
|
||||||
<PackageReference Include="OpenTK.NetStandard" Version="1.0.5.12" />
|
<PackageReference Include="OpenTK.NetStandard" Version="1.0.5.12" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
|
@ -1,10 +1,13 @@
|
||||||
using Gtk;
|
using Gtk;
|
||||||
|
using Ionic.Zip;
|
||||||
using Newtonsoft.Json.Linq;
|
using Newtonsoft.Json.Linq;
|
||||||
using Ryujinx.Common.Logging;
|
using Ryujinx.Common.Logging;
|
||||||
|
using Ryujinx.HLE.FileSystem;
|
||||||
using Ryujinx.Ui;
|
using Ryujinx.Ui;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
|
using System.Diagnostics;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.IO.Compression;
|
using System.IO.Compression;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
|
@ -25,7 +28,6 @@ namespace Ryujinx.Updater.Parser
|
||||||
private static string _PlatformExt;
|
private static string _PlatformExt;
|
||||||
public static string _RyuDir = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "Ryujinx");
|
public static string _RyuDir = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "Ryujinx");
|
||||||
public static WebClient _Package = new WebClient();
|
public static WebClient _Package = new WebClient();
|
||||||
private static string _URLStr;
|
|
||||||
public static int _PackageProgress;
|
public static int _PackageProgress;
|
||||||
public static double _Percentage;
|
public static double _Percentage;
|
||||||
public static void BeginParse()
|
public static void BeginParse()
|
||||||
|
@ -85,20 +87,22 @@ namespace Ryujinx.Updater.Parser
|
||||||
|
|
||||||
private static async void GrabPackage()
|
private static async void GrabPackage()
|
||||||
{
|
{
|
||||||
if (!Directory.Exists(Path.Combine(_RyuDir, "Data", "Update")) || !Directory.Exists(Path.Combine(_RyuDir, "Data")))
|
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"));
|
Directory.CreateDirectory(Path.Combine(_RyuDir, "Data", "Update"));
|
||||||
Directory.CreateDirectory(Path.Combine(_RyuDir, "Data"));
|
Directory.CreateDirectory(Path.Combine(_RyuDir, "Data"));
|
||||||
|
Directory.CreateDirectory(Path.Combine(Environment.CurrentDirectory, "temp"));
|
||||||
}
|
}
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
_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 + ", 0% complete...", "Please wait while we download the latest package"))
|
using (MessageDialog dialog = await GtkDialog.CreateProgressDialogAsync(false, "Update", "Ryujinx - Update", "Downloading update " + _BuildVer, "Please wait while we download the latest package"))
|
||||||
{
|
{
|
||||||
dialog.Run();
|
dialog.Run();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
@ -119,9 +123,9 @@ namespace Ryujinx.Updater.Parser
|
||||||
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"))
|
using (MessageDialog dialog = await GtkDialog.CreateProgressDialogAsync(true, "Update", "Ryujinx - Update", "Installing update " + _BuildVer + "...", "Please wait while we install the latest package"))
|
||||||
{
|
{
|
||||||
|
dialog.Dispose();
|
||||||
dialog.Run();
|
dialog.Run();
|
||||||
}
|
}
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -134,11 +138,21 @@ namespace Ryujinx.Updater.Parser
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
//using (ZipFile Package = ZipFile.Read(Path.Combine(_RyuDir, "Data", "Update", "RyujinxPackage.zip")))
|
using (Ionic.Zip.ZipFile Package = Ionic.Zip.ZipFile.Read(Path.Combine(_RyuDir, "Data", "Update", "RyujinxPackage.zip")))
|
||||||
//{
|
{
|
||||||
// await Task.Run(() => Package.ExtractAll(_InstallDir, ExtractExistingFileAction.OverwriteSilently));
|
await Task.Run(() => Package.ExtractAll(Path.Combine(Environment.CurrentDirectory,"temp"), ExtractExistingFileAction.OverwriteSilently));
|
||||||
//}
|
}
|
||||||
throw new Exception("This is a test exception.\nThis is the package extract thread.");
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Process.Start(new ProcessStartInfo(Path.Combine(Environment.CurrentDirectory, "temp", "Ryujinx.exe"), "/U") { UseShellExecute = true });
|
||||||
|
}
|
||||||
|
catch (System.ComponentModel.Win32Exception)
|
||||||
|
{
|
||||||
|
GtkDialog.CreateErrorDialog("Update canceled by user or the installation was not found");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Application.Quit();
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
|
22
Ryujinx/Updater/Update.cs
Normal file
22
Ryujinx/Updater/Update.cs
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace Ryujinx.Updater
|
||||||
|
{
|
||||||
|
public class Update
|
||||||
|
{
|
||||||
|
public static string _RyuDir = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "Ryujinx");
|
||||||
|
public static void PerformUpdate()
|
||||||
|
{
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Cleanup()
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue