///void Free(); public void Read(long filePos, AssetsFileReader reader) { reader.Position = filePos; checksumLow = reader.ReadUInt64(); checksumHigh = reader.ReadUInt64(); blockCount = reader.ReadInt32(); blockInf = new AssetBundleBlockInfo06[blockCount]; for (int i = 0; i < blockCount; i++) { blockInf[i] = new AssetBundleBlockInfo06(); blockInf[i].decompressedSize = reader.ReadUInt32(); blockInf[i].compressedSize = reader.ReadUInt32(); blockInf[i].flags = reader.ReadUInt16(); } directoryCount = reader.ReadInt32(); dirInf = new AssetBundleDirectoryInfo06[directoryCount]; for (int i = 0; i < directoryCount; i++) { dirInf[i] = new AssetBundleDirectoryInfo06(); dirInf[i].offset = reader.ReadInt64(); dirInf[i].decompressedSize = reader.ReadInt64(); dirInf[i].flags = reader.ReadUInt32(); dirInf[i].name = reader.ReadNullTerminated(); } }
public static AssetBundleFile CreateBlankBundle(string engineVersion, int contentSize) { AssetBundleHeader06 header = new AssetBundleHeader06() { signature = "UnityFS", fileVersion = 6, minPlayerVersion = "5.x.x", fileEngineVersion = engineVersion, totalFileSize = 0x82 + engineVersion.Length + contentSize, compressedSize = 0x5B, decompressedSize = 0x5B, flags = 0x40 }; AssetBundleBlockInfo06 blockInf = new AssetBundleBlockInfo06 { decompressedSize = (uint)contentSize, compressedSize = (uint)contentSize, flags = 0x0040 }; AssetBundleDirectoryInfo06 dirInf = new AssetBundleDirectoryInfo06 { offset = 0, decompressedSize = (uint)contentSize, flags = 4, name = GenerateCabName() }; AssetBundleBlockAndDirectoryList06 info = new AssetBundleBlockAndDirectoryList06() { checksumLow = 0, checksumHigh = 0, blockCount = 1, blockInf = new AssetBundleBlockInfo06[] { blockInf }, directoryCount = 1, dirInf = new AssetBundleDirectoryInfo06[] { dirInf } }; AssetBundleFile bundle = new AssetBundleFile() { bundleHeader6 = header, bundleInf6 = info }; return(bundle); }