private IEnumerator _getTextureFromServer(string query) { ServicePointManager.ServerCertificateValidationCallback = _remoteCertificateValidationCallback; var webAsync = new WebAsync(); var webRequest = HttpWebRequest.Create(query); webRequest.Method = "GET"; yield return(webAsync.GetResponse(webRequest)); if (webAsync.requestState.errorMessage != null) { Debug.Log("Error:" + webAsync.requestState.errorMessage); if (_userLocUsing) { _userLocation = null; _refreshMap(); } yield break; } var reader = new BinaryReader(webAsync.requestState.webResponse.GetResponseStream()); var bytesResponce = reader.ReadBytes(1 * 1024 * 1024 * 10); Destroy(_texture); _reinitializeTextureBuffer(); _texture.LoadImage(bytesResponce); _textureBufferUpdated.Invoke(); }
public void ConnectTo() { WebAsync webAsync = new WebAsync(); string link = url.text; if (!link.Contains("http://www.")) link = "http://www." + link; StartCoroutine(webAsync.CheckForMissingURL(link)); if (webAsync.isURLmissing == false) Debug.Log("All Good"); else Debug.Log("f****d up"); }
public void ConnectTo() { WebAsync webAsync = new WebAsync(); string link = url.text; if (!link.Contains("http://www.")) { link = "http://www." + link; } StartCoroutine(webAsync.CheckForMissingURL(link)); if (webAsync.isURLmissing == false) { Debug.Log("All Good"); } else { Debug.Log("f****d up"); } }
private IEnumerator _cacheLocationCoroutine(GoogleMapLocation location) { for (var i = MinZoom; i <= MaxZoom; i++) { var qs = _createApiQuery(location, i, false); if (LocalStorage.FileExists(MapDir + "/" + qs.GetHashCode())) { continue; } var query = _wrapQueryWithLinks(qs); ServicePointManager.ServerCertificateValidationCallback = _remoteCertificateValidationCallback; var webAsync = new WebAsync(); var webRequest = HttpWebRequest.Create(query); webRequest.Method = "GET"; yield return(webAsync.GetResponse(webRequest)); if (webAsync.requestState.errorMessage != null) { Debug.Log("Error:" + webAsync.requestState.errorMessage); yield break; } var reader = new BinaryReader(webAsync.requestState.webResponse.GetResponseStream()); var bytesResponce = reader.ReadBytes(1 * 1024 * 1024 * 10); Destroy(_texture); _reinitializeTextureBuffer(); _texture.LoadImage(bytesResponce); _textureBufferUpdated.Invoke(); LocalStorage.Save(MapDir + "/" + qs.GetHashCode(), _texture.EncodeToJPG()); } }
private void Start() { webAsync = new WebAsync(); }