private static void LoadInnerRes() { TextAsset tmpTextAsset = Resources.Load <TextAsset>(FileHelper.ResVersionFileCRC.ToString()); if (null == tmpTextAsset) { Logger.LogError($"加载文件版本信息文件 {FileHelper.ResVersionFileCRC} 失败!"); return; } VersionData tmpResVersionData = VersionData.LoadVersionData(tmpTextAsset.bytes); tmpTextAsset = Resources.Load <TextAsset>(tmpResVersionData.ResDescCrc.ToString()); if (null == tmpTextAsset) { Logger.LogError($"加载文件列表信息文件 {tmpResVersionData.ResDescCrc} 失败!"); return; } mResKey2InfoFlagDict = LoadResDescInfo(tmpTextAsset.bytes); }
//加载版本描述 protected virtual void LoadVersionFile(byte[] data) { //服务器上的VersionData mServerVersionData = VersionData.LoadVersionData(data); //加载包内VersionData TextAsset tmpApkTextAsset = Resources.Load <TextAsset>(VersionFile); if (tmpApkTextAsset != null) { mApkVersionData = VersionData.LoadVersionData(tmpApkTextAsset.bytes); } //加载本地VersionData string tmpLocalVersionPath = $"{mLocalPath}/{VersionFile}"; if (File.Exists(tmpLocalVersionPath)) { byte[] localData = FileHelper.ReadFile(tmpLocalVersionPath); mLocalVersionData = VersionData.LoadVersionData(localData); } if (!mServerVersionData.initalize || !mApkVersionData.initalize) { Logger.LogError("加载code的Version:" + VersionFile + "失败"); Failed(); return; } //需要强更客户端 if (mApkVersionData.major != mServerVersionData.major) { ForceUpdateClient(); return; } do { //包内版本数据相同 if (mApkVersionData.ResDescCrc == mServerVersionData.ResDescCrc) { TextAsset tmpTextAsset = Resources.Load(mApkVersionData.ResDescCrc.ToString()) as TextAsset; if (null != tmpTextAsset) { LoadDescribe(tmpTextAsset.bytes, EPosType.ApkInner); } else { Failed(); } break; } string tmpFileListPath = $"{mLocalPath}/{mServerVersionData.ResDescCrc}"; //本地版本数据相同且资源存在 if (null != mLocalVersionData && mLocalVersionData.ResDescCrc == mServerVersionData.ResDescCrc && File.Exists(tmpFileListPath)) { byte[] tmpLocalDescData = FileHelper.ReadFile(tmpFileListPath); if (null != tmpLocalDescData) { LoadDescribe(tmpLocalDescData, EPosType.Local); } else { Failed(); } break; } Save(data, VersionFile); DownloadDescribeFileAsync(); } while (false); }