private void LoadBundleFile(string path) { OpenBundleDialog openFile = new OpenBundleDialog(helper, path); openFile.ShowDialog(); if (openFile.selection > -1) { AssetBundleFile bundleFile = openFile.file; List <byte[]> files = BundleHelper.LoadAllAssetsDataFromBundle(bundleFile); if (files.Count > 0) { if (files.Count > 1) { for (int i = 1; i < files.Count; i++) { MemoryStream stream = new MemoryStream(files[i]); string name = bundleFile.bundleInf6.dirInf[i].name; helper.LoadAssetsFile(stream, name, openFile.selection == 1); } } MemoryStream mainStream = new MemoryStream(files[0]); string mainName = bundleFile.bundleInf6.dirInf[0].name; LoadMainAssetsFile(helper.LoadAssetsFile(mainStream, mainName, openFile.selection == 1)); } else { MessageBox.Show("No valid assets files found in the bundle.", "Assets View"); } } }
private void LoadBundleFile(string path) { OpenBundleDialog openFile = new OpenBundleDialog(helper, path); openFile.ShowDialog(); if (openFile.selection > -1) { AssetBundleFile bundleFile = openFile.file; BundleFileInstance bundleInst = openFile.inst; List <byte[]> files = BundleHelper.LoadAllAssetsDataFromBundle(bundleFile); string rootPath = Path.GetDirectoryName(openFile.inst.path); if (files.Count > 0) { int mainIndex = -1; for (int i = 0; i < files.Count; i++) { if (files[i] == null) { continue; } if (mainIndex == -1) { mainIndex = i; } else { MemoryStream stream = new MemoryStream(files[i]); string name = bundleFile.bundleInf6.dirInf[i].name; AssetsFileInstance inst = helper.LoadAssetsFile(stream, name, openFile.selection == 1, rootPath); inst.parentBundle = bundleInst; } } //if (files.Count > 1) //{ // for (int i = 1; i < files.Count; i++) // { // MemoryStream stream = new MemoryStream(files[i]); // string name = bundleFile.bundleInf6.dirInf[i].name; // AssetsFileInstance inst = helper.LoadAssetsFile(stream, name, openFile.selection == 1, rootPath); // inst.parentBundle = bundleInst; // } //} //MemoryStream mainStream = new MemoryStream(files[0]); //string mainName = bundleFile.bundleInf6.dirInf[0].name; //AssetsFileInstance mainInst = helper.LoadAssetsFile(mainStream, mainName, openFile.selection == 1, rootPath); //mainInst.parentBundle = bundleInst; MemoryStream mainStream = new MemoryStream(files[mainIndex]); string mainName = bundleFile.bundleInf6.dirInf[mainIndex].name; AssetsFileInstance mainInst = helper.LoadAssetsFile(mainStream, mainName, openFile.selection == 1, rootPath); mainInst.parentBundle = bundleInst; LoadMainAssetsFile(mainInst); if (openFile.selection == 1) { helper.LoadAssetsFile(currentFile.stream, currentFile.path, true); UpdateDependencies(); } } else { MessageBox.Show("No valid assets files found in the bundle.", "Assets View"); } } }