DragonNest/Server/NetLauncher/UnZipProcess.h

59 lines
1.2 KiB
C
Raw Normal View History

2024-12-19 09:48:26 +08:00
#pragma once
#if defined(PRE_UNZIP_CHANGE)
#define MAX_ZIP_THREAD 8 //UnZip <20>۾<EFBFBD><DBBE><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ִ<EFBFBD> <20><><EFBFBD><EFBFBD>(<28><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20>Ѿ<D1BE><EEB0A1> <20>ӵ<EFBFBD> <20><><EFBFBD>̰<EFBFBD> <20><><EFBFBD><EFBFBD>)
#define MAX_UNZIP_COUNT_IN_THREAD 150 //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ó<><C3B3><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
class CLauncherSession;
class CZipArchive;
class CUnZipProcess
{
public:
CUnZipProcess(CLauncherSession* pSession, LPCTSTR szFilePath, LPCTSTR szFileName);
~CUnZipProcess();
int GetThreadID(){ return m_nThreadCount++;}
bool OpenZip();
bool UnZip();
void WorkerThread(int nThreadID);
private:
struct sZipLength
{
int nStart;
int nEnd;
};
std::vector<sZipLength*> m_ZipLength;
CLauncherSession* m_pLauncherSession;
CZipArchive m_Zip;
CRITICAL_SECTION m_CriticalSection;
TCHAR m_szOutputFolder[MAX_PATH];
TCHAR m_szFileName[MAX_PATH];
int m_nThreadCount;
long m_nUnzipCount;
int m_nMaxThreadCount;
int m_nMaxZipFileCount;
HANDLE m_hZipEndEvent[MAX_ZIP_THREAD];
sZipLength* GetZipLength()
{
EnterCriticalSection(&m_CriticalSection);
if(m_ZipLength.empty())
{
LeaveCriticalSection(&m_CriticalSection);
return NULL;
}
sZipLength* sLength = m_ZipLength.back();
m_ZipLength.pop_back();
LeaveCriticalSection(&m_CriticalSection);
return sLength;
}
};
#endif // #if defined(PRE_UNZIP_CHANGE)