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 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211
|
// ExtractCallbackConsole.h
#ifndef ZIP7_INC_EXTRACT_CALLBACK_CONSOLE_H
#define ZIP7_INC_EXTRACT_CALLBACK_CONSOLE_H
#include "../../../Common/StdOutStream.h"
#include "../../IPassword.h"
#include "../../Archive/IArchive.h"
#include "../Common/ArchiveExtractCallback.h"
#include "PercentPrinter.h"
#include "OpenCallbackConsole.h"
/*
struct CErrorPathCodes2
{
FStringVector Paths;
CRecordVector<DWORD> Codes;
void AddError(const FString &path, DWORD systemError)
{
Paths.Add(path);
Codes.Add(systemError);
}
void Clear()
{
Paths.Clear();
Codes.Clear();
}
};
*/
class CExtractScanConsole Z7_final: public IDirItemsCallback
{
Z7_IFACE_IMP(IDirItemsCallback)
CStdOutStream *_so;
CStdOutStream *_se;
CPercentPrinter _percent;
// CErrorPathCodes2 ScanErrors;
bool NeedPercents() const { return _percent._so && !_percent.DisablePrint; }
void ClosePercentsAndFlush()
{
if (NeedPercents())
_percent.ClosePrint(true);
if (_so)
_so->Flush();
}
public:
void Init(
CStdOutStream *outStream,
CStdOutStream *errorStream,
CStdOutStream *percentStream,
bool disablePercents)
{
_so = outStream;
_se = errorStream;
_percent._so = percentStream;
_percent.DisablePrint = disablePercents;
}
void SetWindowWidth(unsigned width) { _percent.MaxLen = width - 1; }
void StartScanning();
void CloseScanning()
{
if (NeedPercents())
_percent.ClosePrint(true);
}
void PrintStat(const CDirItemsStat &st);
};
class CExtractCallbackConsole Z7_final:
public IFolderArchiveExtractCallback,
public IExtractCallbackUI,
// public IArchiveExtractCallbackMessage,
public IFolderArchiveExtractCallback2,
#ifndef Z7_NO_CRYPTO
public ICryptoGetTextPassword,
#endif
#ifndef Z7_SFX
public IArchiveRequestMemoryUseCallback,
#endif
public COpenCallbackConsole,
public CMyUnknownImp
{
Z7_COM_QI_BEGIN2(IFolderArchiveExtractCallback)
// Z7_COM_QI_ENTRY(IArchiveExtractCallbackMessage)
Z7_COM_QI_ENTRY(IFolderArchiveExtractCallback2)
#ifndef Z7_NO_CRYPTO
Z7_COM_QI_ENTRY(ICryptoGetTextPassword)
#endif
#ifndef Z7_SFX
Z7_COM_QI_ENTRY(IArchiveRequestMemoryUseCallback)
#endif
Z7_COM_QI_END
Z7_COM_ADDREF_RELEASE
Z7_IFACE_COM7_IMP(IProgress)
Z7_IFACE_COM7_IMP(IFolderArchiveExtractCallback)
Z7_IFACE_IMP(IExtractCallbackUI)
// Z7_IFACE_COM7_IMP(IArchiveExtractCallbackMessage)
Z7_IFACE_COM7_IMP(IFolderArchiveExtractCallback2)
#ifndef Z7_NO_CRYPTO
Z7_IFACE_COM7_IMP(ICryptoGetTextPassword)
#endif
#ifndef Z7_SFX
Z7_IFACE_COM7_IMP(IArchiveRequestMemoryUseCallback)
#endif
bool _needWriteArchivePath;
public:
bool ThereIsError_in_Current;
bool ThereIsWarning_in_Current;
bool NeedFlush;
private:
AString _tempA;
UString _tempU;
UString _currentArchivePath;
UString _currentName;
#ifndef Z7_SFX
void PrintTo_se_Path_WithTitle(const UString &path, const char *title);
void Add_ArchiveName_Error();
#endif
void ClosePercents_for_so()
{
if (NeedPercents() && _so == _percent._so)
_percent.ClosePrint(false);
}
void ClosePercentsAndFlush()
{
if (NeedPercents())
_percent.ClosePrint(true);
if (_so)
_so->Flush();
}
public:
UInt64 NumTryArcs;
UInt64 NumOkArcs;
UInt64 NumCantOpenArcs;
UInt64 NumArcsWithError;
UInt64 NumArcsWithWarnings;
UInt64 NumOpenArcErrors;
UInt64 NumOpenArcWarnings;
UInt64 NumFileErrors;
UInt64 NumFileErrors_in_Current;
unsigned PercentsNameLevel;
unsigned LogLevel;
CExtractCallbackConsole():
_needWriteArchivePath(true),
NeedFlush(false),
PercentsNameLevel(1),
LogLevel(0)
{}
void SetWindowWidth(unsigned width) { _percent.MaxLen = width - 1; }
void Init(
CStdOutStream *outStream,
CStdOutStream *errorStream,
CStdOutStream *percentStream,
bool disablePercents)
{
COpenCallbackConsole::Init(outStream, errorStream, percentStream, disablePercents);
NumTryArcs = 0;
ThereIsError_in_Current = false;
ThereIsWarning_in_Current = false;
NumOkArcs = 0;
NumCantOpenArcs = 0;
NumArcsWithError = 0;
NumArcsWithWarnings = 0;
NumOpenArcErrors = 0;
NumOpenArcWarnings = 0;
NumFileErrors = 0;
NumFileErrors_in_Current = 0;
}
};
#endif
|