aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.Common/SystemInfo/SystemInfo.cs
diff options
context:
space:
mode:
authorMary <57835969+h1k421@users.noreply.github.com>2020-05-04 04:15:27 +0200
committerGitHub <noreply@github.com>2020-05-04 12:15:27 +1000
commit651a07c6c2a3e89c059d56e916c45e1881d56abc (patch)
treec53cd1f08b93e363fa838ad5e5643ba47f7bd734 /Ryujinx.Common/SystemInfo/SystemInfo.cs
parent4c54f36c380683ef4575becf516953b7b0dfd6fc (diff)
Refactor SystemInfo and implement macOS system info backend (#1177)
Diffstat (limited to 'Ryujinx.Common/SystemInfo/SystemInfo.cs')
-rw-r--r--Ryujinx.Common/SystemInfo/SystemInfo.cs46
1 files changed, 46 insertions, 0 deletions
diff --git a/Ryujinx.Common/SystemInfo/SystemInfo.cs b/Ryujinx.Common/SystemInfo/SystemInfo.cs
new file mode 100644
index 00000000..9ab1419c
--- /dev/null
+++ b/Ryujinx.Common/SystemInfo/SystemInfo.cs
@@ -0,0 +1,46 @@
+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();
+ }
+ }
+ }
+} \ No newline at end of file