private void ReadScheme() { using (PartialStream stream = new PartialStream(m_stream, m_offset, m_size)) { using (EndianReader reader = new EndianReader(stream, EndianType.BigEndian)) { Header.Read(reader); } EndianType endianess = EndianType.LittleEndian; if (SerializedFileHeader.HasEndian(Header.Generation)) { endianess = Header.SwapEndianess ? EndianType.BigEndian : EndianType.LittleEndian; } using (SerializedReader reader = new SerializedReader(stream, endianess, Name, Header.Generation)) { if (SerializedFileMetadata.IsMetadataAtTheEnd(reader.Generation)) { reader.BaseStream.Position = Header.FileSize - Header.MetadataSize; reader.BaseStream.Position++; } Metadata.Read(reader); } } SerializedFileMetadataConverter.CombineFormats(Header.Generation, Metadata); RTTIClassHierarchyDescriptorConverter.FixResourceVersion(Name, ref Metadata.Hierarchy); #warning TEMP HACK if (Metadata.Hierarchy.Platform == Platform.NoTarget) { Flags = TransferInstructionFlags.NoTransferInstructionFlags; } if (FilenameUtils.IsEngineResource(Name) || Header.Generation < FileGeneration.FG_500a1 && FilenameUtils.IsBuiltinExtra(Name)) { Flags |= TransferInstructionFlags.IsBuiltinResourcesFile; } if (Header.SwapEndianess) { Flags |= TransferInstructionFlags.SwapEndianess; } }
private void ReadScheme() { using (EndianReader reader = new EndianReader(Stream, EndianType.BigEndian)) { Header.Read(reader); } if (SerializedFileMetadata.IsMetadataAtTheEnd(Header.Generation)) { Stream.Position = Header.FileSize - Header.MetadataSize; Stream.Position++; } using (SerializedReader reader = new SerializedReader(Stream, Header.GetEndianType(), Name, Header.Generation)) { Metadata.Read(reader); } SerializedFileMetadataConverter.CombineFormats(Header.Generation, Metadata); RTTIClassHierarchyDescriptorConverter.FixResourceVersion(Name, ref Metadata.Hierarchy); UpdateFlags(); }