Esempio n. 1
0
        public override void LoadFromBinaryReader(System.IO.Stream binaryReader)
        {
            base.LoadFromBinaryReader(binaryReader);

            Value   = binaryReader.ReadByte1();
            Padding = binaryReader.ReadByte1();
        }
Esempio n. 2
0
        public override void LoadFromBinaryReader(System.IO.Stream binaryReader)
        {
            base.LoadFromBinaryReader(binaryReader);

            int numStrips = _imageSize.Width / 8;

            Strips = new List <StripData>(numStrips);

            for (int i = 0; i < numStrips; i++)
            {
                var strip = new StripData();
                strip.OffSet = binaryReader.ReadUint32();

                Strips.Add(strip);
            }

            int stripSize;

            for (int i = 0; i < (numStrips - 1); i++)
            {
                //O tamanho do strip é determinando pegando a posição do próximo Strip - 1 (pois o primeiro byte tem as informações do CODEC)
                //e subtraindo da posição do Strip atual.
                stripSize = (int)((Strips[i + 1].OffSet - Strips[i].OffSet) - 1);

                Strips[i].CodecId   = binaryReader.ReadByte1();
                Strips[i].ImageData = binaryReader.ReadBytes(stripSize);
            }

            if (Strips.Count > 0) //Sam & Max has at least one ROOM that contains only palette and ZPlanes, but no images.
            {
                stripSize = (int)((BlockSize - Strips[Strips.Count - 1].OffSet) - 1);
                Strips[Strips.Count - 1].CodecId   = binaryReader.ReadByte1();
                Strips[Strips.Count - 1].ImageData = binaryReader.ReadBytes(stripSize);
            }
        }
Esempio n. 3
0
        public override void LoadFromBinaryReader(System.IO.Stream binaryReader)
        {
            base.LoadFromBinaryReader(binaryReader);

            NumOfRooms = binaryReader.ReadByte1();

            Rooms = new List <RoomOffsetTableItem>();
            for (int i = 0; i < NumOfRooms; i++)
            {
                var room = new RoomOffsetTableItem();
                room.Id     = binaryReader.ReadByte1();
                room.OffSet = binaryReader.ReadUint32();

                Rooms.Add(room);
            }
        }
Esempio n. 4
0
        public override void LoadFromBinaryReader(System.IO.Stream binaryReader)
        {
            base.LoadFromBinaryReader(binaryReader);

            Rooms      = new List <DirectoryItem>();
            NumOfItems = binaryReader.ReadUint16();
            for (int i = 0; i < NumOfItems; i++)
            {
                var room = new DirectoryItem();
                room.Number = binaryReader.ReadByte1();
                Rooms.Add(room);
            }
            for (int i = 0; i < NumOfItems; i++)
            {
                Rooms[i].Offset = binaryReader.ReadUint32();
            }
        }
Esempio n. 5
0
        public void Read(System.IO.Stream stream)
        {
            byte[] buf        = stream.ReadByte4();
            var    str        = System.Text.Encoding.ASCII.GetString(buf);
            var    magiccheck = "\u007fELF";

            if (str != magiccheck)
            {
                throw new Exception("Not a ELF file.");
            }
            this.Head_Magic = str;

            var classtype = stream.ReadByte();

            if (classtype == 1)
            {
                Head_Is64Bit = false;
            }
            else if (classtype == 2)
            {
                Head_Is64Bit = true;
            }
            else
            {
                throw new Exception("Error ClassType =" + classtype);
            }
            var endianess = stream.ReadByte1();

            if (endianess == 1)
            {
                Head_IsLittleEndian = true;
            }
            else if (endianess == 2)
            {
                Head_IsLittleEndian = false;
            }
            else
            {
                throw new Exception("Error Endianess =" + endianess);
            }

            Head_Version     = stream.ReadByte1();
            this.Head_Unuse9 = stream.ReadBytes(9);



            Head_Type        = (FileType)stream.ReadUInt16(this);
            Head_Machine     = (MachineType)stream.ReadUInt16(this);
            Head_FileVersion = stream.ReadUInt32(this);
            if (Head_FileVersion != 1)
            {
                throw new ArgumentException("unknown version" + Head_FileVersion);
            }
            Head_EntryPoint              = stream.ReadUIntPtr(this);
            Head_SegmentHeaderOffset     = stream.ReadUIntPtr(this);
            Head_SectionHeaderOffset     = stream.ReadUIntPtr(this);
            Head_MachineFlags            = stream.ReadUInt32(this);
            Head_ELFHeadSize             = stream.ReadUInt16(this); // elf header size
            Head_SegmentHeaderEntrySize  = stream.ReadUInt16(this);
            Head_SegmentHeaderEntryCount = stream.ReadUInt16(this);
            Head_SectionHeaderEntrySize  = stream.ReadUInt16(this);
            Head_SectionHeaderEntryCount = stream.ReadUInt16(this);
            Head_StringTableIndex        = stream.ReadUInt16(this);
        }