Ejemplo n.º 1
0
        public void Read(Stream stream)
        {
            ErpBinaryReader reader = new ErpBinaryReader(EndianBitConverter.Little, stream);
            uint magic = reader.ReadUInt32();
            if (magic != 1263555141)
            {
                throw new Exception("This is not an ERP file!");
            }

            this.Version = reader.ReadInt32();
            reader.ReadBytes(8); // padding
            reader.ReadBytes(8); // info offset
            reader.ReadBytes(8); // info size

            this.EntryOffset = reader.ReadUInt64();
            reader.ReadBytes(8); // padding

            Int32 numFiles = reader.ReadInt32();
            Int32 numTempFile = reader.ReadInt32();

            for (int i = 0; i < numFiles; ++i)
            {
                ErpEntry entry = new ErpEntry(this);
                entry.Read(reader);
                this.Entries.Add(entry);
            }

            this._erpStream = stream;
        }
        public void Read(ErpBinaryReader reader)
        {
            this.Name = reader.ReadString(4);

            this.Offset = reader.ReadUInt64();
            this.Size = reader.ReadUInt64();
            this.Flags = reader.ReadInt32();

            if (this.ParentFile.Version > 2)
            {
                this.Compression = reader.ReadByte();
                this.PackedSize = reader.ReadUInt64();
            }
            else
            {
                this.PackedSize = this.Size;
            }
        }