reads version info from installer and displays it in about menu

This commit is contained in:
Xpl0itR 2019-08-14 21:37:37 +01:00
parent e7ee37cafb
commit 4250ba84f0
No known key found for this signature in database
GPG key ID: 91798184109676AD
4 changed files with 29 additions and 7 deletions

View file

@ -1,4 +1,3 @@
using ARMeilleure;
using JsonPrettyPrinterPlus;
using LibHac.Fs;
using OpenTK.Input;

View file

@ -4,11 +4,23 @@ using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.InteropServices;
using Utf8Json;
using Utf8Json.Resolvers;
using System.IO;
namespace Ryujinx.UI
{
public struct Info
{
public string InstallVersion;
public string InstallCommit;
public string InstallBranch;
}
public class AboutWindow : Window
{
public static Info Information { get; private set; }
#pragma warning disable 649
[GUI] Window _aboutWin;
[GUI] Label _versionText;
@ -32,7 +44,18 @@ namespace Ryujinx.UI
_discordLogo.Pixbuf = new Gdk.Pixbuf(Assembly.GetExecutingAssembly(), "Ryujinx.Ui.assets.DiscordLogo.png", 30 , 30 );
_twitterLogo.Pixbuf = new Gdk.Pixbuf(Assembly.GetExecutingAssembly(), "Ryujinx.Ui.assets.TwitterLogo.png", 30 , 30 );
_versionText.Text = "Version x.x.x (Commit Number)";
try
{
var resolver = CompositeResolver.Create(new[] { StandardResolver.AllowPrivateSnakeCase });
using (Stream stream = File.OpenRead(System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "RyuFS", "Installer", "Config", "Config.json")))
{
Information = JsonSerializer.Deserialize<Info>(stream, resolver);
}
_versionText.Text = $"Version {Information.InstallVersion} - {Information.InstallBranch} ({Information.InstallCommit})";
}
catch { _versionText.Text = "Unknown Version"; }
}
public void OpenUrl(string url)

View file

@ -2,7 +2,6 @@
using LibHac.Fs;
using LibHac.Fs.NcaUtils;
using Ryujinx.Common.Logging;
using Ryujinx.HLE.FileSystem;
using System;
using System.Collections.Generic;
using System.IO;
@ -331,7 +330,7 @@ namespace Ryujinx.UI
try
{
string[] playedData = new string[2];
string savePath = Path.Combine(VirtualFileSystem.UserNandPath, "save", "0000000000000000", UserId, TitleId);
string savePath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "RyuFS", "nand", "user", "save", "0000000000000000", UserId, TitleId);
if (File.Exists(Path.Combine(savePath, "TimePlayed.dat")) == false)
{

View file

@ -281,7 +281,7 @@ namespace Ryujinx.UI
string userId = "00000000000000000000000000000001";
try
{
string savePath = System.IO.Path.Combine(VirtualFileSystem.UserNandPath, "save", "0000000000000000", userId, _device.System.TitleID);
string savePath = System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "RyuFS", "nand", "user", "save", "0000000000000000", userId, _device.System.TitleID);
if (File.Exists(System.IO.Path.Combine(savePath, "TimePlayed.dat")) == false)
{
@ -327,7 +327,7 @@ namespace Ryujinx.UI
{
try
{
string savePath = System.IO.Path.Combine(VirtualFileSystem.UserNandPath, "save", "0000000000000000", userId, _device.System.TitleID);
string savePath = System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "RyuFS", "nand", "user", "save", "0000000000000000", userId, _device.System.TitleID);
double currentPlayTime = 0;
using (FileStream fs = File.OpenRead(System.IO.Path.Combine(savePath, "LastPlayed.dat")))
@ -477,7 +477,8 @@ namespace Ryujinx.UI
private void Update_Pressed(object o, EventArgs args)
{
string ryuUpdater = System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "RyuFS", "RyuUpdater.exe");
Process.Start(new ProcessStartInfo(ryuUpdater, "/U") { UseShellExecute = true });
try { Process.Start(new ProcessStartInfo(ryuUpdater, "/U") { UseShellExecute = true }); }
catch(System.ComponentModel.Win32Exception) { CreateErrorDialog("Update canceled by user or updater was not found"); }
}
private void About_Pressed(object o, EventArgs args)