public static IEnumerator CheckDiskSpace(AssetBundleInfo info, AssetBundleMng manager)
    {
        long size = AssetBundleDiskSpaceCheck.GetFileSize(long.Parse(info.size));

        while (!AssetBundleDiskSpaceCheck.IsFreeSpace(size + manager.GetDownloadFileSize()))
        {
            while (0 < manager.GetCountDownloadProcess())
            {
                yield return(null);
            }
            bool isOpen = true;
            AlertManager.ShowAlertDialog(delegate(int nop)
            {
                isOpen = false;
            }, "LOCAL_ERROR_SAVE_DATA_IO");
            while (isOpen)
            {
                yield return(null);
            }
        }
        yield break;
    }
Пример #2
0
	private IEnumerator WaitResponse_DownLoad(AB_DownLoadInfo abdlI, string AB_ROOT_PATH, bool forceDL = false)
	{
		string allPath = AB_ROOT_PATH + abdlI.abPath + abdlI.abInfo.abName;
		uint crc = abdlI.abInfo.crc;
		allPath = allPath + ".unity3d?" + AssetDataMng.assetVersion;
		while (this.isWaitDiskSpaceCheck)
		{
			yield return null;
		}
		this.isWaitDiskSpaceCheck = true;
		yield return base.StartCoroutine(AssetBundleDiskSpaceCheck.CheckDiskSpace(abdlI.abInfo, this));
		this.isWaitDiskSpaceCheck = false;
		this.countDownloadProcess++;
		long assetbundleFileSize = long.Parse(abdlI.abInfo.size);
		this.downloadFileSize += AssetBundleDiskSpaceCheck.GetFileSize(assetbundleFileSize);
		while (!Caching.ready)
		{
			yield return null;
		}
		WWWHelper wwwHelper = WWWHelper.LoadFromCacheOrDownload(allPath, abdlI.ver, crc, 60f);
		bool startDownload = true;
		while (startDownload)
		{
			yield return base.StartCoroutine(wwwHelper.StartDownloadAssetBundle(delegate(WWW www)
			{
				if (abdlI.www != null)
				{
					abdlI.www.Dispose();
				}
				abdlI.www = www;
			}, delegate(WWW resultWWW)
			{
				if (resultWWW == null)
				{
					if (!forceDL)
					{
						this.OpenAlert();
					}
				}
				else if (!string.IsNullOrEmpty(resultWWW.error))
				{
					if (!forceDL && this.isOpenAlert(resultWWW.error))
					{
						this.OpenAlert();
					}
					abdlI.www = resultWWW;
				}
				else
				{
					abdlI.www = resultWWW;
					startDownload = false;
				}
			}));
			while (this.IsStopDownload())
			{
				yield return null;
			}
		}
		this.countDownloadProcess--;
		this.downloadFileSize -= AssetBundleDiskSpaceCheck.GetFileSize(assetbundleFileSize);
		if (!forceDL)
		{
			this.Add_OR_SetRecord(abdlI.abPath, abdlI.abInfo.abName, crc, abdlI.ver);
		}
		if (abdlI.actEndCallBack != null)
		{
			abdlI.actEndCallBack(abdlI.www.assetBundle, abdlI);
		}
		yield break;
	}
    private static bool IsFreeSpace(long writeSize)
    {
        long freeSpace = AssetBundleDiskSpaceCheck.GetFreeSpace(Application.temporaryCachePath);

        return(freeSpace > writeSize);
    }