첨부 실행 코드는 나눔고딕코딩 폰트를 사용합니다.
유용한 소스 코드가 있으면 icodebroker@naver.com으로 보내주시면 감사합니다.
블로그 자료는 자유롭게 사용하세요.

■ Windows 운영 체제 버전 구하기

------------------------------------------------------------------------------------------------------------------------

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

------------------------------------------------------------------------------------------------------------------------

Posted by 사용자 icodebroker
TAG

댓글을 달아 주세요