public bool CheckMd5(WWWType type, string url) { WWWFileInfo fileIfo = GetFileInfo(type, url); if (fileIfo == null) { return(false); } string nowMd5 = GetFileMd5(fileIfo.localPath); return(string.Compare(nowMd5, fileIfo.md5, System.StringComparison.OrdinalIgnoreCase) == 0); }
public T TryLoadFromCache <T>(WWWType type, string url) where T : UnityEngine.Object { if (mAssetPool != null) { T t = mAssetPool.Get <T>(url); if (t != null) { return(t); } } if (HasResource(type, url)) { WWWFileInfo fileInfo = GetFileInfo(type, url); if (fileInfo != null) { string filePath = fileInfo.localPath; byte[] bytes = GameUtils.ReadAllBytesFromFile(filePath); if (typeof(T) == typeof(Texture2D)) { Texture2D tex = GameUtils.GetTextureFromBytes(bytes); tex.Apply(false, true); if (tex != null && mAssetPool != null) { tex.name = url; mAssetPool.AddAsset(url, tex); } return(tex as T); } } } return(default(T)); }