void LoadFromStreamImpl() { var path = SamplePathUtility.GetAssetBundlePath(CurrentCompressType, IsEncrypt); GC.Collect(); Profiler.BeginSample($" >>> LoadFromStream {CurrentCompressType}, {IsEncrypt}"); if (IsEncrypt) { using (var reader = new FileStream(path, FileMode.Open)) using (var cryptStream = new SeekableAesStream(reader, EncryptHelper.Password, EncryptHelper.UniqueSalt)) { var bundle = AssetBundle.LoadFromStream(cryptStream); ApplyImages(bundle); } } else { using (var reader = new FileStream(path, FileMode.Open)) { var bundle = AssetBundle.LoadFromStream(reader); ApplyImages(bundle); } } Profiler.EndSample(); }
void LoadFromMemoryImpl() { var path = SamplePathUtility.GetAssetBundlePath(CurrentCompressType, IsEncrypt); GC.Collect(); Profiler.BeginSample($" >>> LoadFromMemory {CurrentCompressType}, {IsEncrypt}"); byte[] bytes = null; bytes = IsEncrypt ? EncryptHelper.DecryptBinary(path) : File.ReadAllBytes(path); var bundle = AssetBundle.LoadFromMemory(bytes); ApplyImages(bundle); Profiler.EndSample(); }
void LoadFromFileImpl() { var path = SamplePathUtility.GetAssetBundlePath(CurrentCompressType, IsEncrypt); GC.Collect(); Profiler.BeginSample($" >>> LoadFromFile {CurrentCompressType}, {IsEncrypt}"); if (IsEncrypt) { Debug.LogWarning("暗号化非対応"); return; } var bundle = AssetBundle.LoadFromFile(path); ApplyImages(bundle); Profiler.EndSample(); }