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); }
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(); }
void LoadRaw(AssetReader reader) { Type = reader.ReadCString(); Name = reader.ReadCString(); Size = reader.ReadInt32(); Index = reader.ReadUInt32(); IsArray = reader.ReadInt32() != 0; Version = reader.ReadInt32(); Flags = reader.ReadInt32(); int count = reader.ReadInt32(); for (int i = 0; i < count; ++i) { var child = new TypeTree(m_format); child.Load(reader); Children.Add(child); } }
public void Load(AssetReader reader) { int format = reader.Format; m_version = reader.ReadCString(); var platform = reader.ReadInt32(); if (format >= 13) { bool has_type_trees = reader.ReadBool(); int count = reader.ReadInt32(); for (int i = 0; i < count; ++i) { int class_id = reader.ReadInt32(); if (format >= 17) { reader.ReadByte(); int script_id = reader.ReadInt16(); if (114 == class_id) { if (script_id >= 0) { class_id = -2 - script_id; } else { class_id = -1; } } } m_class_ids.Add(class_id); byte[] hash = reader.ReadBytes(class_id < 0 ? 0x20 : 0x10); m_hashes[class_id] = hash; if (has_type_trees) { var tree = new TypeTree(format); tree.Load(reader); m_type_trees[class_id] = tree; } } } else { int count = reader.ReadInt32(); for (int i = 0; i < count; ++i) { int class_id = reader.ReadInt32(); var tree = new TypeTree(format); tree.Load(reader); m_type_trees[class_id] = tree; } } }