public static IEnumerator DownloadGlyphFromFirebase(Glyph glyph) { string path = glyph.GetPathToContent(); bool commandFinished = false; Debug.Log("Downloading content for " + glyph.GetGlyphId()); // Create local filesystem URL string local_url = ApplicationFileManager.GetLocalDownloadPath(glyph); // Firebase.Storage.StorageReference glyph_fb_reference = storage_ref.Child (path); // Download to the local filesystem FileInfo local_file = new FileInfo(local_url); local_file.Directory.Create(); Debug.Log("Path: " + path); // glyph_fb_reference.GetFileAsync(local_url).ContinueWith(task => { // if (!task.IsFaulted && !task.IsCanceled) { // Debug.Log("File downloaded."); // commandFinished = true; // } else { // Debug.LogError("error downloading file: " + task.Exception); // } // }); while (!commandFinished) { yield return(null); } yield return("Done"); }
private IEnumerator setGlyphImage(Glyph glyph) { if (!ApplicationFileManager.IsGlyphDownloaded(glyph)) { ServerCall call = new ServerCall(ServerInteract.DownloadGlyphFromFirebase(glyph)); yield return(StartCoroutine(call.call())); } Texture2D texture = ApplicationFileManager.LoadTextureFromPNGFile(ApplicationFileManager.GetLocalDownloadPath(glyph)); glyphImage.texture = texture; imageSet = true; imageTransform.sizeDelta = new Vector2(texture.width, texture.height); if (placeHolderHeight != 0.0f) { float imageScale = (placeHolderHeight - IMAGE_PADDING * 2.0f) / texture.height; imageTransform.localScale = new Vector3(imageScale, imageScale, imageScale); imageResized = true; } yield return("Done"); }
private void renderPNGGlyph(Glyph glyph) { string localPath = ApplicationFileManager.GetLocalDownloadPath(glyph); Debug.Log("Render: Loading " + localPath); Texture2D tex = ApplicationFileManager.LoadTextureFromPNGFile(localPath); if (tex == null) { Debug.LogError("Render: Couldn't find downloaded file"); } else { Debug.Log("Render: File loaded, setting image"); setGlyphContentDisplayImage(tex); } }
private IEnumerator doRenderForGlyph(Glyph glyph) { Debug.Log("Render: Loading " + ApplicationFileManager.GetLocalDownloadPath(glyph)); if (!ApplicationFileManager.IsGlyphDownloaded(glyph)) { Debug.Log("Render: Downloading"); ServerCall download = new ServerCall(ServerInteract.DownloadGlyphFromFirebase(glyph)); yield return(StartCoroutine(download.call())); if (download.ReturnException != null) { statusPanel.showErrorStatus(download.ReturnException.Message); throw download.ReturnException; } //yield return StartCoroutine (ServerInteract.downloadObjectFromAWS (glyph.getPathToContent (), LoadUserData.getLoggedInUser ().getAWSAuthToken ())); Debug.Log("Render: Downloading finished"); } else { Debug.Log("Render: Glyph already downloaded"); } string extension = ApplicationFileManager.GetFileExtension(glyph.GetPathToContent()); if (extension.Equals(ApplicationFileManager.PNG_EXTENSION)) { Debug.Log("Render: Loading PNG File"); renderPNGGlyph(glyph); Debug.Log("Render: Finished"); } else { Debug.LogError("Render: Unknown Render Type " + extension); } yield return("Done"); }
private IEnumerator doRenderForGlyph(Glyph glyph) { Debug.Log("Render: Loading " + ApplicationFileManager.GetLocalDownloadPath(glyph)); if (!ApplicationFileManager.IsGlyphDownloaded(glyph)) { Debug.Log("Render: Downloading"); ServerCall download = new ServerCall(ServerInteract.DownloadGlyphFromFirebase(glyph)); yield return(StartCoroutine(download.call())); //yield return StartCoroutine (ServerInteract.downloadObjectFromAWS (glyph.getPathToContent (), LoadUserData.getLoggedInUser ().getAWSAuthToken ())); Debug.Log("Render: Downloading finished"); } else { Debug.Log("Render: Glyph already downloaded"); } string extension = ApplicationFileManager.GetFileExtension(glyph.GetPathToContent()); if (extension.Equals(ApplicationFileManager.PNG_EXTENSION)) { Debug.Log("Render: Loading PNG File"); renderPNGGlyph(glyph); } else { Debug.Log("Render: Unknown Render Type " + extension); } ServerCall markGlyphFound = new ServerCall(ServerInteract.INSTANCE.MarkGlyphAsFound(glyph)); StartCoroutine(markGlyphFound.call()); Debug.Log("Render: Finished"); yield return("Done"); }