protected string GetPositionByIp(string IpV4) { GeoLocator.Ip IpAddress = new GeoLocator.Ip { address_v4 = IpV4 }; string res = $"ip = { new JavaScriptSerializer().Serialize(IpAddress)}\n"; GeoLocator.Position position = new GeoLocator(YandexKey).GetByIp(IpAddress); res += $"Position = { new JavaScriptSerializer().Serialize(position)}\n"; return(res); }
protected string GetAddressByIp(string IpV4) { GeoLocator.Ip IpAddress = new GeoLocator.Ip { address_v4 = IpV4 }; string res = $"ip = { new JavaScriptSerializer().Serialize(new { IpV4 })}\n"; GeoLocator.Position position = new GeoLocator(YandexKey).GetByIp(IpAddress); GeoDecoder.Address address = position != null ? new GeoDecoder(YandexKey).GetAddressByPoint(position.latitude, position.longitude) : null; res += $"Address = { new JavaScriptSerializer().Serialize(address)}\n"; return(res); }