Ejemplo n.º 1
0
        IEnumerator DownloadFileHandler(string download_url, string localPath_url, int timeout,
                                        Action <SDownloadFileResult> progress, Action <int> complete)
        {
            UnityDownloadFileHandler handler = new UnityDownloadFileHandler(download_url, localPath_url);

            handler.Progress = progress;
            UnityWebRequest request = UnityWebRequest.Get(download_url);

            request.SetRequestHeader("Range", string.Format("bytes={0}-", handler.DownloadedLength));
            request.downloadHandler = handler;
            request.timeout         = timeout;
            request.chunkedTransfer = true;
            request.disposeCertificateHandlerOnDispose = true;
            m_requestDict.Add(download_url, new RequestHandler(request, handler));
            yield return(request.SendWebRequest());

            int code = (int)request.responseCode;

            Dispose(download_url);
            if (complete != null)
            {
                complete(code);
            }
        }
Ejemplo n.º 2
0
 public RequestHandler(UnityWebRequest request, UnityDownloadFileHandler handler)
 {
     this.request = request;
     this.handler = handler;
 }