mirror of
https://github.com/GreemDev/Ryujinx
synced 2024-12-26 22:06:45 +01:00
46 lines
1.2 KiB
C#
46 lines
1.2 KiB
C#
|
using System.Runtime.InteropServices;
|
|||
|
|
|||
|
namespace Ryujinx.Common.SystemInfo
|
|||
|
{
|
|||
|
public class SystemInfo
|
|||
|
{
|
|||
|
public virtual string OsDescription => $"{RuntimeInformation.OSDescription} ({RuntimeInformation.OSArchitecture})";
|
|||
|
public virtual string CpuName => "Unknown";
|
|||
|
public virtual ulong RamSize => 0;
|
|||
|
|
|||
|
public string RamSizeInMB
|
|||
|
{
|
|||
|
get
|
|||
|
{
|
|||
|
if (RamSize == 0)
|
|||
|
{
|
|||
|
return "Unknown";
|
|||
|
}
|
|||
|
|
|||
|
return $"{RamSize / 1024 / 1024} MB";
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
public static SystemInfo Instance { get; }
|
|||
|
|
|||
|
static SystemInfo()
|
|||
|
{
|
|||
|
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
|
|||
|
{
|
|||
|
Instance = new WindowsSysteminfo();
|
|||
|
}
|
|||
|
else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
|
|||
|
{
|
|||
|
Instance = new LinuxSysteminfo();
|
|||
|
}
|
|||
|
else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
|
|||
|
{
|
|||
|
Instance = new MacOSSysteminfo();
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
Instance = new SystemInfo();
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
}
|