Ejemplo n.º 1
0
        private static WeatherType OpenWeatherTypeToCommonType(OpenWeatherType type)
        {
            switch (type)
            {
            case OpenWeatherType.RaggedThunderstorm:
            case OpenWeatherType.Thunderstorm:
            case OpenWeatherType.ThunderstormWithLightRain:
            case OpenWeatherType.ThunderstormWithRain:
            case OpenWeatherType.ThunderstormWithHeavyRain:
            case OpenWeatherType.ThunderstormWithLightDrizzle:
            case OpenWeatherType.ThunderstormWithDrizzle:
            case OpenWeatherType.ThunderstormWithHeavyDrizzle:
                return(WeatherType.Thunderstorm);

            case OpenWeatherType.LightThunderstorm:
                return(WeatherType.LightThunderstorm);

            case OpenWeatherType.HeavyThunderstorm:
            case OpenWeatherType.TropicalStorm:
                return(WeatherType.HeavyThunderstorm);

            case OpenWeatherType.LightIntensityDrizzle:
            case OpenWeatherType.LightIntensityDrizzleRain:
                return(WeatherType.LightDrizzle);

            case OpenWeatherType.Drizzle:
            case OpenWeatherType.DrizzleRain:
            case OpenWeatherType.ShowerDrizzle:
                return(WeatherType.Drizzle);

            case OpenWeatherType.HeavyIntensityDrizzle:
            case OpenWeatherType.HeavyIntensityDrizzleRain:
                return(WeatherType.HeavyDrizzle);

            case OpenWeatherType.LightRain:
            case OpenWeatherType.LightIntensityShowerRain:
                return(WeatherType.LightRain);

            case OpenWeatherType.ModerateRain:
            case OpenWeatherType.FreezingRain:
            case OpenWeatherType.ShowerRainAndDrizzle:
            case OpenWeatherType.ShowerRain:
            case OpenWeatherType.RaggedShowerRain:
                return(WeatherType.Rain);

            case OpenWeatherType.HeavyIntensityRain:
            case OpenWeatherType.VeryHeavyRain:
            case OpenWeatherType.ExtremeRain:
            case OpenWeatherType.HeavyShowerRainAndDrizzle:
            case OpenWeatherType.HeavyIntensityShowerRain:
                return(WeatherType.HeavyRain);

            case OpenWeatherType.LightSnow:
            case OpenWeatherType.LightShowerSnow:
                return(WeatherType.LightSnow);

            case OpenWeatherType.Snow:
            case OpenWeatherType.ShowerSnow:
                return(WeatherType.Snow);

            case OpenWeatherType.HeavySnow:
            case OpenWeatherType.HeavyShowerSnow:
                return(WeatherType.HeavySnow);

            case OpenWeatherType.LightRainAndSnow:
                return(WeatherType.LightSleet);

            case OpenWeatherType.RainAndSnow:
            case OpenWeatherType.Sleet:
                return(WeatherType.Sleet);

            case OpenWeatherType.ShowerSleet:
                return(WeatherType.HeavySleet);

            case OpenWeatherType.Mist:
                return(WeatherType.Mist);

            case OpenWeatherType.Smoke:
                return(WeatherType.Smoke);

            case OpenWeatherType.Haze:
                return(WeatherType.Haze);

            case OpenWeatherType.Sand:
            case OpenWeatherType.SandAndDustWhirls:
                return(WeatherType.Sand);

            case OpenWeatherType.Dust:
            case OpenWeatherType.VolcanicAsh:
                return(WeatherType.Dust);

            case OpenWeatherType.Fog:
                return(WeatherType.Fog);

            case OpenWeatherType.Squalls:
                return(WeatherType.Squalls);

            case OpenWeatherType.Tornado:
            case OpenWeatherType.TornadoExtreme:
                return(WeatherType.Tornado);

            case OpenWeatherType.ClearSky:
            case OpenWeatherType.Calm:
            case OpenWeatherType.LightBreeze:
                return(WeatherType.Clear);

            case OpenWeatherType.FewClouds:
            case OpenWeatherType.GentleBreeze:
            case OpenWeatherType.ModerateBreeze:
                return(WeatherType.FewClouds);

            case OpenWeatherType.ScatteredClouds:
                return(WeatherType.ScatteredClouds);

            case OpenWeatherType.BrokenClouds:
                return(WeatherType.BrokenClouds);

            case OpenWeatherType.OvercastClouds:
                return(WeatherType.OvercastClouds);

            case OpenWeatherType.Hurricane:
            case OpenWeatherType.Gale:
            case OpenWeatherType.SevereGale:
            case OpenWeatherType.Storm:
            case OpenWeatherType.ViolentStorm:
            case OpenWeatherType.HurricaneAdditional:
                return(WeatherType.Hurricane);

            case OpenWeatherType.Cold:
                return(WeatherType.Cold);

            case OpenWeatherType.Hot:
                return(WeatherType.Hot);

            case OpenWeatherType.Windy:
            case OpenWeatherType.FreshBreeze:
            case OpenWeatherType.StrongBreeze:
            case OpenWeatherType.HighWind:
                return(WeatherType.Windy);

            case OpenWeatherType.Hail:
                return(WeatherType.Hail);

            default:
                throw new ArgumentOutOfRangeException(nameof(type), type, null);
            }
        }
Ejemplo n.º 2
0
        private static WeatherType OpenWeatherTypeToCommonType(OpenWeatherType type) {
            switch (type) {
                case OpenWeatherType.RaggedThunderstorm:
                case OpenWeatherType.Thunderstorm:
                case OpenWeatherType.ThunderstormWithLightRain:
                case OpenWeatherType.ThunderstormWithRain:
                case OpenWeatherType.ThunderstormWithHeavyRain:
                case OpenWeatherType.ThunderstormWithLightDrizzle:
                case OpenWeatherType.ThunderstormWithDrizzle:
                case OpenWeatherType.ThunderstormWithHeavyDrizzle:
                    return WeatherType.Thunderstorm;

                case OpenWeatherType.LightThunderstorm:
                    return WeatherType.LightThunderstorm;

                case OpenWeatherType.HeavyThunderstorm:
                case OpenWeatherType.TropicalStorm:
                    return WeatherType.HeavyThunderstorm;

                case OpenWeatherType.LightIntensityDrizzle:
                case OpenWeatherType.LightIntensityDrizzleRain:
                    return WeatherType.LightDrizzle;

                case OpenWeatherType.Drizzle:
                case OpenWeatherType.DrizzleRain:
                case OpenWeatherType.ShowerDrizzle:
                    return WeatherType.Drizzle;

                case OpenWeatherType.HeavyIntensityDrizzle:
                case OpenWeatherType.HeavyIntensityDrizzleRain:
                    return WeatherType.HeavyDrizzle;

                case OpenWeatherType.LightRain:
                case OpenWeatherType.LightIntensityShowerRain:
                    return WeatherType.LightRain;

                case OpenWeatherType.ModerateRain:
                case OpenWeatherType.FreezingRain:
                case OpenWeatherType.ShowerRainAndDrizzle:
                case OpenWeatherType.ShowerRain:
                case OpenWeatherType.RaggedShowerRain:
                    return WeatherType.Rain;

                case OpenWeatherType.HeavyIntensityRain:
                case OpenWeatherType.VeryHeavyRain:
                case OpenWeatherType.ExtremeRain:
                case OpenWeatherType.HeavyShowerRainAndDrizzle:
                case OpenWeatherType.HeavyIntensityShowerRain:
                    return WeatherType.HeavyRain;
                    
                case OpenWeatherType.LightSnow:
                case OpenWeatherType.LightShowerSnow:
                    return WeatherType.LightSnow;

                case OpenWeatherType.Snow:
                case OpenWeatherType.ShowerSnow:
                    return WeatherType.Snow;

                case OpenWeatherType.HeavySnow:
                case OpenWeatherType.HeavyShowerSnow:
                    return WeatherType.HeavySnow;
                    
                case OpenWeatherType.LightRainAndSnow:
                    return WeatherType.LightSleet;

                case OpenWeatherType.RainAndSnow:
                case OpenWeatherType.Sleet:
                    return WeatherType.Sleet;
                    
                case OpenWeatherType.ShowerSleet:
                    return WeatherType.HeavySleet;

                case OpenWeatherType.Mist:
                    return WeatherType.Mist;

                case OpenWeatherType.Smoke:
                    return WeatherType.Smoke;

                case OpenWeatherType.Haze:
                    return WeatherType.Haze;
                    
                case OpenWeatherType.Sand:
                case OpenWeatherType.SandAndDustWhirls:
                    return WeatherType.Sand;
                    
                case OpenWeatherType.Dust:
                case OpenWeatherType.VolcanicAsh:
                    return WeatherType.Dust;

                case OpenWeatherType.Fog:
                    return WeatherType.Fog;

                case OpenWeatherType.Squalls:
                    return WeatherType.Squalls;

                case OpenWeatherType.Tornado:
                case OpenWeatherType.TornadoExtreme:
                    return WeatherType.Tornado;

                case OpenWeatherType.ClearSky:
                case OpenWeatherType.Calm:
                case OpenWeatherType.LightBreeze:
                    return WeatherType.Clear;

                case OpenWeatherType.FewClouds:
                case OpenWeatherType.GentleBreeze:
                case OpenWeatherType.ModerateBreeze:
                    return WeatherType.FewClouds;

                case OpenWeatherType.ScatteredClouds:
                    return WeatherType.ScatteredClouds;

                case OpenWeatherType.BrokenClouds:
                    return WeatherType.BrokenClouds;

                case OpenWeatherType.OvercastClouds:
                    return WeatherType.OvercastClouds;

                case OpenWeatherType.Hurricane:
                case OpenWeatherType.Gale:
                case OpenWeatherType.SevereGale:
                case OpenWeatherType.Storm:
                case OpenWeatherType.ViolentStorm:
                case OpenWeatherType.HurricaneAdditional:
                    return WeatherType.Hurricane;

                case OpenWeatherType.Cold:
                    return WeatherType.Cold;

                case OpenWeatherType.Hot:
                    return WeatherType.Hot;

                case OpenWeatherType.Windy:
                case OpenWeatherType.FreshBreeze:
                case OpenWeatherType.StrongBreeze:
                case OpenWeatherType.HighWind:
                    return WeatherType.Windy;

                case OpenWeatherType.Hail:
                    return WeatherType.Hail;

                default:
                    throw new ArgumentOutOfRangeException(nameof(type), type, null);
            }
        }