/** CoroutineMain */ public System.Collections.IEnumerator CoroutineMain(Fee.File.OnFileCoroutine_CallBackInterface a_callback_interface, Fee.File.Path a_path, System.Collections.Generic.List <UnityEngine.Networking.IMultipartFormSection> 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 : LoadUrlTextFile : " + a_path.GetPath(), t_webrequest.GetResponseHeaders(), t_webrequest.responseCode); yield break; } } else { //エラー。 this.result = new ResultType(null, "Unknown Error : LoadUrlTextFile : " + a_path.GetPath(), t_webrequest.GetResponseHeaders(), t_webrequest.responseCode); yield break; } do { //エラーチェック。 if (t_webrequest.result == UnityEngine.Networking.UnityWebRequest.Result.InProgress) { //実行中。 } else if (t_webrequest.result == UnityEngine.Networking.UnityWebRequest.Result.Success) { //正常終了。 yield return(t_webrequest_async); break; } else { //エラー。 if (t_webrequest.error != null) { this.result = new ResultType(null, "Connect Error : LoadUrlTextFile : " + a_path.GetPath() + " : " + t_webrequest.error, t_webrequest.GetResponseHeaders(), t_webrequest.responseCode); } else { this.result = new ResultType(null, "Connect Error : LoadUrlTextFile : " + a_path.GetPath(), t_webrequest.GetResponseHeaders(), t_webrequest.responseCode); } yield 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 : LoadUrlTextFile : " + 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 : LoadUrlTextFile : " + 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 : LoadUrlTextFile : " + 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; } } //コンバート。 string t_result_text = null; { string t_result = Fee.StringConvert.Utf8BinaryToString.Convert(t_result_binary, 0, t_result_binary.Length); if (t_result != null) { //成功。 t_result_text = t_result; } else { //エラー。 this.result = new ResultType(null, "Convert Error : LoadUrlTextFile : " + a_path.GetPath(), t_result_responseheader, t_result_responsecode); yield break; } } //成功。 this.result = new ResultType(t_result_text, null, t_result_responseheader, t_result_responsecode); yield break; }
/** 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 : LoadAndroidContentTextFile : " + a_path.GetPath()); yield break; } } } }catch (System.Exception t_exception) { //エラー。 this.result = new ResultType(null, "Unknown Error : LoadAndroidContentTextFile : " + 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 : LoadAndroidContentTextFile : " + 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 : LoadAndroidContentTextFile : " + a_path.GetPath() + " : " + t_exception.Message); yield break; } yield return(null); }while(true); //終了。 Fee.Platform.Platform.GetInstance().LoadAndroidContentFile_End(); } } //コンバート。 string t_result_text = null; { try{ string t_result = Fee.StringConvert.Utf8BinaryToString.Convert(t_result_binary, 0, t_result_binary.Length); if (t_result == null) { //エラー。 this.result = new ResultType(null, "Convert Error : LoadAndroidContentTextFile : " + a_path.GetPath()); yield break; } t_result_text = t_result; }catch (System.Exception t_exception) { //エラー。 this.result = new ResultType(null, "Convert Error : LoadAndroidContentTextFile : " + a_path.GetPath() + " : " + t_exception.Message); yield break; } } //成功。 this.result = new ResultType(t_result_text, 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, byte[] a_binary) { //result this.result = null; //taskprogress_ this.taskprogress = 0.0f; //チェック。 if (a_binary == null) { //エラー。 this.result = new ResultType(false, "Param Error : SaveLocalBinaryFile : " + a_path.GetPath()); yield break; } //セーブ。 bool t_result_saveend = false; { //キャンセルトークン。 Fee.TaskW.CancelToken t_cancel_token = new Fee.TaskW.CancelToken(); //タスク起動。 using (Fee.TaskW.Task <Task_SaveLocalBinaryFile.ResultType> t_task = Task_SaveLocalBinaryFile.Run(this, a_path, a_binary, 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_SaveLocalBinaryFile.ResultType t_result = t_task.GetResult(); if (t_result.errorstring != null) { //エラー。 this.result = new ResultType(false, t_result.errorstring); yield break; } if (t_task.IsSuccess() == false) { //エラー。 this.result = new ResultType(false, "Task Error : SaveLocalBinaryFile : " + a_path.GetPath()); yield break; } if (t_result.saveend == false) { //エラー。 this.result = new ResultType(false, "Unknown Error : SaveLocalBinaryFile : " + a_path.GetPath()); yield break; } //成功。 t_result_saveend = t_result.saveend; } } this.result = new ResultType(t_result_saveend, 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; //ロード。 UnityEngine.Object t_result_object = null; { UnityEngine.ResourceRequest t_request = null; try{ t_request = UnityEngine.Resources.LoadAsync(a_path.GetPath()); if (t_request == null) { //エラー。 this.result = new ResultType(null, "Unknown Error : LoadResourcesTextureFile : " + a_path.GetPath()); yield break; } }catch (System.Exception t_exception) { //エラー。 this.result = new ResultType(null, "Unknown Error : LoadResourcesPrefabFile : " + a_path.GetPath() + " : " + t_exception.Message); yield break; } do { //キャンセルチェック。 { if (a_callback_interface != null) { if (a_callback_interface.OnFileCoroutine(t_request.progress) == false) { //t_request.Cancel(); } } } yield return(null); }while(t_request.isDone == false); if (t_request.asset == null) { //エラー。 this.result = new ResultType(null, "Load Error : LoadResourcesTextureFile : " + a_path.GetPath()); yield break; } t_result_object = t_request.asset; } //コンバート。 UnityEngine.Texture2D t_result_texture = null; { UnityEngine.Texture2D t_result = t_result_object as UnityEngine.Texture2D; if (t_result == null) { //エラー。 this.result = new ResultType(null, "Convert Error : LoadResourcesTextureFile : " + a_path.GetPath()); yield break; } t_result_texture = t_result; } //成功。 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.Texture2D a_texture) { //result this.result = null; //taskprogress_ this.taskprogress = 0.0f; //チェック。 if (a_texture == null) { //エラー。 this.result = new ResultType(false, "Convert Error : SaveLocalTextureFile : " + a_path.GetPath()); yield break; } //コンバート。 byte[] t_result_binary = null; { try{ byte[] t_result = UnityEngine.ImageConversion.EncodeToPNG(a_texture); if (t_result == null) { //エラー。 this.result = new ResultType(false, "Convert Error : SaveLocalTextureFile : " + a_path.GetPath()); yield break; } t_result_binary = t_result; }catch (System.Exception t_exception) { //エラー。 this.result = new ResultType(false, "Convert Error : SaveLocalTextureFile : " + a_path.GetPath() + " : " + t_exception.Message); yield break; } } //セーブ。 bool t_result_saveend = false; { //キャンセルトークン。 Fee.TaskW.CancelToken t_cancel_token = new Fee.TaskW.CancelToken(); //タスク起動。 using (Fee.TaskW.Task <Task_SaveLocalBinaryFile.ResultType> t_task = Task_SaveLocalBinaryFile.Run(this, a_path, t_result_binary, 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_SaveLocalBinaryFile.ResultType t_result = t_task.GetResult(); if (t_result.errorstring != null) { //エラー。 this.result = new ResultType(false, t_result.errorstring); yield break; } if (t_task.IsSuccess() == false) { //エラー。 this.result = new ResultType(false, "Task Error : SaveLocalTextureFile : " + a_path.GetPath()); yield break; } if (t_result.saveend == false) { //エラー。 this.result = new ResultType(false, "Unknown Error : SaveLocalTextureFile : " + a_path.GetPath()); yield break; } //成功。 t_result_saveend = t_result.saveend; } } this.result = new ResultType(t_result_saveend, null); yield break; }