private void ReadAssets(EndianStream stream, long startPosition) { m_assets.Clear(); HashSet <long> preloaded = new HashSet <long>(); using (AssetStream ustream = new AssetStream(stream.BaseStream, Version, Platform)) { if (SerializedFileMetadata.IsReadPreload(Header.Generation)) { foreach (ObjectPtr ptr in Metadata.Preloads) { if (ptr.FileID == 0) { ObjectInfo info = Metadata.Objects[ptr.PathID]; ReadAsset(ustream, info, startPosition); preloaded.Add(ptr.PathID); } } } foreach (ObjectInfo info in Metadata.Objects.Values) { if (!preloaded.Contains(info.PathID)) { ReadAsset(ustream, info, startPosition); } } } }
private void ReadAssets(EndianStream stream, long startPosition) { m_assets.Clear(); HashSet <long> preloaded = new HashSet <long>(); using (AssetStream ustream = new AssetStream(stream.BaseStream, Version, Platform, Flags)) { if (SerializedFileMetadata.IsReadPreload(Header.Generation)) { foreach (ObjectPtr ptr in Metadata.Preloads) { if (ptr.FileID == 0) { AssetEntry info = Metadata.Objects[ptr.PathID]; ReadAsset(ustream, info, startPosition); preloaded.Add(ptr.PathID); } } } foreach (KeyValuePair <long, AssetEntry> infoPair in Metadata.Objects) { ClassIDType classID = AssetEntryToClassIDType(infoPair.Value); if (classID == ClassIDType.MonoScript) { if (!preloaded.Contains(infoPair.Key)) { ReadAsset(ustream, infoPair.Value, startPosition); preloaded.Add(infoPair.Key); } } } foreach (AssetEntry info in Metadata.Objects.Values) { if (!preloaded.Contains(info.PathID)) { ReadAsset(ustream, info, startPosition); } } } }