2009-11-10 16:48:42 +01:00
|
|
|
#ifndef _RAR_RAWREAD_
|
|
|
|
#define _RAR_RAWREAD_
|
|
|
|
|
|
|
|
class RawRead
|
|
|
|
{
|
|
|
|
private:
|
|
|
|
Array<byte> Data;
|
|
|
|
File *SrcFile;
|
|
|
|
size_t DataSize;
|
|
|
|
size_t ReadPos;
|
|
|
|
CryptData *Crypt;
|
|
|
|
public:
|
2020-07-15 00:40:26 +02:00
|
|
|
RawRead();
|
2009-11-10 16:48:42 +01:00
|
|
|
RawRead(File *SrcFile);
|
2020-07-15 00:40:26 +02:00
|
|
|
void Reset();
|
|
|
|
size_t Read(size_t Size);
|
2009-11-10 16:48:42 +01:00
|
|
|
void Read(byte *SrcData,size_t Size);
|
2020-07-15 00:40:26 +02:00
|
|
|
byte Get1();
|
|
|
|
ushort Get2();
|
|
|
|
uint Get4();
|
|
|
|
uint64 Get8();
|
|
|
|
uint64 GetV();
|
|
|
|
uint GetVSize(size_t Pos);
|
|
|
|
size_t GetB(void *Field,size_t Size);
|
|
|
|
void GetW(wchar *Field,size_t Size);
|
|
|
|
uint GetCRC15(bool ProcessedOnly);
|
|
|
|
uint GetCRC50();
|
|
|
|
byte* GetDataPtr() {return &Data[0];}
|
2009-11-10 16:48:42 +01:00
|
|
|
size_t Size() {return DataSize;}
|
|
|
|
size_t PaddedSize() {return Data.Size()-DataSize;}
|
2020-07-15 00:40:26 +02:00
|
|
|
size_t DataLeft() {return DataSize-ReadPos;}
|
|
|
|
size_t GetPos() {return ReadPos;}
|
|
|
|
void SetPos(size_t Pos) {ReadPos=Pos;}
|
|
|
|
void Skip(size_t Size) {ReadPos+=Size;}
|
|
|
|
void Rewind() {SetPos(0);}
|
2009-11-10 16:48:42 +01:00
|
|
|
void SetCrypt(CryptData *Crypt) {RawRead::Crypt=Crypt;}
|
|
|
|
};
|
|
|
|
|
2020-07-15 00:40:26 +02:00
|
|
|
uint64 RawGetV(const byte *Data,uint &ReadPos,uint DataSize,bool &Overflow);
|
|
|
|
|
2009-11-10 16:48:42 +01:00
|
|
|
#endif
|