fsInternetResult vmsTpDownloadMgr::RestartDownloading() { fsInternetResult ir = SetToRestartState (); if (ir != IR_SUCCESS) return ir; return StartDownloading (); }
CDownloadableResource::TState CDownloadableResource::GetDecryptedData( char *pBuffer, int *pOutLen, const char *pDecryptionKey, int decryptionKeyLength, const char *pSigningSalt, int signingSaltLength) { StartDownloading(); bool success = false; if (m_state==k_dataAvailable) { char* pEncryptedBuffer = m_pBuffer+m_contentOffset; int encryptedLength = m_contentLength; char* pDecryptedBuffer = NULL; int decryptedLength = 0; if (DecryptAndCheckSigning(pEncryptedBuffer, encryptedLength, &pDecryptedBuffer, &decryptedLength, pDecryptionKey, decryptionKeyLength, pSigningSalt, signingSaltLength)) { unsigned long destSize = *pOutLen; int error = gEnv->pCryPak->RawUncompress(pBuffer, &destSize, pDecryptedBuffer, (unsigned long)decryptedLength); if (error == 0) { *pOutLen = (int)destSize; success = true; } else { CryLog("Failed to uncompress data"); } delete [] pDecryptedBuffer; pDecryptedBuffer = NULL; } } if (!success) { *pOutLen=0; } return m_state; }
CDownloadableResource::TState CDownloadableResource::GetRawData( char **pOutData, int *pOutLen) { StartDownloading(); if (m_state==k_dataAvailable) { *pOutData=m_pBuffer+m_contentOffset; *pOutLen=m_contentLength; } else { *pOutData=NULL; *pOutLen=0; } return m_state; }
void CDownloadableResource::AddDataListener( IDataListener *pInListener) { CRY_ASSERT_MESSAGE(std::find(m_listeners.begin(), m_listeners.end(), pInListener) == m_listeners.end(), "A downloadable resource should not have two instances of the same listener"); m_listeners.push_back(pInListener); switch (m_broadcastedState) { case k_broadcastedSuccess: pInListener->DataDownloaded(this); break; case k_broadcastedFail: pInListener->DataFailedToDownload(this); break; default: break; } StartDownloading(); }