/** CoroutineMain */ public System.Collections.IEnumerator CoroutineMain(Fee.Crypt.OnCryptCoroutine_CallBackInterface a_callback_interface, byte[] a_binary, int a_index, int a_length, string a_pass, string a_salt) { //result this.result = new ResultType(); //taskprogress this.taskprogress = 0.0f; //キャンセルトークン。 Fee.TaskW.CancelToken t_cancel_token = new Fee.TaskW.CancelToken(); //result Task_DecryptPass.ResultType t_result; //タスク起動。 using (Fee.TaskW.Task <Task_DecryptPass.ResultType> t_task = Task_DecryptPass.Run(this, a_binary, a_index, a_length, a_pass, a_salt, t_cancel_token)){ //終了待ち。 do { //キャンセル。 if (a_callback_interface != null) { if (a_callback_interface.OnCryptCoroutine(this.taskprogress) == false) { t_cancel_token.Cancel(); } } yield return(null); }while(t_task.IsEnd() == false); //結果。 t_result = t_task.GetResult(); //成功。 if (t_task.IsSuccess() == true) { if (t_result.binary != null) { this.result.binary = t_result.binary; yield break; } } } //失敗。 if (t_result.errorstring != null) { this.result.errorstring = t_result.errorstring; yield break; } else { this.result.errorstring = "Coroutine_DecryptPass : null"; yield break; } }
/** 実行。 */ public static Fee.TaskW.Task <ResultType> Run(Fee.Crypt.OnCryptTask_CallBackInterface a_callback_interface, byte[] a_binary, int a_index, int a_length, string a_pass, string a_salt, Fee.TaskW.CancelToken a_cancel) { return(new Fee.TaskW.Task <ResultType>(() => { return Task_DecryptPass.TaskMain(a_callback_interface, a_binary, a_index, a_length, a_pass, a_salt, a_cancel); })); }