int registerHandle(HandleSaveScreenshotEvent h) { int id = internal_id++; handles.Add(id, h); return(id); }
public void SaveScreenshotToPublicGalleryAsync(string filename, string album, HandleSaveScreenshotEvent handle) { if (File.Exists(Application.persistentDataPath + "/" + unique_agent_temp_filename)) File.Delete(Application.persistentDataPath + "/" + unique_agent_temp_filename); Application.CaptureScreenshot(unique_agent_temp_filename); if (!Directory.Exists(GetPublicGalleryPath(album) + "/")) Directory.CreateDirectory(GetPublicGalleryPath(album) + "/"); StartCoroutine(waitAndCheckForLatestScreenshot(unique_agent_temp_filename, GetPublicGalleryPath(album) + "/" + filename, handle)); RefreshGallery(); }
public void SaveScreenshotAsync(string filepath, HandleSaveScreenshotEvent handle) { if (File.Exists(Application.persistentDataPath + "/" + unique_agent_temp_filename)) { File.Delete(Application.persistentDataPath + "/" + unique_agent_temp_filename); } Application.CaptureScreenshot(unique_agent_temp_filename); StartCoroutine(waitAndCheckForLatestScreenshot(unique_agent_temp_filename, filepath, handle)); }
IEnumerator waitAndCheckForLatestScreenshot(string source, string destpath, HandleSaveScreenshotEvent handle) { yield return(new WaitForSeconds(1)); if (System.IO.File.Exists(Application.persistentDataPath + "/" + source)) { if (destpath != "") { if (File.Exists(destpath)) { File.Delete(destpath); } System.IO.File.Move(Application.persistentDataPath + "/" + source, destpath); } if (handle != null) { handle(SaveScreenshotEvent.Success); } } else { StartCoroutine(waitAndCheckForLatestScreenshot(source, destpath, handle)); } }
public void SaveScreenshotAsync(string filepath, HandleSaveScreenshotEvent handle) { if (File.Exists(Application.persistentDataPath + "/" + unique_agent_temp_filename)) File.Delete(Application.persistentDataPath + "/" + unique_agent_temp_filename); Application.CaptureScreenshot(unique_agent_temp_filename); StartCoroutine(waitAndCheckForLatestScreenshot(unique_agent_temp_filename, filepath, handle)); }
int registerHandle(HandleSaveScreenshotEvent h) { int id = internal_id++; handles.Add(id, h); return id; }
IEnumerator waitAndCheckForLatestScreenshot(string source, string destpath, HandleSaveScreenshotEvent handle) { yield return new WaitForSeconds(1); if (System.IO.File.Exists(Application.persistentDataPath + "/" + source)) { if (destpath != "") { if (File.Exists(destpath)) File.Delete(destpath); System.IO.File.Move(Application.persistentDataPath + "/" + source, destpath); } if (handle != null) handle(SaveScreenshotEvent.Success); } else StartCoroutine(waitAndCheckForLatestScreenshot(source, destpath, handle)); }
public void SaveScreenshotToPrivateFolderAsync(string filename, string album, HandleSaveScreenshotEvent handle) { if (File.Exists(Application.persistentDataPath + "/" + unique_agent_temp_filename)) { File.Delete(Application.persistentDataPath + "/" + unique_agent_temp_filename); } Application.CaptureScreenshot(unique_agent_temp_filename); if (!Directory.Exists(GetPrivateFolderPath(album) + "/")) { Directory.CreateDirectory(GetPrivateFolderPath(album) + "/"); } StartCoroutine(waitAndCheckForLatestScreenshot(unique_agent_temp_filename, GetPrivateFolderPath(album) + "/" + filename , handle)); }