public IEnumerator InitStart(List <string> resourcesCacheList, List <string> streamingAssetsCachelist) { //Resources载入缓存 foreach (var path in resourcesCacheList) { mainCache[path] = new FileDetailInfo(path, FileDetailInfo.DataType.ResourcesDataPath); } //StreamingAssets载入缓存 foreach (var path in streamingAssetsCachelist) { mainCache[path] = new FileDetailInfo(path, FileDetailInfo.DataType.StreamingAssetsPath); } //PersistentDataPath载入缓存 foreach (var info in filePatchList) { if (LastAccessInfo != null && info.firstVersion != LastAccessInfo.lastVersion) { yield break; } yield return(GetFilePatchCache(info)); LastAccessInfo = info; } foreach (var pair in patchCache) { foreach (var patch in pair.Value) { mainCache[patch.Key] = patch.Value; } } yield return(ResourceDelete()); yield return(ResourceDownLoad()); }
public string getFileDetails(string fileFolder, string filePath, FileDetailInfo infotype) { string strReturnval = ""; try { Shell32.Shell fileshell = new Shell32.Shell(); Shell32.Folder fileshellfolder = fileshell.NameSpace(fileFolder); Shell32.FolderItem Item = fileshellfolder.ParseName(filePath); strReturnval = fileshellfolder.GetDetailsOf(Item, (int)infotype); } catch (Exception ex) { errorException = ex; } return(strReturnval); }
private IEnumerator LoadObject(string path, Action <byte[], UnityEngine.Object> callAction) { string hash = Access.PathConvertToMd5(path, KeyMd5); foreach (var cache in patchListCache.Values) { FileDetailInfo resInfo = null; if (!cache.mainCache.TryGetValue(hash, out resInfo)) { continue; } if (resInfo.is_delete) { Debug.LogError("访问不在资源版本库中的资源!"); yield break; } if (!resInfo.is_ready) { Debug.LogError("访问未准备好的资源!"); yield break; } switch (resInfo.dataType) { case FileDetailInfo.DataType.ResourcesDataPath: callAction.Invoke(null, Resources.Load(path)); yield break; case FileDetailInfo.DataType.StreamingAssetsPath: yield return(Access.FromStreamingAssetsPath(path, www => { callAction.Invoke(www, null); })); yield break; default: yield return(Access.FromPersistentDataTempPath(resInfo.path, www => { callAction.Invoke(www, null); })); yield break; } } Debug.LogError("无效资源!"); callAction.Invoke(null, null); }