/** CoroutineMain */ public System.Collections.IEnumerator CoroutineMain(Fee.File.OnFileCoroutine_CallBackInterface a_callback_interface, Fee.File.Path a_path) { //result this.result = null; //ロード。 byte[] t_result_binary = null; { //開始。 { do { try{ bool t_result = Fee.Platform.Platform.GetInstance().LoadAndroidContentFile_Start(a_path); if (t_result == true) { //成功。 break; } else { //キャンセルチェック。 if (a_callback_interface != null) { if (a_callback_interface.OnFileCoroutine(0.0f) == false) { //エラー。 this.result = new ResultType(null, "Cancel : LoadAndroidContentTextureFile : " + a_path.GetPath()); yield break; } } } }catch (System.Exception t_exception) { //エラー。 this.result = new ResultType(null, "Unknown Error : LoadAndroidContentTextureFile : " + a_path.GetPath() + " : " + t_exception.Message); yield break; } yield return(null); }while(true); } //読み込み中。 { do { try{ if (Fee.Platform.Platform.GetInstance().LoadAndroidContentFile_IsComplate() == true) { byte[] t_result = Fee.Platform.Platform.GetInstance().LoadAndroidContentFile_GetResult(); if (t_result == null) { //エラー。 this.result = new ResultType(null, "Load Error : LoadAndroidContentTextureFile : " + a_path.GetPath()); yield break; } //成功。 t_result_binary = t_result; break; } else { //キャンセルチェック。 { if (a_callback_interface != null) { if (a_callback_interface.OnFileCoroutine(0.0f) == false) { Fee.Platform.Platform.GetInstance().LoadAndroidContentFile_Cancel(); } } } } }catch (System.Exception t_exception) { //エラー。 this.result = new ResultType(null, "Load Error : LoadAndroidContentTextureFile : " + a_path.GetPath() + " : " + t_exception.Message); yield break; } yield return(null); }while(true); //終了。 Fee.Platform.Platform.GetInstance().LoadAndroidContentFile_End(); } } //コンバート。 UnityEngine.Texture2D t_result_texture = null; { try{ UnityEngine.Texture2D t_result = BinaryToTexture2D.Convert(t_result_binary); if (t_result == null) { //エラー。 this.result = new ResultType(null, "Convert Error : LoadAndroidContentTextureFile : " + a_path.GetPath()); yield break; } t_result_texture = t_result; }catch (System.Exception t_exception) { //エラー。 this.result = new ResultType(null, "Convert Error : LoadAndroidContentTextureFile : " + a_path.GetPath() + " : " + t_exception.Message); yield break; } } //成功。 this.result = new ResultType(t_result_texture, null); yield break; }
/** CoroutineMain */ public System.Collections.IEnumerator CoroutineMain(Fee.File.OnFileCoroutine_CallBackInterface a_callback_interface, Fee.File.Path a_path) { //result this.result = null; //taskprogress_ this.taskprogress = 0.0f; //ロード。 byte[] t_result_binary = null; { //キャンセルトークン。 Fee.TaskW.CancelToken t_cancel_token = new Fee.TaskW.CancelToken(); //タスク起動。 using (Fee.TaskW.Task <Task_LoadLocalBinaryFile.ResultType> t_task = Task_LoadLocalBinaryFile.Run(this, a_path, t_cancel_token)){ //終了待ち。 do { //キャンセルチェック。 { if (a_callback_interface != null) { if (a_callback_interface.OnFileCoroutine(this.taskprogress) == false) { t_cancel_token.Cancel(); } } } yield return(null); }while(t_task.IsEnd() == false); //結果。 Task_LoadLocalBinaryFile.ResultType t_result = t_task.GetResult(); if (t_result.errorstring != null) { //エラー。 this.result = new ResultType(null, t_result.errorstring); yield break; } if (t_task.IsSuccess() == false) { //エラー。 this.result = new ResultType(null, "Task Error : LoadLocalTextureFile : " + a_path.GetPath()); yield break; } if (t_result.binary == null) { //エラー。 this.result = new ResultType(null, "Unknown Error : LoadLocalTextureFile : " + a_path.GetPath()); yield break; } //成功。 t_result_binary = t_result.binary; } } //コンバート。 UnityEngine.Texture2D t_result_texture = null; { t_result_texture = BinaryToTexture2D.Convert(t_result_binary); if (t_result_texture == null) { //エラー。 this.result = new ResultType(null, "Convert Error : LoadLocalTextureFile : " + a_path.ToString()); yield break; } } //成功。 this.result = new ResultType(t_result_texture, null); yield break; }
/** CoroutineMain */ public System.Collections.IEnumerator CoroutineMain(Fee.File.OnFileCoroutine_CallBackInterface a_callback_interface, Fee.File.Path a_path, UnityEngine.WWWForm a_post_data, Fee.File.CustomCertificateHandler a_certificate_handler) { //result this.result = null; //ロード。 byte[] t_result_binary = null; System.Collections.Generic.Dictionary <string, string> t_result_responseheader = null; long t_result_responsecode = 0; { using (UnityEngine.Networking.UnityWebRequest t_webrequest = CreateWebRequestInstance(a_path, a_post_data, a_certificate_handler)){ //通信。 { UnityEngine.Networking.UnityWebRequestAsyncOperation t_webrequest_async = null; if (t_webrequest != null) { t_webrequest_async = t_webrequest.SendWebRequest(); if (t_webrequest_async == null) { //エラー。 this.result = new ResultType(null, "Unknown Error : LoadUrlTextureFile : " + a_path.GetPath(), t_webrequest.GetResponseHeaders(), t_webrequest.responseCode); yield break; } } else { //エラー。 this.result = new ResultType(null, "Unknown Error : LoadUrlTextureFile : " + a_path.GetPath(), t_webrequest.GetResponseHeaders(), t_webrequest.responseCode); yield break; } do { //エラーチェック。 if ((t_webrequest.isNetworkError == true) || (t_webrequest.isHttpError == true)) { //エラー。 if (t_webrequest.error != null) { this.result = new ResultType(null, "Connect Error : LoadUrlTextureFile : " + a_path.GetPath() + " : " + t_webrequest.error, t_webrequest.GetResponseHeaders(), t_webrequest.responseCode); } else { this.result = new ResultType(null, "Connect Error : LoadUrlTextureFile : " + a_path.GetPath(), t_webrequest.GetResponseHeaders(), t_webrequest.responseCode); } yield break; } else if ((t_webrequest.isDone == true) && (t_webrequest.isNetworkError == false) && (t_webrequest.isHttpError == false)) { //正常終了。 yield return(t_webrequest_async); break; } //キャンセルチェック。 { if (a_callback_interface != null) { float t_progress = (t_webrequest.uploadProgress + t_webrequest.downloadProgress) / 2; if (a_callback_interface.OnFileCoroutine(t_progress) == false) { t_webrequest.Abort(); } } } yield return(null); }while(true); } //コンバート。 try{ if (t_webrequest.downloadHandler == null) { //エラー。 this.result = new ResultType(null, "Convert Error : LoadUrlTextureFile : " + a_path.GetPath(), t_webrequest.GetResponseHeaders(), t_webrequest.responseCode); yield break; } byte[] t_result = t_webrequest.downloadHandler.data; if (t_result == null) { //エラー。 this.result = new ResultType(null, "Convert Error : LoadUrlTextureFile : " + a_path.GetPath(), t_webrequest.GetResponseHeaders(), t_webrequest.responseCode); yield break; } t_result_binary = t_result; }catch (System.Exception t_exception) { //エラー。 this.result = new ResultType(null, "Convert Error : LoadUrlTextureFile : " + a_path.GetPath() + " : " + t_exception.Message, t_webrequest.GetResponseHeaders(), t_webrequest.responseCode); yield break; } //レスポンスヘッダー。 t_result_responseheader = t_webrequest.GetResponseHeaders(); t_result_responsecode = t_webrequest.responseCode; } } //コンバート。 UnityEngine.Texture2D t_result_texture = null; { try{ UnityEngine.Texture2D t_result = BinaryToTexture2D.Convert(t_result_binary); if (t_result != null) { t_result_texture = t_result; } else { //エラー。 this.result = new ResultType(null, "Convert Error : LoadUrlTextureFile : " + a_path.GetPath(), t_result_responseheader, t_result_responsecode); yield break; } }catch (System.Exception t_exception) { //エラー。 this.result = new ResultType(null, "Convert Error : LoadUrlTextureFile : " + a_path.GetPath() + " : " + t_exception.Message, t_result_responseheader, t_result_responsecode); yield break; } } //成功。 this.result = new ResultType(t_result_texture, null, t_result_responseheader, t_result_responsecode); yield break; }