예제 #1
0
        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;
            }
        }
예제 #2
0
        public EndianType GetEndianType()
        {
            bool swapEndianess = SerializedFileHeader.HasEndian(Header.Generation) ? Header.SwapEndianess : Metadata.SwapEndianess;

            return(swapEndianess ? EndianType.BigEndian : EndianType.LittleEndian);
        }