rawread.hpp 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. #ifndef _RAR_RAWREAD_
  2. #define _RAR_RAWREAD_
  3. class RawRead
  4. {
  5. private:
  6. Array<byte> Data;
  7. File *SrcFile;
  8. size_t DataSize;
  9. size_t ReadPos;
  10. CryptData *Crypt;
  11. public:
  12. RawRead();
  13. RawRead(File *SrcFile);
  14. void Reset();
  15. size_t Read(size_t Size);
  16. void Read(byte *SrcData,size_t Size);
  17. byte Get1();
  18. ushort Get2();
  19. uint Get4();
  20. uint64 Get8();
  21. uint64 GetV();
  22. uint GetVSize(size_t Pos);
  23. size_t GetB(void *Field,size_t Size);
  24. void GetW(wchar *Field,size_t Size);
  25. uint GetCRC15(bool ProcessedOnly);
  26. uint GetCRC50();
  27. byte* GetDataPtr() {return &Data[0];}
  28. size_t Size() {return DataSize;}
  29. size_t PaddedSize() {return Data.Size()-DataSize;}
  30. size_t DataLeft() {return DataSize-ReadPos;}
  31. size_t GetPos() {return ReadPos;}
  32. void SetPos(size_t Pos) {ReadPos=Pos;}
  33. void Skip(size_t Size) {ReadPos+=Size;}
  34. void Rewind() {SetPos(0);}
  35. void SetCrypt(CryptData *Crypt) {RawRead::Crypt=Crypt;}
  36. };
  37. uint64 RawGetV(const byte *Data,uint &ReadPos,uint DataSize,bool &Overflow);
  38. #endif