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
|
public string GetVersionString()
{
OperatingSystem osInfo = System.Environment.OSVersion;
string strVers = string.Empty;
if (osInfo.Platform == PlatformID.Win32Windows)
{
// Windows 98 / 98SE oder Windows Me. Windows 95 unterstützt .NET nicht
if (osInfo.Version.Minor == 10) strVers = "Windows 98";
if (osInfo.Version.Minor == 90) strVers = "Windows Me";
}
if (osInfo.Platform == PlatformID.Win32NT)
{
// Windows NT 4.0, 2000, XP oder Server 2003. Windows NT 3.51 unterstützt .NET nicht
if (osInfo.Version.Major == 4) strVers = "Windows NT 4.0";
if (osInfo.Version.Major == 5)
{
switch (osInfo.Version.Minor)
{
case 0: strVers = "Windows 2000"; break;
case 1: strVers = "Windows XP"; break;
case 2: strVers = "Windows Server 2003"; break;
}
}
if (osInfo.Version.Major == 6)
{
if (osInfo.Version.Minor == 0)
{
strVers = "Vista/Win2008";
}
}
}
strVers += " " + osInfo.ServicePack + ", Revision " + osInfo.Version.Revision.ToString() + ", " + osInfo.VersionString;
if (strVers == "")
{
strVers = "Unbekannte Windows-Version";
}
return strVers;
}
|