hlVoid ExtractItemEndCallback(HLDirectoryItem *pItem, hlBool bSuccess) { hlUInt uiSize = 0; hlChar lpPath[512] = ""; if(bSuccess) { if(!bSilent) { hlItemGetSize(pItem, &uiSize); if(hlItemGetType(pItem) == HL_ITEM_FILE) { Print(FOREGROUND_GREEN | FOREGROUND_INTENSITY, "OK"); printf(" (%u B)\n", uiSize); } else { Print(FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE | FOREGROUND_INTENSITY, " Done %s: ", hlItemGetName(pItem)); Print(FOREGROUND_GREEN | FOREGROUND_INTENSITY, "OK"); Print(FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE | FOREGROUND_INTENSITY, " (%u B)\n", uiSize); } } } else { if(!bSilent) { if(hlItemGetType(pItem) == HL_ITEM_FILE) { Print(FOREGROUND_RED | FOREGROUND_INTENSITY, "Errored\n"); Print(FOREGROUND_RED | FOREGROUND_INTENSITY, " %s\n", hlGetString(HL_ERROR_SHORT_FORMATED)); } else { Print(FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE | FOREGROUND_INTENSITY, " Done %s: ", hlItemGetName(pItem)); Print(FOREGROUND_RED | FOREGROUND_INTENSITY, "Errored\n"); } } else { hlItemGetPath(pItem, lpPath, sizeof(lpPath)); if(hlItemGetType(pItem) == HL_ITEM_FILE) { Print(FOREGROUND_RED | FOREGROUND_INTENSITY, " Error extracting %s:\n", lpPath); Print(FOREGROUND_RED | FOREGROUND_INTENSITY, " %s\n", hlGetString(HL_ERROR_SHORT_FORMATED)); } else { Print(FOREGROUND_RED | FOREGROUND_INTENSITY, " Error extracting %s.\n", lpPath); } } } }
hlVoid ExtractItemEndCallback(HLDirectoryItem *pItem, hlBool bSuccess) { #if 0 PyEval_RestoreThread(g_extract_save); hlUInt uiSize = 0; hlChar lpPath[512] = ""; if( pEndExtractFunc == Py_None ) { if(bSuccess) { if(!bSilent) { hlItemGetSize(pItem, &uiSize); if(hlItemGetType(pItem) == HL_ITEM_FILE) { PySys_WriteStdout("OK"); PySys_WriteStdout(" (%u B)\n", uiSize); } else { PySys_WriteStdout(" Done %s: ", hlItemGetName(pItem)); PySys_WriteStdout("OK"); PySys_WriteStdout(" (%u B)\n", uiSize); } } } else { if(!bSilent) { if(hlItemGetType(pItem) == HL_ITEM_FILE) { PySys_WriteStdout("Errored\n"); PySys_WriteStdout(" %s\n", hlGetString(HL_ERROR_SHORT_FORMATED)); } else { PySys_WriteStdout(" Done %s: ", hlItemGetName(pItem)); PySys_WriteStdout("Errored\n"); } } else { hlItemGetPath(pItem, lpPath, sizeof(lpPath)); if(hlItemGetType(pItem) == HL_ITEM_FILE) { PySys_WriteStdout(" Error extracting %s:\n", lpPath); PySys_WriteStdout(" %s\n", hlGetString(HL_ERROR_SHORT_FORMATED)); } else { PySys_WriteStdout(" Error extracting %s.\n", lpPath); } } } } else { hlItemGetSize(pItem, &uiSize); hlItemGetPath(pItem, lpPath, sizeof(lpPath)); PyEval_CallFunction(pEndExtractFunc, "bsisIs", bSuccess, hlItemGetName(pItem), hlItemGetType(pItem), lpPath, uiSize, bSuccess ? "" : hlGetString(HL_ERROR_SHORT_FORMATED)); } g_extract_save = PyEval_SaveThread(); #endif // 0 hlUInt uiSize = 0; hlChar lpPath[512] = ""; if(hlItemGetType(pItem) == HL_ITEM_FILE) { hlItemGetSize(pItem, &uiSize); g_bytesExtracted += uiSize; if( g_bytesExtracted > 10000000 && pUpdateFunc != Py_None ) { hlItemGetPath(pItem, lpPath, sizeof(lpPath)); PyEval_RestoreThread(g_extract_save); PyEval_CallFunction(pUpdateFunc, "bsisIs", bSuccess, hlItemGetName(pItem), hlItemGetType(pItem), lpPath, g_bytesExtracted, bSuccess ? "" : hlGetString(HL_ERROR_SHORT_FORMATED)); g_extract_save = PyEval_SaveThread(); g_bytesExtracted = 0; } } }