private static string GetOperatingSystemLabel()
{
if (Environment.OSVersion.Platform == PlatformID.Unix)
{
if (UnixName == "Linux")
return String.Format("{0} / {1}", LinuxVersion, LinuxDesktop);
else
return UnixName; // Maybe "Darwin" for a Mac?
}
var list = new List<Version>();
list.Add(new Version(System.PlatformID.Win32NT, 5, 0, "Windows 2000"));
list.Add(new Version(System.PlatformID.Win32NT, 5, 1, "Windows XP"));
list.Add(new Version(System.PlatformID.Win32NT, 6, 0, "Vista"));
list.Add(new Version(System.PlatformID.Win32NT, 6, 1, "Windows 7"));
list.Add(new Version(System.PlatformID.Win32NT, 6, 2, "Windows 8"));
list.Add(new Version(System.PlatformID.Win32NT, 6, 3, "Windows 8.1"));
list.Add(new Version(System.PlatformID.Win32NT, 10, 0, "Windows 10"));
foreach (var version in list)
{
if (version.Match(System.Environment.OSVersion))
return version.Label;// +" " + Environment.OSVersion.ServicePack;
}
return System.Environment.OSVersion.VersionString;
}