예제 #1
0
            public IEnumerator DownloadFile(string remotePath, string localPath, DownloadHandler downloadhandler, HttpUtil.RequestProcess processor)
            {
                //Get the file
                UnityWebRequest request = UnityWebRequest.Get(remotePath);

                if (downloadhandler != null)
                {
                    request.downloadHandler = downloadhandler;
                }
                yield return(request.SendWebRequest());

                if (request.result == UnityWebRequest.Result.ConnectionError)
                {
                    Debug.Log(request.error);
                }
                else
                {
                    // Retrieve results as binary data
                    byte[] data = request.downloadHandler.data;

                    //Save to disk
                    File.WriteAllBytes(localPath, data);
                }
                if (processor != null)
                {
                    processor.Invoke(request);
                }
            }
예제 #2
0
 public IEnumerator UploadFile(string localPath, string uploadPath, HttpUtil.RequestProcess processor)
 {
     throw new NotImplementedException();
 }
예제 #3
0
 public IEnumerator DownloadFile(string remotePath, string localPath, HttpUtil.RequestProcess processor)
 {
     yield return(DownloadFile(remotePath, localPath, null, processor));
 }