forked from metin2/client
Solution refactoring and restructuring, removed Boost dependency, removed unused tools
This commit is contained in:
96
src/EterPack/EterPackManager.h
Normal file
96
src/EterPack/EterPackManager.h
Normal file
@ -0,0 +1,96 @@
|
||||
#pragma once
|
||||
|
||||
#include <windows.h>
|
||||
#include <unordered_map>
|
||||
#include "../eterBase/Singleton.h"
|
||||
#include "../eterBase/Stl.h"
|
||||
|
||||
#include "EterPack.h"
|
||||
|
||||
class CEterPackManager : public CSingleton<CEterPackManager>
|
||||
{
|
||||
public:
|
||||
struct SCache
|
||||
{
|
||||
BYTE* m_abBufData;
|
||||
DWORD m_dwBufSize;
|
||||
};
|
||||
public:
|
||||
enum ESearchModes
|
||||
{
|
||||
SEARCH_FILE_FIRST,
|
||||
SEARCH_PACK_FIRST
|
||||
};
|
||||
|
||||
typedef std::list<CEterPack*> TEterPackList;
|
||||
typedef std::unordered_map<std::string, CEterPack*, stringhash> TEterPackMap;
|
||||
|
||||
public:
|
||||
CEterPackManager();
|
||||
virtual ~CEterPackManager();
|
||||
|
||||
void SetCacheMode();
|
||||
void SetRelativePathMode();
|
||||
|
||||
void LoadStaticCache(const char* c_szFileName);
|
||||
|
||||
void SetSearchMode(bool bPackFirst);
|
||||
int GetSearchMode();
|
||||
|
||||
//THEMIDA
|
||||
bool Get(CMappedFile & rMappedFile, const char * c_szFileName, LPCVOID * pData);
|
||||
|
||||
//THEMIDA
|
||||
bool GetFromPack(CMappedFile & rMappedFile, const char * c_szFileName, LPCVOID * pData);
|
||||
|
||||
//THEMIDA
|
||||
bool GetFromFile(CMappedFile & rMappedFile, const char * c_szFileName, LPCVOID * pData);
|
||||
bool isExist(const char * c_szFileName);
|
||||
bool isExistInPack(const char * c_szFileName);
|
||||
|
||||
bool RegisterPack(const char * c_szName, const char * c_szDirectory, const BYTE* c_pbIV = NULL);
|
||||
void RegisterRootPack(const char * c_szName);
|
||||
bool RegisterPackWhenPackMaking(const char * c_szName, const char * c_szDirectory, CEterPack* pPack);
|
||||
|
||||
|
||||
bool DecryptPackIV(DWORD key);
|
||||
|
||||
const char * GetRootPackFileName();
|
||||
|
||||
//for hybridcrypt
|
||||
//THEMIDA
|
||||
void WriteHybridCryptPackInfo(const char* pFileName);
|
||||
|
||||
//THEMIDA
|
||||
void RetrieveHybridCryptPackKeys( const BYTE* pStream );
|
||||
//THEMIDA
|
||||
void RetrieveHybridCryptPackSDB( const BYTE* pStream );
|
||||
|
||||
// <20><DEB8> <20><><EFBFBD>ε<EFBFBD> <20>ѵ<EFBFBD> <20><><EFBFBD>, <20><><EFBFBD><EFBFBD><EFBFBD>ؾ<EFBFBD><D8BE><EFBFBD> <20>͵<EFBFBD> <20><><EFBFBD><EFBFBD>.
|
||||
public:
|
||||
void ArrangeMemoryMappedPack();
|
||||
|
||||
protected:
|
||||
int ConvertFileName(const char * c_szFileName, std::string & rstrFileName); // StringPath std::string <20><><EFBFBD><EFBFBD>
|
||||
bool CompareName(const char * c_szDirectoryName, DWORD iLength, const char * c_szFileName);
|
||||
|
||||
CEterPack* FindPack(const char* c_szPathName);
|
||||
|
||||
SCache* __FindCache(DWORD dwFileNameHash);
|
||||
void __ClearCacheMap();
|
||||
|
||||
protected:
|
||||
bool m_bTryRelativePath;
|
||||
bool m_isCacheMode;
|
||||
int m_iSearchMode;
|
||||
|
||||
CEterFileDict m_FileDict;
|
||||
CEterPack m_RootPack;
|
||||
TEterPackList m_PackList;
|
||||
TEterPackMap m_PackMap;
|
||||
TEterPackMap m_DirPackMap;
|
||||
|
||||
std::unordered_map<DWORD, SCache> m_kMap_dwNameKey_kCache;
|
||||
|
||||
CRITICAL_SECTION m_csFinder;
|
||||
};
|
Reference in New Issue
Block a user