/// <summary> /// 检查远程resVer,并存储下来 /// </summary> private void CheckRemoteResVer() { //从remote读取resVer Utils.SB.Append(UpdateMgr.RemoteCdnUrl); Utils.SB.Append("/"); Utils.SB.Append(UnityUtil.CurPlatform); Utils.SB.Append("/resVer.txt"); string remoteResVerPath = Utils.SB.ToString(); Utils.ClearSB(); Action <byte[]> onSuccess = (bs) => { UpdateMgr.RemoteResVer = TypeConvertUtils.Bytes2String(bs); LogMgr.I("DownloadRes", "CheckRemoteResVer", "获取remote resVer成功 resVer;" + UpdateMgr.RemoteResVer, BeShowLog); SetState(DownloadResState.checkPersistDownloadingRes); }; Action <string> onFaile = (error) => { LogMgr.E("DownloadRes", "CheckRemoteResVer", "下载流程中断,获取remote resVer失败;" + remoteResVerPath, BeShowLog); }; LogMgr.I("DownloadRes", "CheckRemoteResVer", "开始获取remote resVer url;" + remoteResVerPath, BeShowLog); FileHelper.GetIns().ReadBytesFromApkFile(remoteResVerPath, onSuccess, onFaile); }
/// <summary> /// 读取stream中resVer /// </summary> private void CheckStreamResVer() { Utils.SB.Append(UnityUtil.StreamingAssetsPath); Utils.SB.Append("/resVer.txt"); string streamResVerPath = Utils.SB.ToString(); Utils.ClearSB(); LogMgr.I("UnCompress", "CheckStreamResVer", "开始读取包内resVer path:" + streamResVerPath, BeShowLog); Action <byte[]> onSuccess = (bs) => { UpdateMgr.StreamResVer = TypeConvertUtils.Bytes2String(bs); LogMgr.I("UnCompress", "CheckStreamResVer", "读取到包内resVer:" + UpdateMgr.StreamResVer, BeShowLog); SetState(UnCompressState.compareResVerPersist_Stream); }; Action <string> onFaile = (error) => { LogMgr.E("UnCompress", "CheckStreamResVer", " 解压流程中断 onFaile error:" + error, BeShowLog); }; FileHelper.GetIns().ReadBytesFromApkFile(streamResVerPath, onSuccess, onFaile); }