1 #ifndef _RAR_DATAIO_ 2 #define _RAR_DATAIO_ 3 4 class CmdAdd; 5 class Unpack; 6 7 8 class ComprDataIO 9 { 10 private: 11 void ShowUnpRead(int64 ArcPos,int64 ArcSize); 12 void ShowUnpWrite(); 13 14 15 bool UnpackFromMemory; 16 size_t UnpackFromMemorySize; 17 byte *UnpackFromMemoryAddr; 18 19 bool UnpackToMemory; 20 size_t UnpackToMemorySize; 21 byte *UnpackToMemoryAddr; 22 23 size_t UnpWrSize; 24 byte *UnpWrAddr; 25 26 int64 UnpPackedSize; 27 28 bool ShowProgress; 29 bool TestMode; 30 bool SkipUnpCRC; 31 32 File *SrcFile; 33 File *DestFile; 34 35 CmdAdd *Command; 36 37 FileHeader *SubHead; 38 int64 *SubHeadPos; 39 40 #ifndef NOCRYPT 41 CryptData Crypt; 42 CryptData Decrypt; 43 #endif 44 45 46 int LastPercent; 47 48 char CurrentCommand; 49 50 public: 51 ComprDataIO(); 52 void Init(); 53 int UnpRead(byte *Addr,size_t Count); 54 void UnpWrite(byte *Addr,size_t Count); EnableShowProgress(bool Show)55 void EnableShowProgress(bool Show) {ShowProgress=Show;} 56 void GetUnpackedData(byte **Data,size_t *Size); SetPackedSizeToRead(int64 Size)57 void SetPackedSizeToRead(int64 Size) {UnpPackedSize=Size;} SetTestMode(bool Mode)58 void SetTestMode(bool Mode) {TestMode=Mode;} SetSkipUnpCRC(bool Skip)59 void SetSkipUnpCRC(bool Skip) {SkipUnpCRC=Skip;} 60 void SetFiles(File *SrcFile,File *DestFile); SetCommand(CmdAdd * Cmd)61 void SetCommand(CmdAdd *Cmd) {Command=Cmd;} SetSubHeader(FileHeader * hd,int64 * Pos)62 void SetSubHeader(FileHeader *hd,int64 *Pos) {SubHead=hd;SubHeadPos=Pos;} 63 void SetEncryption(int Method,const char *Password,const byte *Salt,bool Encrypt,bool HandsOffHash); 64 void SetAV15Encryption(); 65 void SetCmt13Encryption(); 66 void SetUnpackToMemory(byte *Addr,uint Size); SetCurrentCommand(char Cmd)67 void SetCurrentCommand(char Cmd) {CurrentCommand=Cmd;} 68 69 bool PackVolume; 70 bool UnpVolume; 71 bool NextVolumeMissing; 72 int64 TotalPackRead; 73 int64 UnpArcSize; 74 int64 CurPackRead,CurPackWrite,CurUnpRead,CurUnpWrite; 75 76 // Size of already processed archives. 77 // Used to calculate the total operation progress. 78 int64 ProcessedArcSize; 79 80 int64 TotalArcSize; 81 82 uint PackFileCRC,UnpFileCRC,PackedCRC; 83 84 int Encryption; 85 int Decryption; 86 }; 87 88 #endif 89