class CMultiProgressCallback : public CZipActionCallback
{
bool Callback(ZIP_SIZE_TYPE)
{
if (m_iType == cbCalculateForMulti)
{
LPCTSTR FormatSymbol = _T("%I64u");
#ifdef _ZIP_ZIP64
_tprintf(_T("Found %I64u files so far \r\n"), m_uProcessed);
#else
_tprintf(_T("Found %u files so far \r\n"), m_uProcessed);
#endif
return true;
}
CMultiActionsInfo* pMulti = GetMultiActionsInfo();
ASSERT(pMulti);
#ifdef _ZIP_ZIP64
_tprintf(_T("Current File: %I64u of %I64u, Total Bytes: %I64u of %I64u \r"),
#else
_tprintf(_T("Current File: %u of %u, Total Bytes: %u of %u \r"),
#endif
m_uProcessed, m_uTotalToProcess,
pMulti->m_uBytesProcessed, pMulti->m_uTotalBytesToProcess);
return true;
}
int GetStepSize()
{
return 1;
}
bool MultiActionsNext()
{
if (CZipActionCallback::MultiActionsNext())
{
CMultiActionsInfo* pMulti = GetMultiActionsInfo();
#ifdef _ZIP_ZIP64
_tprintf(_T("\n\rFiles Processed: %I64u of %I64u \n\r"),
#else
_tprintf(_T("\n\rFiles Processed: %u of %u \n\r"),
#endif
pMulti->m_uFilesProcessed, pMulti->m_uTotalFilesToProcess);
return true;
}
else
return false;
}
};
void ProgressMulti()
{
CZipArchive zip;
CMultiProgressCallback callback;
zip.SetCallback(&callback,
CZipActionCallback::cbMultiAdd | CZipActionCallback::cbCalculateForMulti);
zip.Open(_T("C:\\Temp\\test.zip"), CZipArchive::zipCreate);
zip.AddNewFiles(_T("C:\\Temp"), _T("*.bin"), false);
zip.Close();
}