public override int GetHashCode() { int hash = 1; if (CloudLevel != 0) { hash ^= CloudLevel.GetHashCode(); } if (RainLevel != 0) { hash ^= RainLevel.GetHashCode(); } if (WindLevel != 0) { hash ^= WindLevel.GetHashCode(); } if (SnowLevel != 0) { hash ^= SnowLevel.GetHashCode(); } if (FogLevel != 0) { hash ^= FogLevel.GetHashCode(); } if (WindDirection != 0) { hash ^= WindDirection.GetHashCode(); } if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } return(hash); }
private IReadOnlyDictionary <string, string> GetProperties(DiscordGuild guild, WhConfig whConfig, string city, string weatherImageUrl) { var weather = Translator.Instance.GetWeather(GameplayCondition); var weatherKey = $"weather_{Convert.ToInt32(GameplayCondition)}"; var weatherEmoji = MasterFile.Instance.Emojis.ContainsKey(weatherKey) && GameplayCondition != WeatherCondition.None ? GameplayCondition.GetWeatherEmojiIcon() : string.Empty; var hasWeather = GameplayCondition != WeatherCondition.None; var gmapsLink = string.Format(Strings.GoogleMaps, Latitude, Longitude); var appleMapsLink = string.Format(Strings.AppleMaps, Latitude, Longitude); var wazeMapsLink = string.Format(Strings.WazeMaps, Latitude, Longitude); var scannerMapsLink = string.Format(whConfig.Urls.ScannerMap, Latitude, Longitude); var staticMapLink = StaticMap.GetUrl(whConfig.Urls.StaticMap, whConfig.StaticMaps["weather"], Latitude, Longitude, weatherImageUrl, PokemonTeam.All, null, Polygon); var gmapsLocationLink = UrlShortener.CreateShortUrl(whConfig.ShortUrlApiUrl, gmapsLink); var appleMapsLocationLink = UrlShortener.CreateShortUrl(whConfig.ShortUrlApiUrl, appleMapsLink); var wazeMapsLocationLink = UrlShortener.CreateShortUrl(whConfig.ShortUrlApiUrl, wazeMapsLink); var scannerMapsLocationLink = UrlShortener.CreateShortUrl(whConfig.ShortUrlApiUrl, scannerMapsLink); var address = new Location(null, city, Latitude, Longitude).GetAddress(whConfig); //var staticMapLocationLink = string.IsNullOrEmpty(whConfig.ShortUrlApiUrl) ? staticMapLink : NetUtil.CreateShortUrl(whConfig.ShortUrlApiUrl, staticMapLink); const string defaultMissingValue = "?"; var dict = new Dictionary <string, string> { //Main properties { "id", Id.ToString() }, { "weather_condition", weather }, { "has_weather", Convert.ToString(hasWeather) }, { "weather", weather ?? defaultMissingValue }, { "weather_emoji", weatherEmoji ?? defaultMissingValue }, { "weather_img_url", weatherImageUrl }, { "wind_direction", WindDirection.ToString() }, { "wind_level", WindLevel.ToString() }, { "raid_level", RainLevel.ToString() }, { "cloud_level", CloudLevel.ToString() }, { "fog_level", FogLevel.ToString() }, { "snow_level", SnowLevel.ToString() }, { "warn_weather", Convert.ToString(WarnWeather ?? false) }, { "special_effect_level", SpecialEffectLevel.ToString() }, { "severity", Severity.ToString() }, //Location properties { "geofence", city ?? defaultMissingValue }, { "lat", Latitude.ToString() }, { "lng", Longitude.ToString() }, { "lat_5", Latitude.ToString("0.00000") }, { "lng_5", Longitude.ToString("0.00000") }, //Location links { "tilemaps_url", staticMapLink }, { "gmaps_url", gmapsLocationLink }, { "applemaps_url", appleMapsLocationLink }, { "wazemaps_url", wazeMapsLocationLink }, { "scanmaps_url", scannerMapsLocationLink }, { "address", address?.Address }, // Discord Guild properties { "guild_name", guild?.Name }, { "guild_img_url", guild?.IconUrl }, { "date_time", DateTime.Now.ToString() }, //Misc properties { "br", "\r\n" } }; return(dict); }
private IReadOnlyDictionary <string, string> GetProperties(DiscordGuild guild, WhConfig whConfig, string city, string weatherImageUrl) { var weather = Translator.Instance.GetWeather(GameplayCondition); var weatherKey = $"weather_{Convert.ToInt32(GameplayCondition)}"; var weatherEmoji = MasterFile.Instance.Emojis.ContainsKey(weatherKey) && GameplayCondition != WeatherType.None ? GameplayCondition.GetWeatherEmojiIcon() : string.Empty; var hasWeather = GameplayCondition != WeatherType.None; var gmapsLink = string.Format(Strings.GoogleMaps, Latitude, Longitude); var appleMapsLink = string.Format(Strings.AppleMaps, Latitude, Longitude); var wazeMapsLink = string.Format(Strings.WazeMaps, Latitude, Longitude); var scannerMapsLink = string.Format(whConfig.Urls.ScannerMap, Latitude, Longitude); var templatePath = Path.Combine(whConfig.StaticMaps.TemplatesFolder, whConfig.StaticMaps.Weather.TemplateFile); var staticMapLink = Utils.GetStaticMapsUrl(templatePath, whConfig.Urls.StaticMap, whConfig.StaticMaps.Weather.ZoomLevel, Latitude, Longitude, weatherImageUrl, null); var gmapsLocationLink = string.IsNullOrEmpty(whConfig.ShortUrlApiUrl) ? gmapsLink : NetUtil.CreateShortUrl(whConfig.ShortUrlApiUrl, gmapsLink); var appleMapsLocationLink = string.IsNullOrEmpty(whConfig.ShortUrlApiUrl) ? appleMapsLink : NetUtil.CreateShortUrl(whConfig.ShortUrlApiUrl, appleMapsLink); var wazeMapsLocationLink = string.IsNullOrEmpty(whConfig.ShortUrlApiUrl) ? wazeMapsLink : NetUtil.CreateShortUrl(whConfig.ShortUrlApiUrl, wazeMapsLink); var scannerMapsLocationLink = string.IsNullOrEmpty(whConfig.ShortUrlApiUrl) ? scannerMapsLink : NetUtil.CreateShortUrl(whConfig.ShortUrlApiUrl, scannerMapsLink); Geofence.Location address = null; if (!string.IsNullOrEmpty(whConfig.GoogleMapsKey)) { address = Utils.GetGoogleAddress(city, Latitude, Longitude, whConfig.GoogleMapsKey); } else if (!string.IsNullOrEmpty(whConfig.NominatimEndpoint)) { address = Utils.GetNominatimAddress(city, Latitude, Longitude, whConfig.NominatimEndpoint); } //var staticMapLocationLink = string.IsNullOrEmpty(whConfig.ShortUrlApiUrl) ? staticMapLink : NetUtil.CreateShortUrl(whConfig.ShortUrlApiUrl, staticMapLink); const string defaultMissingValue = "?"; var dict = new Dictionary <string, string> { //Main properties { "id", Id.ToString() }, { "weather_condition", weather }, { "has_weather", Convert.ToString(hasWeather) }, { "weather", weather ?? defaultMissingValue }, { "weather_emoji", weatherEmoji ?? defaultMissingValue }, { "weather_img_url", weatherImageUrl }, { "wind_direction", WindDirection.ToString() }, { "wind_level", WindLevel.ToString() }, { "raid_level", RainLevel.ToString() }, { "cloud_level", CloudLevel.ToString() }, { "fog_level", FogLevel.ToString() }, { "snow_level", SnowLevel.ToString() }, { "warn_weather", Convert.ToString(WarnWeather ?? false) }, { "special_effect_level", SpecialEffectLevel.ToString() }, { "severity", Severity.ToString() }, //Location properties { "geofence", city ?? defaultMissingValue }, { "lat", Latitude.ToString() }, { "lng", Longitude.ToString() }, { "lat_5", Math.Round(Latitude, 5).ToString() }, { "lng_5", Math.Round(Longitude, 5).ToString() }, //Location links { "tilemaps_url", staticMapLink }, { "gmaps_url", gmapsLocationLink }, { "applemaps_url", appleMapsLocationLink }, { "wazemaps_url", wazeMapsLocationLink }, { "scanmaps_url", scannerMapsLocationLink }, { "address", address?.Address }, // Discord Guild properties { "guild_name", guild?.Name }, { "guild_img_url", guild?.IconUrl }, { "date_time", DateTime.Now.ToString() }, //Misc properties { "br", "\r\n" } }; return(dict); }
/// <summary> /// Show the top altitude of clouds for the selected cloud level on the image. /// </summary> /// <param name="cl">The cloud level to use (low, mid, or high).</param> /// <returns></returns> public static string CloudTopAltitude(CloudLevel cl) { return "presclt " + (char)cl.GetHashCode(); }
/// <summary> /// Show the cloud cover for the selected cloud level on the image. /// </summary> /// <param name="cl">The cloud level to use (low, mid, or high).</param> /// <param name="contour">If set to <c>true</c> a contour chart will be drawn rather than a shaded chart.</param> /// <returns></returns> public static string CloudCover(CloudLevel cl, bool contour = false) { return (contour ? "tccc " : "tcc ") + (char) cl.GetHashCode(); }