using System;
/// <summary>
/// 운영 체제 타입
/// </summary>
public enum OperatingSystemType
{
Unknown ,
Windows95 ,
Windows98 ,
WindowsMe ,
WindowsNT40 ,
WindowsNT2000 ,
WindowsXP ,
WindowsServer2003,
WindowsVista ,
Windows7
}
#region 운영 체제 타입 구하기 - GetOperatingSystemType()
/// <summary>
/// 운영 체제 타입 구하기
/// </summary>
/// <returns>운영 체제 타입</returns>
public OperatingSystemType GetOperatingSystemType()
{
OperatingSystem operatingSystem = Environment.OSVersion;
OperatingSystemType operatingSystemType = OperatingSystemType.Unknown;
switch(operatingSystem.Platform)
{
case PlatformID.Win32Windows :
if(operatingSystem.Version.Major == 4)
{
switch(operatingSystem.Version.Minor)
{
case 0 : operatingSystemType = OperatingSystemType.Windows95; break;
case 10 : operatingSystemType = OperatingSystemType.Windows98; break;
case 90 : operatingSystemType = OperatingSystemType.WindowsMe; break;
}
}
break;
case PlatformID.Win32NT :
if(operatingSystem.Version.Major == 4)
{
operatingSystemType = OperatingSystemType.WindowsNT40;
}
else if(operatingSystem.Version.Major == 5)
{
switch(operatingSystem.Version.Minor)
{
case 0 : operatingSystemType = OperatingSystemType.WindowsNT2000; break;
case 1 : operatingSystemType = OperatingSystemType.WindowsXP; break;
case 2 : operatingSystemType = OperatingSystemType.WindowsServer2003; break;
}
}
else if(operatingSystem.Version.Major == 6)
{
switch(operatingSystem.Version.Minor)
{
case 0 : operatingSystemType = OperatingSystemType.WindowsVista; break;
case 1 : operatingSystemType = OperatingSystemType.Windows7; break;
}
}
break;
}
return operatingSystemType;
}
#endregion