-
Notifications
You must be signed in to change notification settings - Fork 0
/
OS.cs
46 lines (40 loc) · 1.2 KB
/
OS.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
using System.Collections.Generic;
using System.Management;
namespace powerLabel
{
public class OS
{
public int id { get; set; }
public string caption { get; set; }
public string language { get; set; }
public static Dictionary<uint, string> languageTable = new Dictionary<uint, string>()
{
{9, "EN" },
{1031, "DE" },
{1033, "US" },
{1043, "NL" }
};
public static OS GetOS()
{
OS os = new OS();
foreach (ManagementObject item in PSInterface.RunObjectQuery("SELECT * FROM Win32_OperatingSystem"))
{
os.caption = (string)item["Caption"];
os.language = languageTable[(uint)item["OSLanguage"]];
}
return os;
}
public override bool Equals(object obj)
{
if (obj == null || GetType() != obj.GetType()) return false;
OS os = (OS)obj;
if (this.caption.Trim() == os.caption.Trim() &&
this.language.Trim() == os.language.Trim()
)
{
return true;
}
return false;
}
}
}