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 Export(Stream stream)
        {
            byte[] data;
            ErpBinaryReader reader = new ErpBinaryReader(EndianBitConverter.Little, this.ParentFile.ErpStream);
            reader.Seek((int)(this.ParentFile.EntryOffset + this.Offset) + 2, SeekOrigin.Begin);
            data = reader.ReadBytes((int)this.PackedSize);

            if (this.Compression == 1)
            {
                data = this.Decompress(data);
            }

            using (ErpBinaryWriter writer = new ErpBinaryWriter(EndianBitConverter.Little, stream))
            {
                writer.Write(data);
            }
        }
        public void Read(ErpBinaryReader reader)
        {
            reader.ReadBytes(4); // entry info length
            this.FileName = reader.ReadString(reader.ReadInt16());
            this.EntryType = reader.ReadString(16);

            this.Unknown = reader.ReadInt32();

            byte numResources = reader.ReadByte();

            while (numResources-- > 0)
            {
                ErpResource res = new ErpResource(this.ParentFile);
                res.Read(reader);
                this.Resources.Add(res);
            }

            if (this.ParentFile.Version > 2)
            {
                this.Hash = reader.ReadBytes(16);
            }
        }
        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;
            }
        }