BOOL CInfoZip::ExtractFiles(const char * pszArchive, const char * pszTargetFolder) { char pszCurrentDir[MAX_PATH+1]; ZeroMemory(pszCurrentDir, MAX_PATH+1); GetCurrentDirectory(MAX_PATH+1, pszCurrentDir); SetCurrentDirectory(pszTargetFolder); CUnzipParams uzpParams; SetDefaultValues(&uzpParams); // seting archive name uzpParams.m_pszArchiveFileName = (char*)malloc(strlen(pszArchive)+1); ZeroMemory(uzpParams.m_pszArchiveFileName, strlen(pszArchive)+1); strcpy(uzpParams.m_pszArchiveFileName, pszArchive); // seting file count uzpParams.m_liFileCount = 1; // seting file names uzpParams.m_pszFileNames[0] = (char*)malloc(MAX_PATH+1); ZeroMemory(uzpParams.m_pszFileNames[0], MAX_PATH+1); strcpy(uzpParams.m_pszFileNames[0], "*.*"); // executing command int iProcessedCount = m_UnzipDllExec(&uzpParams); ReleaseParams(&uzpParams); SetCurrentDirectory(pszCurrentDir); return TRUE; }
BOOL CInfoZip::AddFiles(const char *pszArchive, char ** paFiles, int iFileCount) { CZipParams zpParams; SetDefaultValues(&zpParams); // seting archive name zpParams.m_pszArchiveFileName = (char*)malloc(strlen(pszArchive)+1); ZeroMemory(zpParams.m_pszArchiveFileName, strlen(pszArchive)+1); strcpy(zpParams.m_pszArchiveFileName, pszArchive); // seting file count zpParams.m_liFileCount = iFileCount; // seting file names for (int i=0; i<iFileCount; i++) { zpParams.m_pszFileNames[i] = (char*)malloc(MAX_PATH+1); ZeroMemory(zpParams.m_pszFileNames[i], MAX_PATH+1); strcpy(zpParams.m_pszFileNames[i], paFiles[i]); } // executing command int iProcessedCount = m_ZipDllExec(&zpParams); ReleaseParams(&zpParams); return (iProcessedCount == iFileCount); }
Call Call::operator=(const Call& other) { if (this == &other) return *this; ReleaseParams(); CopyFrom(other); return *this; }
/////////////////////////////////////////////////////////////////////////////// // Descripcion: // - Recorre una expresion. // Parametros: // - pExp. Expresion a imprimir // - szActFileName. Nombre del fichero actual // Devuelve: // Notas: /////////////////////////////////////////////////////////////////////////////// void ReleaseExp(sExp* pExp) { // ¿Hay alguna expresion para imprimir? if (pExp) { switch(pExp->ExpType) { case EXP_IDENTIFIER: { Mem_Free(pExp->ExpIdentifier.szIdentifier); } break; case EXP_GLOBAL_CONST_ENTITY: { } break; case EXP_GLOBAL_CONST_NUMBER: { } break; case EXP_NUMBER_VALUE: { } break; case EXP_STRING_VALUE: { Mem_Free(pExp->ExpStrValue.szStrValue); } break; case EXP_ASSING: { ReleaseExp(pExp->ExpAssing.pRightExp); Mem_Free(pExp->ExpAssing.szIdentifier); } break; case EXP_EQUAL: { ReleaseExp(pExp->ExpEqual.pLeftExp); ReleaseExp(pExp->ExpEqual.pRightExp); } break; case EXP_NOEQUAL: { ReleaseExp(pExp->ExpNoEqual.pLeftExp); ReleaseExp(pExp->ExpNoEqual.pRightExp); } break; case EXP_LESS: { ReleaseExp(pExp->ExpLess.pLeftExp); ReleaseExp(pExp->ExpLess.pRightExp); } break; case EXP_LESSEQUAL: { ReleaseExp(pExp->ExpLEqual.pLeftExp); ReleaseExp(pExp->ExpLEqual.pRightExp); } break; case EXP_GREATER: { ReleaseExp(pExp->ExpGreater.pLeftExp); ReleaseExp(pExp->ExpGreater.pRightExp); } break; case EXP_GREATEREQUAL: { ReleaseExp(pExp->ExpGEqual.pLeftExp); ReleaseExp(pExp->ExpGEqual.pRightExp); } break; case EXP_ADD: { ReleaseExp(pExp->ExpAdd.pLeftExp); ReleaseExp(pExp->ExpAdd.pRightExp); } break; case EXP_MINUS: { ReleaseExp(pExp->ExpMinus.pLeftExp); ReleaseExp(pExp->ExpMinus.pRightExp); } break; case EXP_MULT: { ReleaseExp(pExp->ExpMult.pLeftExp); ReleaseExp(pExp->ExpMult.pRightExp); } break; case EXP_DIV: { ReleaseExp(pExp->ExpDiv.pLeftExp); ReleaseExp(pExp->ExpDiv.pRightExp); } break; case EXP_MODULO: { ReleaseExp(pExp->ExpModulo.pLeftExp); ReleaseExp(pExp->ExpModulo.pRightExp); } break; case EXP_UMINUS: { ReleaseExp(pExp->ExpUMinus.pExp); } break; case EXP_NOT: { ReleaseExp(pExp->ExpNot.pExp); } break; case EXP_AND: { ReleaseExp(pExp->ExpAnd.pLeftExp); ReleaseExp(pExp->ExpAnd.pRightExp); } break; case EXP_OR: { ReleaseExp(pExp->ExpOr.pLeftExp); ReleaseExp(pExp->ExpOr.pRightExp); } break; case EXP_FUNC_INVOKE: { ReleaseParams(pExp->ExpFuncInvoke.pParams); Mem_Free(pExp->ExpFuncInvoke.szIdentifier); } break; case EXP_APIFUNC_INVOKE: { ReleaseParams(pExp->ExpAPIFuncInvoke.pParams); } break; case EXP_GAMEOBJ_INVOKE: { ReleaseParams(pExp->ExpGameObjInvoke.pParams); } break; case EXP_WORLDOBJ_INVOKE: { ReleaseParams(pExp->ExpWorldObjInvoke.pParams); } break; case EXP_ENTITYOBJ_INVOKE: { ReleaseParams(pExp->ExpEntityObjInvoke.pParams); Mem_Free(pExp->ExpEntityObjInvoke.szIdentifier); } break; case EXP_CAST: { ReleaseExp(pExp->ExpCast.pExp); } break; }; // ~ switch // Borra nodo Mem_Free(pExp); } }
Call::~Call(void) { ReleaseParams(); }