public unsafe static void Destroy() { Marshal.FreeHGlobal((IntPtr)(void *)m_pData); m_pData = null; p_assetinfo = null; p_bundleinfo = null; }
public unsafe static void Setup(byte[] bytes) { fileLength = bytes.Length; IntPtr p = Marshal.AllocHGlobal(bytes.Length); Marshal.Copy(bytes, 0, p, bytes.Length); m_pData = (byte *)(void *)p; m_Position = 0; PackageListHeader = read_chars(3); PackageListVersion = read_byte(); encryptBytes = read_bytes(4); applicableGameVersionBytes = read_bytes(read_byte()); InternalResourceVersion = read_int(); AssetCount = read_int(); AssetBundleCount = read_int(); assert_Blob = read_int(); arr_Blob = read_int(); ab_Blob = read_int(); conflic_Blob = read_int(); p_assetinfo = (BaseAssetInfo *)(m_pData + assert_Blob); crcIndexer = new Dictionary <uint, int>(AssetCount); List <uint> conflic_asset = new List <uint>(); for (int i = 0; i < AssetCount; i++) { BaseAssetInfo info = p_assetinfo[i]; if (crcIndexer.ContainsKey(info.asset_crc)) { if (!conflic_asset.Contains(info.asset_crc)) { conflic_asset.Add(info.asset_crc); } } else { crcIndexer.Add(info.asset_crc, i); } } foreach (uint crc in conflic_asset) { crcIndexer.Remove(crc); } p_bundleinfo = (BaseBundleInfo *)(m_pData + ab_Blob); if (conflic_asset_abindex != null) { conflic_asset_abindex.Clear(); conflic_asset_abindex = null; } }