コード例 #1
0
        int UnityEngineNetworkingUnityWebRequest_m_Abort(RealStatePtr L, int gen_param_count)
        {
            ObjectTranslator translator = this;


            UnityEngine.Networking.UnityWebRequest gen_to_be_invoked = (UnityEngine.Networking.UnityWebRequest)translator.FastGetCSObj(L, 1);


            {
                gen_to_be_invoked.Abort(  );



                return(0);
            }
        }
コード例 #2
0
        /** 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;
        }