private ResourceSaveExData doFileSaveData(string front, string fileName, int type) { //本地强制进包 if (!_isReleasePack) { type = ResourceSaveType.InStreamingAsset; } string path = front + "/" + fileName; string md5 = FileUtils.getFileMD5(path); // string md5=_manifest.GetAssetBundleHash(FileUtils.getFileName(fileName)).ToString(); FileInfo fileInfo = new FileInfo(path); ResourceSaveExData lastData = _lastTargetVersion.getBundleEx(fileName); ResourceSaveExData data = new ResourceSaveExData(); data.name = fileName; data.size = fileInfo.Exists ? (int)fileInfo.Length : 0; //强转int,最大支持2G文件 data.saveType = type; data.md5 = md5; if (lastData != null) { if (lastData.md5.Equals(md5)) { data.version = lastData.version; } else { data.version = _newVersion.resourceVersion; } //进包变成不进包 if (ResourceSaveType.isStreamingAsset(lastData.saveType) && !ResourceSaveType.isStreamingAsset(data.saveType)) { //更新资源版本 data.version = _newVersion.resourceVersion; } } else { data.version = _newVersion.resourceVersion; } _newVersion.resourceDic.put(data.name, data); return(data); }
private void doCopyOne(string targetPath, string fileName) { string tt = fileName.Substring(targetPath.Length + 1); ResourceSaveExData data = _newVersion.getBundleEx(tt); //data==null的时候,比如version.bin的情况 //复制到streamingAssets if (data == null || data.saveType == ResourceSaveType.InStreamingAsset) { FileUtils.copyFile(fileName, ShineToolGlobal.streamingAssetsPath + "/" + tt); } bool needCopyToCDN = false; //发布版本 if (_isReleasePack) { //没有数据 或 (是最新版本,并且不是 全更app中的包资源) if (data == null || (data.version == _newVersion.resourceVersion && !(_isAppNeedUpdate && ResourceSaveType.isStreamingAsset(data.saveType)))) { needCopyToCDN = true; } } if (needCopyToCDN) { FileUtils.copyFile(fileName, getTargetCDNSourcePath() + "/resource_" + _newVersion.resourceVersion + "/" + tt); } }