1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162
|
#ifndef _RAR_UI_
#define _RAR_UI_
// UIERROR_ - error message;
// UIMSG_ - informational message;
// UIWAIT_ - message waiting for user confirmation;
// UIEVENT_ - if simple message is not enough;
enum UIMESSAGE_CODE {
UIERROR_SYSERRMSG, UIERROR_GENERALERRMSG, UIERROR_INCERRCOUNT,
UIERROR_CHECKSUM, UIERROR_CHECKSUMENC, UIERROR_CHECKSUMPACKED,
UIERROR_BADPSW, UIERROR_MEMORY, UIERROR_FILEOPEN, UIERROR_FILECREATE,
UIERROR_FILECLOSE, UIERROR_FILESEEK, UIERROR_FILEREAD,
UIERROR_FILEWRITE, UIERROR_FILEDELETE, UIERROR_FILERENAME,
UIERROR_FILEATTR, UIERROR_FILECOPY, UIERROR_FILECOPYHINT,
UIERROR_DIRCREATE, UIERROR_SLINKCREATE, UIERROR_HLINKCREATE,
UIERROR_NEEDADMIN, UIERROR_ARCBROKEN, UIERROR_HEADERBROKEN,
UIERROR_MHEADERBROKEN, UIERROR_FHEADERBROKEN, UIERROR_SUBHEADERBROKEN,
UIERROR_SUBHEADERUNKNOWN, UIERROR_SUBHEADERDATABROKEN, UIERROR_RRDAMAGED,
UIERROR_UNKNOWNMETHOD, UIERROR_UNKNOWNENCMETHOD, UIERROR_RENAMING,
UIERROR_NEWERRAR, UIERROR_NOTSFX, UIERROR_OLDTOSFX, UIERROR_WRONGSFXVER,
UIERROR_ALREADYENC, UIERROR_SYNCSCAN, UIERROR_DICTOUTMEM,
UIERROR_USESMALLERDICT, UIERROR_MODIFYUNKNOWN, UIERROR_MODIFYOLD,
UIERROR_MODIFYLOCKED, UIERROR_MODIFYVOLUME, UIERROR_NOTVOLUME,
UIERROR_NOTFIRSTVOLUME, UIERROR_RECVOLLIMIT, UIERROR_RECVOLDIFFSETS,
UIERROR_RECVOLALLEXIST, UIERROR_RECVOLFOUND, UIERROR_RECONSTRUCTING,
UIERROR_RECVOLCANNOTFIX, UIERROR_OPFAILED, UIERROR_UNEXPEOF,
UIERROR_BADARCHIVE, UIERROR_CMTBROKEN, UIERROR_INVALIDNAME,
UIERROR_NEWRARFORMAT, UIERROR_NOTSUPPORTED, UIERROR_ENCRNOTSUPPORTED,
UIERROR_RARZIPONLY, UIERROR_REPAIROLDFORMAT, UIERROR_NOFILESREPAIRED,
UIERROR_NOFILESTOADD, UIERROR_NOFILESTODELETE, UIERROR_NOFILESTOEXTRACT,
UIERROR_MISSINGVOL, UIERROR_NEEDPREVVOL, UIERROR_UNKNOWNEXTRA,
UIERROR_NTFSREQUIRED, UIERROR_ZIPVOLSFX, UIERROR_FILERO,
UIERROR_TOOLARGESFX, UIERROR_EMAIL, UIERROR_ACLGET, UIERROR_ACLBROKEN,
UIERROR_ACLUNKNOWN, UIERROR_ACLSET, UIERROR_STREAMBROKEN,
UIERROR_STREAMUNKNOWN, UIERROR_INCOMPATSWITCH, UIERROR_PATHTOOLONG,
UIERROR_DIRSCAN, UIERROR_UOWNERGET, UIERROR_UOWNERBROKEN,
UIERROR_UOWNERGETOWNERID, UIERROR_UOWNERGETGROUPID, UIERROR_UOWNERSET,
UIERROR_ULINKREAD, UIERROR_ULINKEXIST,
UIMSG_FIRST,
UIMSG_STRING, UIMSG_BUILD, UIMSG_RRSEARCH, UIMSG_RRFOUND,
UIMSG_RRNOTFOUND, UIMSG_RRDAMAGED, UIMSG_BLOCKSRECOVERED,
UIMSG_COPYINGDATA, UIMSG_AREADAMAGED, UIMSG_SECTORDAMAGED,
UIMSG_SECTORRECOVERED, UIMSG_SECTORNOTRECOVERED, UIMSG_FOUND,
UIMSG_CORRECTINGNAME, UIMSG_BADARCHIVE, UIMSG_CREATING, UIMSG_RENAMING,
UIMSG_RECVOLCALCCHECKSUM, UIMSG_RECVOLFOUND, UIMSG_RECVOLMISSING,
UIMSG_MISSINGVOL, UIMSG_RECONSTRUCTING, UIMSG_CHECKSUM, UIMSG_FAT32SIZE,
UIWAIT_FIRST,
UIWAIT_DISKFULLNEXT, UIWAIT_FCREATEERROR,
UIEVENT_FIRST,
UIEVENT_SEARCHDUPFILES, UIEVENT_CLEARATTRSTART, UIEVENT_CLEARATTRFILE,
UIEVENT_DELADDEDSTART, UIEVENT_DELADDEDFILE, UIEVENT_FILESFOUND,
UIEVENT_ERASEDISK, UIEVENT_FILESUMSTART, UIEVENT_FILESUMPROGRESS,
UIEVENT_FILESUMEND, UIEVENT_PROTECTSTART, UIEVENT_PROTECTEND,
UIEVENT_TESTADDEDSTART, UIEVENT_TESTADDEDEND, UIEVENT_RRTESTINGSTART,
UIEVENT_RRTESTINGEND, UIEVENT_NEWARCHIVE, UIEVENT_NEWREVFILE
};
// Flags for uiAskReplace function.
enum UIASKREP_FLAGS {
UIASKREP_F_NORENAME=1,UIASKREP_F_EXCHSRCDEST=2,UIASKREP_F_SHOWNAMEONLY=4
};
// Codes returned by uiAskReplace. Note that uiAskReplaceEx returns only
// UIASKREP_R_REPLACE, UIASKREP_R_SKIP and UIASKREP_R_CANCEL codes.
enum UIASKREP_RESULT {
UIASKREP_R_REPLACE,UIASKREP_R_SKIP,UIASKREP_R_REPLACEALL,UIASKREP_R_SKIPALL,
UIASKREP_R_RENAME,UIASKREP_R_RENAMEAUTO,UIASKREP_R_CANCEL,UIASKREP_R_UNUSED
};
UIASKREP_RESULT uiAskReplace(wchar *Name,size_t MaxNameSize,int64 FileSize,RarTime *FileTime,uint Flags);
UIASKREP_RESULT uiAskReplaceEx(RAROptions *Cmd,wchar *Name,size_t MaxNameSize,int64 FileSize,RarTime *FileTime,uint Flags);
void uiInit(bool Sound);
void uiStartArchiveExtract(bool Extract,const wchar *ArcName);
bool uiStartFileExtract(const wchar *FileName,bool Extract,bool Test,bool Skip);
void uiExtractProgress(int64 CurFileSize,int64 TotalFileSize,int64 CurSize,int64 TotalSize);
void uiProcessProgress(const char *Command,int64 CurSize,int64 TotalSize);
enum UIPASSWORD_TYPE {UIPASSWORD_GLOBAL,UIPASSWORD_FILE,UIPASSWORD_ARCHIVE};
bool uiGetPassword(UIPASSWORD_TYPE Type,const wchar *FileName,SecPassword *Password);
enum UIALARM_TYPE {UIALARM_ERROR, UIALARM_INFO, UIALARM_QUESTION};
void uiAlarm(UIALARM_TYPE Type);
bool uiAskNextVolume(wchar *VolName,size_t MaxSize);
bool uiAskRepeatRead(const wchar *FileName);
bool uiAskRepeatWrite(const wchar *FileName,bool DiskFull);
#ifndef SFX_MODULE
const wchar *uiGetMonthName(int Month);
#endif
class uiMsgStore
{
private:
static const size_t MAX_MSG = 8;
const wchar *Str[MAX_MSG];
uint Num[MAX_MSG];
uint StrSize,NumSize;
UIMESSAGE_CODE Code;
public:
uiMsgStore(UIMESSAGE_CODE Code)
{
NumSize=StrSize=0;
this->Code=Code;
}
uiMsgStore& operator << (const wchar *s)
{
if (StrSize<MAX_MSG)
Str[StrSize++]=s;
return *this;
}
uiMsgStore& operator << (uint n)
{
if (NumSize<MAX_MSG)
Num[NumSize++]=n;
return *this;
}
void Msg();
};
// Templates recognize usual NULL as integer, not wchar*.
#define UINULL ((wchar *)NULL)
inline void uiMsg(UIMESSAGE_CODE Code)
{
uiMsgStore Store(Code);
Store.Msg();
}
template<class T1> void uiMsg(UIMESSAGE_CODE Code,T1 a1)
{
uiMsgStore Store(Code);
Store<<a1;
Store.Msg();
}
template<class T1,class T2> void uiMsg(UIMESSAGE_CODE Code,T1 a1,T2 a2)
{
uiMsgStore Store(Code);
Store<<a1<<a2;
Store.Msg();
}
template<class T1,class T2,class T3> void uiMsg(UIMESSAGE_CODE code,T1 a1,T2 a2,T3 a3)
{
uiMsgStore Store(code);
Store<<a1<<a2<<a3;
Store.Msg();
}
#endif
|