Exemple #1
0
        /*
         * Parse the HTTP response as a JSON string and into a AssetStoreResponse object.
         */
        static AssetStoreResponse ParseContent(AsyncHTTPClient job)
        {
            AssetStoreResponse resp = new AssetStoreResponse();

            resp.job  = job;
            resp.dict = null;
            resp.ok   = false;
            AsyncHTTPClient.State state = job.state;
            string content = job.text;

            if (!AsyncHTTPClient.IsSuccess(state))
            {
                Console.WriteLine(content);
                // Debug.Log("Request error: " + content);
                return(resp); // abort
            }

            string status;
            string message;

            resp.dict = ParseJSON(content, out status, out message);
            if (status == "error")
            {
                Debug.LogError("Request error (" + status + "): " + message);
                return(resp);
            }
            resp.ok = true;
            return(resp);
        }
Exemple #2
0
 private void Progress(AsyncHTTPClient.State status, int bytesDone, int bytesTotal)
 {
     this.state = status;
     if (this.statusCallback != null)
     {
         this.statusCallback(status, bytesDone, bytesTotal);
     }
 }
Exemple #3
0
 private void Done(AsyncHTTPClient.State status, int i_ResponseCode)
 {
     this.state        = status;
     this.responseCode = i_ResponseCode;
     if (this.doneCallback != null)
     {
         this.doneCallback(this);
     }
     this.m_Handle = (IntPtr)0;
 }
Exemple #4
0
        public static bool IsDone(AsyncHTTPClient.State state)
        {
            switch (state)
            {
            case AsyncHTTPClient.State.DONE_OK:
            case AsyncHTTPClient.State.DONE_FAILED:
            case AsyncHTTPClient.State.ABORTED:
            case AsyncHTTPClient.State.TIMEOUT:
                return(true);

            default:
                return(false);
            }
        }
Exemple #5
0
        public static bool IsDone(AsyncHTTPClient.State state)
        {
            bool result;

            switch (state)
            {
            case AsyncHTTPClient.State.DONE_OK:
            case AsyncHTTPClient.State.DONE_FAILED:
            case AsyncHTTPClient.State.ABORTED:
            case AsyncHTTPClient.State.TIMEOUT:
                result = true;
                break;

            default:
                result = false;
                break;
            }
            return(result);
        }
Exemple #6
0
 public static bool IsSuccess(AsyncHTTPClient.State state)
 {
     return(state == AsyncHTTPClient.State.DONE_OK);
 }