/// <summary> /// 下载记录主资源或补丁列表的文件列表 /// </summary> /// <param name="info"></param> /// <returns></returns> private IEnumerator GetFilePatchCache(FilePatchInfo info) { if (info.isNeedDownFile) { ActionState(State.DownPathList); yield return(Access.FromRemote(info.fileUrl, res => { if (res == null) { return; } var hash = res.MD5(); if (info.IsEncrypt()) { if (hash != info.encrypt_hash) { return; } } else { if (hash != info.content_hash) { return; } } File.WriteAllBytes(info.fileLocal, res); })); } ActionState(State.GetPatchList); MinVersion = Math.Min(MinVersion, info.firstVersion); MaxVersion = Math.Max(MaxVersion, info.lastVersion); if (File.Exists(info.fileLocal)) { byte[] bytes = File.ReadAllBytes(info.fileLocal); if (bytes.Length == 0) { yield break; } ActionState(State.ApplyPatchList); string content = info.IsEncrypt() ? bytes.AES_Dencrypt() : Encoding.UTF8.GetString(bytes); patchCache[info.fileUrl] = Library.Helper.JsonHelper.ToObject <FileVersion.FileDetailInfo[]>( content.Trim()) .Select(p => new FileDetailInfo(info, p)) .ToDictionary(p => p.path); } else { Debug.LogError("file is not exist! " + info.fileLocal); } }