2021-12-27 01:00:00 +01:00
|
|
|
// OpenCallbackConsole.h
|
|
|
|
|
|
2023-06-21 02:00:00 +02:00
|
|
|
#ifndef ZIP7_INC_OPEN_CALLBACK_CONSOLE_H
|
|
|
|
|
#define ZIP7_INC_OPEN_CALLBACK_CONSOLE_H
|
2021-12-27 01:00:00 +01:00
|
|
|
|
|
|
|
|
#include "../../../Common/StdOutStream.h"
|
|
|
|
|
|
|
|
|
|
#include "../Common/ArchiveOpenCallback.h"
|
|
|
|
|
|
|
|
|
|
#include "PercentPrinter.h"
|
|
|
|
|
|
|
|
|
|
class COpenCallbackConsole: public IOpenCallbackUI
|
|
|
|
|
{
|
|
|
|
|
protected:
|
|
|
|
|
CPercentPrinter _percent;
|
|
|
|
|
|
|
|
|
|
CStdOutStream *_so;
|
|
|
|
|
CStdOutStream *_se;
|
|
|
|
|
|
|
|
|
|
// UInt64 _totalFiles;
|
|
|
|
|
UInt64 _totalBytes;
|
2023-06-21 02:00:00 +02:00
|
|
|
bool _totalFilesDefined;
|
|
|
|
|
// bool _totalBytesDefined;
|
2021-12-27 01:00:00 +01:00
|
|
|
|
2024-06-19 02:00:00 +02:00
|
|
|
bool NeedPercents() const { return _percent._so && !_percent.DisablePrint; }
|
2021-12-27 01:00:00 +01:00
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
|
|
bool MultiArcMode;
|
|
|
|
|
|
|
|
|
|
void ClosePercents()
|
|
|
|
|
{
|
|
|
|
|
if (NeedPercents())
|
|
|
|
|
_percent.ClosePrint(true);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
COpenCallbackConsole():
|
2023-06-21 02:00:00 +02:00
|
|
|
_totalBytes(0),
|
2021-12-27 01:00:00 +01:00
|
|
|
_totalFilesDefined(false),
|
|
|
|
|
// _totalBytesDefined(false),
|
|
|
|
|
MultiArcMode(false)
|
|
|
|
|
|
2023-06-21 02:00:00 +02:00
|
|
|
#ifndef Z7_NO_CRYPTO
|
2021-12-27 01:00:00 +01:00
|
|
|
, PasswordIsDefined(false)
|
|
|
|
|
// , PasswordWasAsked(false)
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
{}
|
|
|
|
|
|
|
|
|
|
virtual ~COpenCallbackConsole() {}
|
|
|
|
|
|
2024-06-19 02:00:00 +02:00
|
|
|
void Init(
|
|
|
|
|
CStdOutStream *outStream,
|
|
|
|
|
CStdOutStream *errorStream,
|
|
|
|
|
CStdOutStream *percentStream,
|
|
|
|
|
bool disablePercents)
|
2021-12-27 01:00:00 +01:00
|
|
|
{
|
|
|
|
|
_so = outStream;
|
|
|
|
|
_se = errorStream;
|
|
|
|
|
_percent._so = percentStream;
|
2024-06-19 02:00:00 +02:00
|
|
|
_percent.DisablePrint = disablePercents;
|
2021-12-27 01:00:00 +01:00
|
|
|
}
|
|
|
|
|
|
2023-06-21 02:00:00 +02:00
|
|
|
Z7_IFACE_IMP(IOpenCallbackUI)
|
2021-12-27 01:00:00 +01:00
|
|
|
|
2023-06-21 02:00:00 +02:00
|
|
|
#ifndef Z7_NO_CRYPTO
|
2021-12-27 01:00:00 +01:00
|
|
|
bool PasswordIsDefined;
|
|
|
|
|
// bool PasswordWasAsked;
|
|
|
|
|
UString Password;
|
2026-02-07 23:15:56 +01:00
|
|
|
int PasswordFd;
|
2021-12-27 01:00:00 +01:00
|
|
|
#endif
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
#endif
|