2019-09-02 16:03:57 +00:00
|
|
|
|
using Gtk;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Diagnostics;
|
2019-11-29 04:32:51 +00:00
|
|
|
|
using System.IO;
|
2019-09-02 16:03:57 +00:00
|
|
|
|
using System.Reflection;
|
|
|
|
|
using System.Runtime.InteropServices;
|
|
|
|
|
using Utf8Json;
|
|
|
|
|
using Utf8Json.Resolvers;
|
|
|
|
|
|
2019-11-29 04:32:51 +00:00
|
|
|
|
using GUI = Gtk.Builder.ObjectAttribute;
|
2019-09-02 16:03:57 +00:00
|
|
|
|
|
2019-11-29 04:32:51 +00:00
|
|
|
|
namespace Ryujinx.Ui
|
|
|
|
|
{
|
2019-09-02 16:03:57 +00:00
|
|
|
|
public class AboutWindow : Window
|
|
|
|
|
{
|
2019-11-29 04:32:51 +00:00
|
|
|
|
private static AboutInfo AboutInformation { get; set; }
|
2019-09-02 16:03:57 +00:00
|
|
|
|
|
2019-11-29 04:32:51 +00:00
|
|
|
|
#pragma warning disable CS0649
|
|
|
|
|
#pragma warning disable IDE0044
|
2019-09-02 16:03:57 +00:00
|
|
|
|
[GUI] Window _aboutWin;
|
|
|
|
|
[GUI] Label _versionText;
|
|
|
|
|
[GUI] Image _ryujinxLogo;
|
|
|
|
|
[GUI] Image _patreonLogo;
|
|
|
|
|
[GUI] Image _gitHubLogo;
|
|
|
|
|
[GUI] Image _discordLogo;
|
|
|
|
|
[GUI] Image _twitterLogo;
|
2019-11-29 04:32:51 +00:00
|
|
|
|
#pragma warning restore CS0649
|
|
|
|
|
#pragma warning restore IDE0044
|
2019-09-02 16:03:57 +00:00
|
|
|
|
|
|
|
|
|
public AboutWindow() : this(new Builder("Ryujinx.Ui.AboutWindow.glade")) { }
|
|
|
|
|
|
|
|
|
|
private AboutWindow(Builder builder) : base(builder.GetObject("_aboutWin").Handle)
|
|
|
|
|
{
|
|
|
|
|
builder.Autoconnect(this);
|
|
|
|
|
|
2019-11-29 04:32:51 +00:00
|
|
|
|
_aboutWin.Icon = new Gdk.Pixbuf(Assembly.GetExecutingAssembly(), "Ryujinx.Ui.assets.Icon.png");
|
|
|
|
|
_ryujinxLogo.Pixbuf = new Gdk.Pixbuf(Assembly.GetExecutingAssembly(), "Ryujinx.Ui.assets.Icon.png" , 100, 100);
|
2019-09-02 16:03:57 +00:00
|
|
|
|
_patreonLogo.Pixbuf = new Gdk.Pixbuf(Assembly.GetExecutingAssembly(), "Ryujinx.Ui.assets.PatreonLogo.png", 30 , 30 );
|
|
|
|
|
_gitHubLogo.Pixbuf = new Gdk.Pixbuf(Assembly.GetExecutingAssembly(), "Ryujinx.Ui.assets.GitHubLogo.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 );
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
IJsonFormatterResolver 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")))
|
|
|
|
|
{
|
2019-11-29 04:32:51 +00:00
|
|
|
|
AboutInformation = JsonSerializer.Deserialize<AboutInfo>(stream, resolver);
|
2019-09-02 16:03:57 +00:00
|
|
|
|
}
|
|
|
|
|
|
2019-11-29 04:32:51 +00:00
|
|
|
|
_versionText.Text = $"Version {AboutInformation.InstallVersion} - {AboutInformation.InstallBranch} ({AboutInformation.InstallCommit})";
|
2019-09-02 16:03:57 +00:00
|
|
|
|
}
|
|
|
|
|
catch
|
|
|
|
|
{
|
|
|
|
|
_versionText.Text = "Unknown Version";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2019-11-29 04:32:51 +00:00
|
|
|
|
private static void OpenUrl(string url)
|
2019-09-02 16:03:57 +00:00
|
|
|
|
{
|
|
|
|
|
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
|
|
|
|
|
{
|
|
|
|
|
Process.Start(new ProcessStartInfo("cmd", $"/c start {url}"));
|
|
|
|
|
}
|
|
|
|
|
else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
|
|
|
|
|
{
|
|
|
|
|
Process.Start("xdg-open", url);
|
|
|
|
|
}
|
|
|
|
|
else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
|
|
|
|
|
{
|
|
|
|
|
Process.Start("open", url);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//Events
|
2019-11-29 04:32:51 +00:00
|
|
|
|
private void RyujinxButton_Pressed(object sender, ButtonPressEventArgs args)
|
2019-09-02 16:03:57 +00:00
|
|
|
|
{
|
|
|
|
|
OpenUrl("https://ryujinx.org");
|
|
|
|
|
}
|
|
|
|
|
|
2019-11-29 04:32:51 +00:00
|
|
|
|
private void PatreonButton_Pressed(object sender, ButtonPressEventArgs args)
|
2019-09-02 16:03:57 +00:00
|
|
|
|
{
|
|
|
|
|
OpenUrl("https://www.patreon.com/ryujinx");
|
|
|
|
|
}
|
|
|
|
|
|
2019-11-29 04:32:51 +00:00
|
|
|
|
private void GitHubButton_Pressed(object sender, ButtonPressEventArgs args)
|
2019-09-02 16:03:57 +00:00
|
|
|
|
{
|
|
|
|
|
OpenUrl("https://github.com/Ryujinx/Ryujinx");
|
|
|
|
|
}
|
|
|
|
|
|
2019-11-29 04:32:51 +00:00
|
|
|
|
private void DiscordButton_Pressed(object sender, ButtonPressEventArgs args)
|
2019-09-02 16:03:57 +00:00
|
|
|
|
{
|
|
|
|
|
OpenUrl("https://discordapp.com/invite/N2FmfVc");
|
|
|
|
|
}
|
|
|
|
|
|
2019-11-29 04:32:51 +00:00
|
|
|
|
private void TwitterButton_Pressed(object sender, ButtonPressEventArgs args)
|
2019-09-02 16:03:57 +00:00
|
|
|
|
{
|
|
|
|
|
OpenUrl("https://twitter.com/RyujinxEmu");
|
|
|
|
|
}
|
|
|
|
|
|
2019-11-29 04:32:51 +00:00
|
|
|
|
private void ContributorsButton_Pressed(object sender, ButtonPressEventArgs args)
|
2019-09-02 16:03:57 +00:00
|
|
|
|
{
|
|
|
|
|
OpenUrl("https://github.com/Ryujinx/Ryujinx/graphs/contributors?type=a");
|
|
|
|
|
}
|
|
|
|
|
|
2019-11-29 04:32:51 +00:00
|
|
|
|
private void CloseToggle_Activated(object sender, EventArgs args)
|
2019-09-02 16:03:57 +00:00
|
|
|
|
{
|
2019-11-29 04:32:51 +00:00
|
|
|
|
Dispose();
|
2019-09-02 16:03:57 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|