87 lines
2.2 KiB
C
87 lines
2.2 KiB
C
|
|
|
|||
|
|
#pragma once
|
|||
|
|
|
|||
|
|
#include "SimpleClientSession.h"
|
|||
|
|
#include "URLUpdater.h"
|
|||
|
|
|
|||
|
|
class CPatchStatusChecker;
|
|||
|
|
|
|||
|
|
class CLauncherSession : public CSimpleClientSession
|
|||
|
|
{
|
|||
|
|
public :
|
|||
|
|
static CLauncherSession * GetInstance();
|
|||
|
|
|
|||
|
|
bool Start(const TCHAR *ip, unsigned short port);
|
|||
|
|
void Stop();
|
|||
|
|
|
|||
|
|
void SendVersion(const char * pVersion);
|
|||
|
|
void SendCrashEvent(int nSID);
|
|||
|
|
void SendPatchState(int nPatchID, const char * pKey, const char * pState, bool bFlag);
|
|||
|
|
void SendPatchProgress(const wchar_t* key, unsigned long progress, unsigned long progressMax);
|
|||
|
|
void SendUnzipProgress(const wchar_t* filename, unsigned long progress, unsigned long progressMax);
|
|||
|
|
void SendPing();
|
|||
|
|
void SendRunBatchState(int nRet, int nBatchID);
|
|||
|
|
void SendStopBatchState(int nBatchID);
|
|||
|
|
void SendLiveExtCopy(bool bRet);
|
|||
|
|
|
|||
|
|
void OnUnzip(const wchar_t* filename, unsigned long progress, unsigned long progressMax);
|
|||
|
|
|
|||
|
|
protected :
|
|||
|
|
bool AddPacket(const DNTPacket * packet);
|
|||
|
|
bool ParsePacket(unsigned char main, unsigned char sub,const void * ptr, int len);
|
|||
|
|
|
|||
|
|
void Connect();
|
|||
|
|
void Destroy();
|
|||
|
|
void TimeEvent();
|
|||
|
|
|
|||
|
|
bool CheckSrcPath(const TCHAR * szPath);
|
|||
|
|
bool CopyFolder(const TCHAR * srcPath, const TCHAR * destPath);
|
|||
|
|
bool CopyFolder(std::string strSrc, std::string strDest);
|
|||
|
|
|
|||
|
|
private :
|
|||
|
|
CLauncherSession();
|
|||
|
|
~CLauncherSession();
|
|||
|
|
|
|||
|
|
static DWORD WINAPI _threadmain(void* param);
|
|||
|
|
|
|||
|
|
void ThreadMain();
|
|||
|
|
HANDLE m_hThread;
|
|||
|
|
volatile bool m_bTerminated;
|
|||
|
|
|
|||
|
|
TCHAR m_szIP[64];
|
|||
|
|
unsigned short m_iPort;
|
|||
|
|
|
|||
|
|
//patch
|
|||
|
|
bool m_bIsNowPatch; //<2F><>ġ<EFBFBD><C4A1>
|
|||
|
|
bool m_bIsPatched; //<2F><>ġ<EFBFBD><C4A1> <20>Ǿ<EFBFBD><C7BE><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>Ǿ<EFBFBD><C7BE><EFBFBD><EFBFBD><EFBFBD> (<28><>ŸƮ <20><><EFBFBD><EFBFBD>ŸƮ <20>ÿ<EFBFBD><C3BF><EFBFBD> üũ <20><><EFBFBD><EFBFBD><EFBFBD>ϸ<EFBFBD> <20>ٽ<EFBFBD> false<73><65>)
|
|||
|
|
|
|||
|
|
void MakePatchPath();
|
|||
|
|
void EmptyDirectory(const char * pPath);
|
|||
|
|
void SwapSlash(const TCHAR * pSrc, TCHAR * pDest);
|
|||
|
|
|
|||
|
|
CURLUpdater m_UrlUpdater;
|
|||
|
|
std::vector <int> m_vManagedTypeList;
|
|||
|
|
WCHAR m_wszBaseURL[256];
|
|||
|
|
WCHAR m_wszPatchURL[256];
|
|||
|
|
|
|||
|
|
bool m_bOtherPath;
|
|||
|
|
|
|||
|
|
CPatchStatusChecker* m_pPatchStatusChecker;
|
|||
|
|
|
|||
|
|
//Parse
|
|||
|
|
static DWORD WINAPI _threadparse(void* param);
|
|||
|
|
|
|||
|
|
void ThreadParse();
|
|||
|
|
HANDLE m_hThreadParse;
|
|||
|
|
HANDLE m_hEventParse;
|
|||
|
|
|
|||
|
|
CLfhHeap m_Mem;
|
|||
|
|
std::list <char *> m_lData;
|
|||
|
|
CSyncLock m_Sync;
|
|||
|
|
|
|||
|
|
bool _InitSession();
|
|||
|
|
|
|||
|
|
void _GetHostIPAddress();
|
|||
|
|
std::string m_strPublicIP;
|
|||
|
|
std::string m_strPrivateIP;
|
|||
|
|
} ;
|