2009-11-10 16:48:42 +01:00
|
|
|
#ifndef _RAR_ERRHANDLER_
|
|
|
|
#define _RAR_ERRHANDLER_
|
|
|
|
|
2020-07-15 00:40:26 +02:00
|
|
|
enum RAR_EXIT // RAR exit code.
|
|
|
|
{
|
|
|
|
RARX_SUCCESS = 0,
|
|
|
|
RARX_WARNING = 1,
|
|
|
|
RARX_FATAL = 2,
|
|
|
|
RARX_CRC = 3,
|
|
|
|
RARX_LOCK = 4,
|
|
|
|
RARX_WRITE = 5,
|
|
|
|
RARX_OPEN = 6,
|
|
|
|
RARX_USERERROR = 7,
|
|
|
|
RARX_MEMORY = 8,
|
|
|
|
RARX_CREATE = 9,
|
|
|
|
RARX_NOFILES = 10,
|
|
|
|
RARX_BADPWD = 11,
|
2021-05-24 17:37:15 +02:00
|
|
|
RARX_READ = 12,
|
2020-07-15 00:40:26 +02:00
|
|
|
RARX_USERBREAK = 255
|
|
|
|
};
|
2009-11-10 16:48:42 +01:00
|
|
|
|
2021-05-24 17:37:15 +02:00
|
|
|
|
2009-11-10 16:48:42 +01:00
|
|
|
class ErrorHandler
|
|
|
|
{
|
|
|
|
private:
|
2020-07-15 00:40:26 +02:00
|
|
|
RAR_EXIT ExitCode;
|
|
|
|
uint ErrCount;
|
2009-11-10 16:48:42 +01:00
|
|
|
bool EnableBreak;
|
|
|
|
bool Silent;
|
2020-07-15 00:40:26 +02:00
|
|
|
bool DisableShutdown; // Shutdown is not suitable after last error.
|
2021-05-24 17:37:15 +02:00
|
|
|
bool ReadErrIgnoreAll;
|
2009-11-10 16:48:42 +01:00
|
|
|
public:
|
|
|
|
ErrorHandler();
|
|
|
|
void Clean();
|
|
|
|
void MemoryError();
|
2020-07-15 00:40:26 +02:00
|
|
|
void OpenError(const wchar *FileName);
|
|
|
|
void CloseError(const wchar *FileName);
|
|
|
|
void ReadError(const wchar *FileName);
|
2021-05-24 17:37:15 +02:00
|
|
|
void AskRepeatRead(const wchar *FileName,bool &Ignore,bool &Retry,bool &Quit);
|
2020-07-15 00:40:26 +02:00
|
|
|
void WriteError(const wchar *ArcName,const wchar *FileName);
|
|
|
|
void WriteErrorFAT(const wchar *FileName);
|
|
|
|
bool AskRepeatWrite(const wchar *FileName,bool DiskFull);
|
|
|
|
void SeekError(const wchar *FileName);
|
|
|
|
void GeneralErrMsg(const wchar *fmt,...);
|
2009-11-10 16:48:42 +01:00
|
|
|
void MemoryErrorMsg();
|
2020-07-15 00:40:26 +02:00
|
|
|
void OpenErrorMsg(const wchar *FileName);
|
|
|
|
void OpenErrorMsg(const wchar *ArcName,const wchar *FileName);
|
|
|
|
void CreateErrorMsg(const wchar *FileName);
|
|
|
|
void CreateErrorMsg(const wchar *ArcName,const wchar *FileName);
|
|
|
|
void ReadErrorMsg(const wchar *FileName);
|
|
|
|
void ReadErrorMsg(const wchar *ArcName,const wchar *FileName);
|
|
|
|
void WriteErrorMsg(const wchar *ArcName,const wchar *FileName);
|
|
|
|
void ArcBrokenMsg(const wchar *ArcName);
|
|
|
|
void ChecksumFailedMsg(const wchar *ArcName,const wchar *FileName);
|
|
|
|
void UnknownMethodMsg(const wchar *ArcName,const wchar *FileName);
|
|
|
|
void Exit(RAR_EXIT ExitCode);
|
|
|
|
void SetErrorCode(RAR_EXIT Code);
|
|
|
|
RAR_EXIT GetErrorCode() {return ExitCode;}
|
|
|
|
uint GetErrorCount() {return ErrCount;}
|
2009-11-10 16:48:42 +01:00
|
|
|
void SetSignalHandlers(bool Enable);
|
2020-07-15 00:40:26 +02:00
|
|
|
void Throw(RAR_EXIT Code);
|
|
|
|
void SetSilent(bool Mode) {Silent=Mode;}
|
|
|
|
bool GetSysErrMsg(wchar *Msg,size_t Size);
|
2009-11-10 16:48:42 +01:00
|
|
|
void SysErrMsg();
|
2020-07-15 00:40:26 +02:00
|
|
|
int GetSystemErrorCode();
|
|
|
|
void SetSystemErrorCode(int Code);
|
|
|
|
void SetDisableShutdown() {DisableShutdown=true;}
|
|
|
|
bool IsShutdownEnabled() {return !DisableShutdown;}
|
|
|
|
|
|
|
|
bool UserBreak; // Ctrl+Break is pressed.
|
|
|
|
bool MainExit; // main() is completed.
|
2009-11-10 16:48:42 +01:00
|
|
|
};
|
|
|
|
|
2020-07-15 00:40:26 +02:00
|
|
|
|
2009-11-10 16:48:42 +01:00
|
|
|
#endif
|