1
0
Fork 0
mirror of https://github.com/Ryujinx/Ryujinx.git synced 2024-11-28 00:32:13 +00:00

Log Ryujinx Version, OS Name, CPU Name and RAM size (#1102)

* Log Ryujinx version and OS

* Log total RAM size and CPU name

* Requested changes

* requested change

* jd's requested changes

* jd's requested changes
This commit is contained in:
Xpl0itR 2020-04-25 14:01:32 +01:00 committed by GitHub
parent fe5bb439f1
commit a065dc1626
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 50 additions and 1 deletions

View file

@ -31,6 +31,7 @@
<NoWarn>NU1701</NoWarn>
</PackageReference>
<PackageReference Include="MsgPack.Cli" Version="1.0.1" />
<PackageReference Include="System.Management" Version="4.7.0" />
<PackageReference Include="Utf8Json" Version="1.3.7" />
</ItemGroup>

View file

@ -0,0 +1,41 @@
using System;
using System.IO;
using System.Linq;
using System.Management;
using System.Runtime.InteropServices;
namespace Ryujinx.Common
{
public static class SystemInfo
{
public static string OsDescription { get; private set; }
public static string CpuName { get; private set; }
public static string RamSize { get; private set; }
static SystemInfo()
{
OsDescription = $"{RuntimeInformation.OSDescription} ({RuntimeInformation.OSArchitecture})";
CpuName = "Unknown";
RamSize = "Unknown";
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
foreach (ManagementBaseObject mObject in new ManagementObjectSearcher("root\\CIMV2", "SELECT * FROM Win32_Processor").Get())
{
CpuName = mObject["Name"].ToString();
}
foreach (ManagementBaseObject mObject in new ManagementObjectSearcher("root\\CIMV2", "SELECT * FROM Win32_OperatingSystem").Get())
{
RamSize = $"{Math.Round(double.Parse(mObject["TotalVisibleMemorySize"].ToString()) / 1024, 0)} MB";
}
}
else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
{
CpuName = File.ReadAllLines("/proc/cpuinfo").Where(line => line.StartsWith("model name")).ToList()[0].Split(":")[1].Trim();
RamSize = $"{Math.Round(double.Parse(File.ReadAllLines("/proc/meminfo")[0].Split(":")[1].Trim().Split(" ")[0]) / 1024, 0)} MB";
}
}
}
}

View file

@ -1,4 +1,5 @@
using Gtk;
using Ryujinx.Common;
using Ryujinx.Common.Logging;
using Ryujinx.Configuration;
using Ryujinx.Debugger.Profiler;
@ -15,7 +16,7 @@ namespace Ryujinx
public static string Version { get; private set; }
public static string ConfigurationPath { get; set; }
static void Main(string[] args)
{
Toolkit.Init(new ToolkitOptions
@ -42,6 +43,12 @@ namespace Ryujinx
// Initialize Discord integration
DiscordIntegrationModule.Initialize();
Logger.PrintInfo(LogClass.Application, $"Ryujinx Version: {Version}");
Logger.PrintInfo(LogClass.Application, $"Operating System: {SystemInfo.OsDescription}");
Logger.PrintInfo(LogClass.Application, $"CPU: {SystemInfo.CpuName}");
Logger.PrintInfo(LogClass.Application, $"Total RAM: {SystemInfo.RamSize}");
string localConfigurationPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Config.json");
string globalBasePath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "Ryujinx");
string globalConfigurationPath = Path.Combine(globalBasePath, "Config.json");