Exemple #1
0
    // Use this for initialization
    void Start()
    {
        //DownLoadManager.I.Add();

        DownLoadBatch downLoadBatch = new DownLoadBatch("DownLoadBatch",
                                                        OnDownLoadBatchCmp, OnDownLoadBatchError, OnDownLoadProgress);
        string url      = "https://ss0.bdstatic.com/5aV1bjqh_Q23odCf/static/superman/img/logo_top_ca79a146.png";
        string saveFile = Application.streamingAssetsPath + "/" + System.IO.Path.GetFileName(url);

        downLoadBatch.Add(url, saveFile);
        string url2      = "https://gss0.bdstatic.com/5bVWsj_p_tVS5dKfpU_Y_D3/res/r/image/2017-09-15/ecdbc5929ce5b9e974ea1b876875df6a.png";
        string saveFile2 = Application.streamingAssetsPath + "/" + System.IO.Path.GetFileName(url2);

        downLoadBatch.Add(url2, saveFile2);

        string url3      = "http://127.0.0.1/thunder_mac_3.1.7.3266.dmg";
        string saveFile3 = Application.streamingAssetsPath + "/" + System.IO.Path.GetFileName(url3);

        //downLoadBatch.Add(url3, saveFile3);

        downLoadBatch.Execute();

        UpZip("/Library/WebServer/Documents/data.zip", "/Users/zhuyuu3d/Documents/webroot/unzip");
    }
Exemple #2
0
    void UpdateAssets(string[] needUpdate)
    {
        DownLoadBatch downLoadBatch = new DownLoadBatch("AssetsUpdateManager.UpdateAssets",
                                                        OnUpdateAssetsCmp,
                                                        OnDownLoadBatchError,
                                                        OnDownLoadBatchProgress);

        string line;

        for (int i = 0; i < needUpdate.Length; i++)
        {
            line = needUpdate[i];
            if (line.IndexOf("=") >= 0)
            {
                string path = line.Substring(0, line.IndexOf("="));
                string md5  = line.Substring(line.IndexOf("=") + 1);

                //downLoadBatch.Add(Path.Combine(assetsSeverUrl,path),Path.Combine(assetsUpdatePath,path),md5);
                downLoadBatch.Add(assetsSeverUrl + path, assetsUpdatePath + path, md5);
            }
        }

        downLoadBatch.Execute();
    }