Example #1
0
        /// <summary>
        /// 문자열을 <see cref="SkyCode"/>형태로 변환합니다.
        /// </summary>
        /// <param name="code"></param>
        /// <returns></returns>
        public static SkyCode GetSkyCode(int skyCode, int pTypeCode)
        {
            SkyCode resultCode = SkyCode.NoReported;

            switch (pTypeCode)
            {
            // 비 / 눈 X
            case 0:
            {
                switch (skyCode)
                {
                // 맑음
                case 1:
                    resultCode = SkyCode.Sunny;
                    break;

                // 구름 조금
                case 2:
                    resultCode = SkyCode.PartlyCloudy;
                    break;

                // 구름 많음
                case 3:
                    resultCode = SkyCode.MostlyCloudy;
                    break;

                // 흐림
                case 4:
                    resultCode = SkyCode.Fog;
                    break;
                }
            }
            break;

            // 비
            case 1:
                resultCode = SkyCode.Rain;
                break;

            // 비/눈 (진눈깨비)
            case 2:
                resultCode = SkyCode.Drizzle;
                break;

            // 눈
            case 3:
                resultCode = SkyCode.Snow;
                break;
            }

            return(resultCode);
        }
Example #2
0
        /// <summary>
        /// <see cref="SkyCode"/>를 <see cref="string"/>형태로 변환합니다.
        /// </summary>
        /// <param name="target"></param>
        /// <returns></returns>
        public static string ConvertSkyCodeToString(SkyCode target)
        {
            string converted = "idk";

            switch (target)
            {
            case SkyCode.Sunny:
                converted = "맑음";
                break;

            case SkyCode.PartlyCloudy:
                converted = "구름 조금";
                break;

            case SkyCode.MostlyCloudy:
                converted = "구름 많음";
                break;

            case SkyCode.Fog:
                converted = "흐림";
                break;

            case SkyCode.Rain:
                converted = "비";
                break;

            case SkyCode.Snow:
                converted = "눈";
                break;

            case SkyCode.Drizzle:
                converted = "비 또는 눈";
                break;

            default:
                break;
            }

            return(converted);
        }