reads version info from installer and displays it in about menu
This commit is contained in:
parent
e7ee37cafb
commit
4250ba84f0
4 changed files with 29 additions and 7 deletions
|
@ -1,4 +1,3 @@
|
||||||
using ARMeilleure;
|
|
||||||
using JsonPrettyPrinterPlus;
|
using JsonPrettyPrinterPlus;
|
||||||
using LibHac.Fs;
|
using LibHac.Fs;
|
||||||
using OpenTK.Input;
|
using OpenTK.Input;
|
||||||
|
|
|
@ -4,11 +4,23 @@ using System;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
using Utf8Json;
|
||||||
|
using Utf8Json.Resolvers;
|
||||||
|
using System.IO;
|
||||||
|
|
||||||
namespace Ryujinx.UI
|
namespace Ryujinx.UI
|
||||||
{
|
{
|
||||||
|
public struct Info
|
||||||
|
{
|
||||||
|
public string InstallVersion;
|
||||||
|
public string InstallCommit;
|
||||||
|
public string InstallBranch;
|
||||||
|
}
|
||||||
|
|
||||||
public class AboutWindow : Window
|
public class AboutWindow : Window
|
||||||
{
|
{
|
||||||
|
public static Info Information { get; private set; }
|
||||||
|
|
||||||
#pragma warning disable 649
|
#pragma warning disable 649
|
||||||
[GUI] Window _aboutWin;
|
[GUI] Window _aboutWin;
|
||||||
[GUI] Label _versionText;
|
[GUI] Label _versionText;
|
||||||
|
@ -32,7 +44,18 @@ namespace Ryujinx.UI
|
||||||
_discordLogo.Pixbuf = new Gdk.Pixbuf(Assembly.GetExecutingAssembly(), "Ryujinx.Ui.assets.DiscordLogo.png", 30 , 30 );
|
_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 );
|
_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)
|
public void OpenUrl(string url)
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
using LibHac.Fs;
|
using LibHac.Fs;
|
||||||
using LibHac.Fs.NcaUtils;
|
using LibHac.Fs.NcaUtils;
|
||||||
using Ryujinx.Common.Logging;
|
using Ryujinx.Common.Logging;
|
||||||
using Ryujinx.HLE.FileSystem;
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
@ -331,7 +330,7 @@ namespace Ryujinx.UI
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
string[] playedData = new string[2];
|
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)
|
if (File.Exists(Path.Combine(savePath, "TimePlayed.dat")) == false)
|
||||||
{
|
{
|
||||||
|
|
|
@ -281,7 +281,7 @@ namespace Ryujinx.UI
|
||||||
string userId = "00000000000000000000000000000001";
|
string userId = "00000000000000000000000000000001";
|
||||||
try
|
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)
|
if (File.Exists(System.IO.Path.Combine(savePath, "TimePlayed.dat")) == false)
|
||||||
{
|
{
|
||||||
|
@ -327,7 +327,7 @@ namespace Ryujinx.UI
|
||||||
{
|
{
|
||||||
try
|
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;
|
double currentPlayTime = 0;
|
||||||
|
|
||||||
using (FileStream fs = File.OpenRead(System.IO.Path.Combine(savePath, "LastPlayed.dat")))
|
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)
|
private void Update_Pressed(object o, EventArgs args)
|
||||||
{
|
{
|
||||||
string ryuUpdater = System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "RyuFS", "RyuUpdater.exe");
|
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)
|
private void About_Pressed(object o, EventArgs args)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue