public bool Load(string bundleName) { this.Begin(); string bundlePath = AssetPath.LocalBundlePath(bundleName); byte[] data = XFile.ReadBytesFile(bundlePath); Autarky.Signature sig_v3; if (Autarky.Load(ref data, out sig_v3)) { try { this.bundle = AssetBundle.LoadFromMemory(data); this.done = true; return(true); } catch (System.Exception e) { this.error = e.Message; this.done = true; return(false); } } else { this.error = Autarky.error; this.done = true; return(false); } }
public IEnumerator LoadAsync(string bundleName) { this.Begin(); string bundlePath = AssetPath.LocalBundlePath(bundleName); string bundleURI = AssetPath.LocalBundleURI(bundleName); if (!System.IO.File.Exists(bundlePath)) { bundleURI = AssetPath.StreamBundleURI(bundleName); } WWW www = new WWW(bundleURI); yield return(www); if (!string.IsNullOrEmpty(www.error)) { this.error = www.error; this.done = true; yield break; } byte[] data = www.bytes; Autarky.Signature sig; if (Autarky.Load(ref data, out sig)) { if (sig.enableEncrypt) { var req = AssetBundle.LoadFromMemoryAsync(data); yield return(req); this.bundle = req.assetBundle; this.done = true; } else { this.bundle = www.assetBundle; this.done = true; yield break; } } else { this.error = Autarky.error; this.done = true; yield break; } }