aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.Common/SystemInfo/SystemInfo.cs
blob: feb6b8f8a8565cade1f0b9789ae38b3f7624fd6c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
using System;
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 => (RamSize == 0) ? "Unknown" : $"{RamSize / 1024 / 1024} MB";

        public static SystemInfo Instance { get; }

        static SystemInfo()
        {
            if (OperatingSystem.IsWindows())
            {
                Instance = new WindowsSystemInfo();
            }
            else if (OperatingSystem.IsLinux())
            {
                Instance = new LinuxSystemInfo();
            }
            else if (OperatingSystem.IsMacOS())
            {
                Instance = new MacOSSystemInfo();
            }
            else
            {
                Instance = new SystemInfo();
            }
        }
    }
}