public void Load(AssetReader input) { input.ReadInt32(); // header_size input.ReadUInt32(); // file_size m_format = input.ReadInt32(); m_data_offset = input.ReadUInt32(); if (m_format >= 9) { m_is_little_endian = 0 == input.ReadInt32(); } if (m_format >= 22) { input.ReadInt32(); // header_size input.ReadInt64(); // file_size m_data_offset = input.ReadInt64(); input.ReadInt64(); } input.SetupReaders(this); m_tree.Load(input); bool long_ids = Format >= 14; if (Format >= 7 && Format < 14) { long_ids = 0 != input.ReadInt32(); } input.SetupReadId(long_ids); int obj_count = input.ReadInt32(); for (int i = 0; i < obj_count; ++i) { input.Align(); var obj = new UnityObject(this); obj.Load(input); RegisterObject(obj); } if (Format >= 11) { int count = input.ReadInt32(); m_adds = new Dictionary <long, int> (count); for (int i = 0; i < count; ++i) { input.Align(); var id = input.ReadId(); m_adds[id] = input.ReadInt32(); } } if (Format >= 6) { int count = input.ReadInt32(); m_refs = new List <AssetRef> (count); for (int i = 0; i < count; ++i) { var asset_ref = AssetRef.Load(input); m_refs.Add(asset_ref); } } input.ReadCString(); }
public static AssetRef Load(AssetReader reader) { var r = new AssetRef(); r.AssetPath = reader.ReadCString(); r.Guid = new Guid(reader.ReadBytes(16)); r.Type = reader.ReadInt32(); r.FilePath = reader.ReadCString(); r.Asset = null; return(r); }