示例#1
0
    private void DownLoadFiles()
    {
        if (mUpdateList.Count <= 0)
        {
            mCompleteCall();
            return;
        }
        FileUtils.CreateDirectory(Paths.PersistentDataPath);
        string path     = mServerUrl + string.Format("{0}/{1}/{2}", Main.Inst.Version, Paths.PlatformName, "files.txt");
        string savePath = Paths.PersistentDataPath + "files.txt";
        bool   state    = HttpDownLoad.DownLoadFile(path, savePath);

        if (!state)
        {
            mErrorCall("热更差异化文件下载失败!");
            return;
        }

        mProgress.Reset();
        mProgress.TotalNum = mUpdateList.Count;
        foreach (var dic in mUpdateList)
        {
            mProgress.TotalSize += dic.Value.size;
        }
        foreach (var dic in mUpdateList)
        {
            var    info = dic.Value;
            string url  = mServerUrl + string.Format("{0}/{1}/", Main.Inst.Version, Paths.PlatformName);
            savePath = Paths.PersistentDataPath + info.name.Replace("\\", "/");
            DownLoadManager.Inst.StartDownload(info.name, url, savePath, info.size, info.crc, OnProcess, OnFinish);
        }
    }