-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSystemInfo.cs
88 lines (80 loc) · 3.13 KB
/
SystemInfo.cs
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
using Microsoft.VisualBasic.Devices;
using Microsoft.Win32;
using System.CodeDom.Compiler;
using System.IO;
using System.Management;
public class SystemInfo
{
public static string GetSystemInfo()
{
ManagementObjectSearcher video = new ManagementObjectSearcher("select * from Win32_VideoController");
StringWriter writer = new StringWriter();
writer.WriteLine("------------------------ System Info ------------------------");
ComputerInfo info = new ComputerInfo();
writer.WriteLine("Operating System: " + info.OSFullName);
writer.WriteLine("Operating System Platform: " + info.OSFullName);
writer.WriteLine("Operating System Version: " + info.OSVersion);
writer.WriteLine("Total Physical Memory: " + (info.TotalPhysicalMemory / 1048576).ToString() + " MB");
writer.WriteLine("Available Physical Memory: " + (info.AvailablePhysicalMemory / 1048576).ToString() + " MB");
writer.WriteLine("Total Virtual Memory: " + (info.TotalVirtualMemory / 1048576).ToString() + " MB");
writer.WriteLine("Available Virtual Memory: " + (info.AvailableVirtualMemory / 1048576).ToString() + " MB");
RegistryKey processorName = Registry.LocalMachine.OpenSubKey(@"Hardware\Description\System\CentralProcessor\0", RegistryKeyPermissionCheck.ReadSubTree);
if (processorName != null)
{
if (processorName.GetValue("ProcessorNameString") != null)
{
writer.WriteLine("Processor: " + processorName.GetValue("ProcessorNameString"));
}
}
foreach (ManagementObject obj in video.Get())
{
writer.WriteLine("GPU: " + obj["Name"]);
writer.WriteLine("GPU RAM: " + obj["AdapterRAM"]);
writer.WriteLine("GPU Driver Version: " + obj["DriverVersion"]);
writer.WriteLine("Video Processor: " + obj["VideoProcessor"]);
writer.WriteLine("Video Architecture: " + TranslateArchitecture((ushort)obj["VideoArchitecture"]));
writer.WriteLine("Video MemoryType: " + MemoryType[(ushort)obj["VideoMemoryType"] - 1]);
}
string output = writer.ToString();
writer.Close();
return output;
}
private static string TranslateArchitecture(ushort id)
{
if (id == 160)
return "PC-98";
else
return Architectures[id - 1];
}
private static string[] Architectures = new string[]
{
"Other",
"Unknown",
"CGA",
"EGA",
"VGA",
"SVGA",
"MDA",
"HGC",
"MCGA",
"8514A",
"XGA",
"Linear Frame Buffer"
};
private static string[] MemoryType = new string[]
{
"Other",
"Unknown",
"VRAM",
"DRAM",
"SRAM",
"WRAM",
"EDO RAM",
"Burst Synchronous DRAM",
"Pipelined Burst SRAM",
"CDRAM",
"3DRAM",
"SDRAM",
"SGRAM"
};
}