1: private string GetOSName()
2: {
3: System.OperatingSystem os = System.Environment.OSVersion;
4: string osName = "Unknown";
5:
6:
7: switch (os.Platform)
8: {
9: case System.PlatformID.Win32Windows:
10: switch (os.Version.Minor)
11: {
12: case 0:
13: osName = "Windows 95";
14: break;
15: case 10:
16: osName = "Windows 98";
17: break;
18: case 90:
19: osName = "Windows ME";
20: break;
21: }
22: break;
23: case System.PlatformID.Win32NT:
24: switch (os.Version.Major)
25: {
26: case 3:
27: osName = "Windws NT 3.51";
28: break;
29: case 4:
30: osName = "Windows NT 4";
31: break;
32: case 5:
33: if (os.Version.Minor == 0)
34: osName = "Windows 2000";
35: else if (os.Version.Minor == 1)
36: osName = "Windows XP";
37: else if (os.Version.Minor == 2)
38: osName = "Windows Server 2003";
39: break;
40: case 6:
41: osName = "Windows Vista";
42: if (os.Version.Minor == 0)
43: osName = "Windows Vista";
44: else if (os.Version.Minor == 1)
45: osName = "Windows 7";
46:
47: break;
48:
49: }
50: break;
51: }
52:
53: return osName + ", " + os.ServicePack.ToString() + ", " + os.Version.ToString();
54: }
Комментариев нет:
Отправить комментарий