private static ScanResult SnipeScanForPokemon(Location location) { var formatter = new NumberFormatInfo {NumberDecimalSeparator = "."}; var uri = $"https://pokevision.com/map/data/{location.Latitude.ToString(formatter)}/{location.Longitude.ToString(formatter)}"; ScanResult scanResult; try { var request = WebRequest.CreateHttp(uri); request.Accept = "application/json"; request.Method = "GET"; request.Timeout = 1000; var resp = request.GetResponse(); var reader = new StreamReader(resp.GetResponseStream()); scanResult = JsonConvert.DeserializeObject<ScanResult>(reader.ReadToEnd()); } catch (Exception) { scanResult = new ScanResult { Status = "fail", Pokemon = new List<PokemonLocation>() }; } return scanResult; }
private static ScanResult SnipeScanForPokemon(ISession session, Location location) { var formatter = new NumberFormatInfo {NumberDecimalSeparator = "."}; var offset = session.LogicSettings.SnipingScanOffset; // 0.003 = half a mile; maximum 0.06 is 10 miles if (offset < 0.001) offset = 0.003; if (offset > 0.06) offset = 0.06; var boundLowerLeftLat = location.Latitude - offset; var boundLowerLeftLng = location.Longitude - offset; var boundUpperRightLat = location.Latitude + offset; var boundUpperRightLng = location.Longitude + offset; var uri = $"http://skiplagged.com/api/pokemon.php?bounds={boundLowerLeftLat.ToString(formatter)},{boundLowerLeftLng.ToString(formatter)},{boundUpperRightLat.ToString(formatter)},{boundUpperRightLng.ToString(formatter)}"; ScanResult scanResult; try { var request = WebRequest.CreateHttp(uri); request.Accept = "application/json"; request.UserAgent = "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.103 Safari/537.36\r\n"; request.Method = "GET"; request.Timeout = 15000; request.ReadWriteTimeout = 32000; var resp = request.GetResponse(); var reader = new StreamReader(resp.GetResponseStream()); var fullresp = reader.ReadToEnd().Replace(" M", "Male").Replace(" F", "Female").Replace("Farfetch'd", "Farfetchd").Replace("Mr.Maleime", "MrMime"); scanResult = JsonConvert.DeserializeObject<ScanResult>(fullresp); } catch (Exception ex) { // most likely System.IO.IOException session.EventDispatcher.Send(new ErrorEvent {Message = ex.Message}); scanResult = new ScanResult { Status = "fail", pokemons = new List<PokemonLocation>() }; } return scanResult; }
private static ScanResult SnipeScanForPokemon(ISession session, Location location) { var formatter = new NumberFormatInfo {NumberDecimalSeparator = "."}; var offset = session.LogicSettings.SnipingScanOffset; // 0.003 = half a mile; maximum 0.06 is 10 miles if (offset<0.001) offset=0.003; if (offset>0.06) offset = 0.06; var boundLowerLeftLat = location.Latitude - offset; var boundLowerLeftLng = location.Longitude - offset; var boundUpperRightLat = location.Latitude + offset; var boundUpperRightLng = location.Longitude + offset; var uri = $"http://skiplagged.com/api/pokemon.php?bounds={boundLowerLeftLat.ToString(formatter)},{boundLowerLeftLng.ToString(formatter)},{boundUpperRightLat.ToString(formatter)},{boundUpperRightLng.ToString(formatter)}"; /*var uri = $"http://skiplagged.com/api/pokemon.php?address={location.Latitude.ToString(formatter)},{location.Longitude.ToString(formatter)}"; */ /* * http://skiplagged.com/api/pokemon.php?bounds=40.76356269219236,-73.98657795715332,40.7854671345488,-73.95812508392333 * bounds = bound_lower_left_lat,bound_lower_left_lng,bound_upper_right_lat,bound_upper_right_lng */ ScanResult scanResult; try { var request = WebRequest.CreateHttp(uri); request.Accept = "application/json"; request.Method = "GET"; request.Timeout = 5000; request.ReadWriteTimeout = 32000; var resp = request.GetResponse(); var reader = new StreamReader(resp.GetResponseStream()); var fullresp = reader.ReadToEnd().Replace(" M", "Male").Replace(" F", "Female").Replace("'", ""); scanResult = JsonConvert.DeserializeObject<ScanResult>(fullresp); } catch (Exception ex) { // most likely System.IO.IOException session.EventDispatcher.Send(new ErrorEvent { Message = ex.ToString() }); scanResult = new ScanResult { Status = "fail", pokemons = new List<PokemonLocation>() }; } return scanResult; }
private static ScanResult SnipeScanForPokemon(ISession session, Location location) { var formatter = new NumberFormatInfo { NumberDecimalSeparator = "." }; var offset = session.LogicSettings.SnipingScanOffset; // 0.003 = half a mile; maximum 0.06 is 10 miles if (offset < 0.001) { offset = 0.003; } if (offset > 0.06) { offset = 0.06; } var boundLowerLeftLat = location.Latitude - offset; var boundLowerLeftLng = location.Longitude - offset; var boundUpperRightLat = location.Latitude + offset; var boundUpperRightLng = location.Longitude + offset; var uri = $"http://skiplagged.com/api/pokemon.php?bounds={boundLowerLeftLat.ToString(formatter)},{boundLowerLeftLng.ToString(formatter)},{boundUpperRightLat.ToString(formatter)},{boundUpperRightLng.ToString(formatter)}"; /*var uri = * $"http://skiplagged.com/api/pokemon.php?address={location.Latitude.ToString(formatter)},{location.Longitude.ToString(formatter)}"; */ /* * http://skiplagged.com/api/pokemon.php?bounds=40.76356269219236,-73.98657795715332,40.7854671345488,-73.95812508392333 * bounds = bound_lower_left_lat,bound_lower_left_lng,bound_upper_right_lat,bound_upper_right_lng */ ScanResult scanResult; try { var request = WebRequest.CreateHttp(uri); request.Accept = "application/json"; request.Method = "GET"; request.Timeout = 10000; request.ReadWriteTimeout = 32000; var resp = request.GetResponse(); var reader = new StreamReader(resp.GetResponseStream()); var fullresp = reader.ReadToEnd().Replace(" M", "Male").Replace(" F", "Female").Replace("'", ""); scanResult = JsonConvert.DeserializeObject <ScanResult>(fullresp); } catch (Exception ex) { // most likely System.IO.IOException session.EventDispatcher.Send(new ErrorEvent { Message = ex.Message }); scanResult = new ScanResult { Status = "fail", pokemons = new List <PokemonLocation>() }; } return(scanResult); }
private static ScanResult SnipeScanForPokemon(Location location) { var uri = $"https://pokevision.com/map/data/{location.Latitude}/{location.Longitude}"; ScanResult scanResult; try { var request = WebRequest.CreateHttp(uri); request.Accept = "application/json"; request.Method = "GET"; var resp = request.GetResponse(); var reader = new StreamReader(resp.GetResponseStream()); scanResult = JsonConvert.DeserializeObject<ScanResult>(reader.ReadToEnd()); } catch (Exception) { scanResult = new ScanResult() { status = "fail", pokemon = new List<PokemonLocation>() }; } return scanResult; }
private static ScanResult SnipeScanForPokemon(ISession session, Location location) { var formatter = new NumberFormatInfo { NumberDecimalSeparator = "." }; var offset = session.LogicSettings.SnipingScanOffset; // 0.003 = half a mile; maximum 0.06 is 10 miles if (offset < 0.001) { offset = 0.003; } if (offset > 0.06) { offset = 0.06; } var boundLowerLeftLat = location.Latitude - offset; var boundLowerLeftLng = location.Longitude - offset; var boundUpperRightLat = location.Latitude + offset; var boundUpperRightLng = location.Longitude + offset; var uri = $"http://skiplagged.com/api/pokemon.php?bounds={boundLowerLeftLat.ToString(formatter)},{boundLowerLeftLng.ToString(formatter)},{boundUpperRightLat.ToString(formatter)},{boundUpperRightLng.ToString(formatter)}"; ScanResult scanResult; try { var request = WebRequest.CreateHttp(uri); request.Accept = "application/json"; request.UserAgent = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:47.0) Gecko/20100101 Firefox/47.0"; request.Method = "GET"; request.Timeout = 15000; request.ReadWriteTimeout = 32000; var resp = request.GetResponse(); var reader = new StreamReader(resp.GetResponseStream()); var fullresp = reader.ReadToEnd() .Replace(" M", "Male") .Replace(" F", "Female") .Replace("Farfetch'd", "Farfetchd") .Replace("Mr.Maleime", "MrMime"); scanResult = JsonConvert.DeserializeObject <ScanResult>(fullresp); } catch (Exception ex) { // most likely System.IO.IOException session.EventDispatcher.Send(new ErrorEvent { Message = ex.Message }); scanResult = new ScanResult { Status = "fail", pokemons = new List <PokemonLocation>() }; } return(scanResult); }