Restructure repository to include all source folders
Move git root from Client/ to src/ to track all source code: - Client: Game client source (moved to Client/Client/) - Server: Game server source - GameTools: Development tools - CryptoSource: Encryption utilities - database: Database scripts - Script: Game scripts - rylCoder_16.02.2008_src: Legacy coder tools - GMFont, Game: Additional resources 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,327 @@
|
||||
|
||||
#include "stdafx.h"
|
||||
|
||||
#include <cstdio>
|
||||
|
||||
#include <Utility/Compress/MiniLZO/MiniLZOWrapper.h>
|
||||
#include <Utility/Resource/EnsureCleanup.h>
|
||||
|
||||
#include <Network/XORCrypt/XORCrypt.h>
|
||||
|
||||
// Ŭ<><C5AC><EFBFBD>̾<EFBFBD>Ʈ<EFBFBD><C6AE><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>̹Ƿ<CCB9> include<64><65> <20><><EFBFBD><EFBFBD><EFBFBD>Ѵ<EFBFBD>.
|
||||
#include <Log/ServerLog.h>
|
||||
|
||||
#include <DB/DBDefine.h>
|
||||
|
||||
#include "Filter.h"
|
||||
|
||||
#define DECODE_HEADER(Start_In, Length_In, PageVer_In, PageNum_In) CXORCrypt::GetInstance().DecodeHeader((Start_In),(Length_In),(PageVer_In),(PageNum_In))
|
||||
#define ENCODE_HEADER(Start_In, Length_In, PageVer_In, PageNum_In) CXORCrypt::GetInstance().EncodeHeader((Start_In),(Length_In),(PageVer_In),(PageNum_In))
|
||||
#define COMPRESS(In, In_len, Out, Out_len) CMiniLZO::Compress((In), (In_len), (Out), (Out_len))
|
||||
#define DECOMPRESS(In, In_len, Out, Out_len) CMiniLZO::Decompress((In), (In_len), (Out), (Out_len))
|
||||
|
||||
static Filter::FilterName g_FilterName;
|
||||
static Filter::FilterName g_AccountName;
|
||||
|
||||
|
||||
//Interface////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// InitFilter [ public ]
|
||||
// - <20><><EFBFBD><EFBFBD> üĿ <20>ʱ<EFBFBD>ȭ
|
||||
//
|
||||
// Parameter :
|
||||
//
|
||||
// Return:
|
||||
//
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||
bool Filter::InitFilter(const char* szFilterFileName)
|
||||
{
|
||||
FILE *pFile;
|
||||
char Buffer[256];
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// <20><> <20>ܾ<EFBFBD>
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||
pFile = fopen((NULL != szFilterFileName) ? szFilterFileName : FilterFileName, "r");
|
||||
if (NULL == pFile) { return false; }
|
||||
|
||||
char Temp[256];
|
||||
|
||||
while(true)
|
||||
{
|
||||
if(fgets(Buffer, 256, pFile) == NULL)
|
||||
break;
|
||||
|
||||
if(strcmp(Buffer, "\n") == 0)
|
||||
continue;
|
||||
|
||||
strcpy(Temp, strtok(Buffer, "\n"));
|
||||
char *Upper = _strlwr(Temp);
|
||||
|
||||
strcpy(g_FilterName.FilterStrings[g_FilterName.Total], Upper);
|
||||
g_FilterName.Total = g_FilterName.Total + 1;
|
||||
}
|
||||
|
||||
fclose(pFile);
|
||||
|
||||
#ifndef _RYL_GAME_CLIENT_
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// <20><><EFBFBD><EFBFBD> <20>ܾ<EFBFBD>
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||
pFile = fopen(LimitFileName, "r");
|
||||
if(pFile != NULL)
|
||||
{
|
||||
g_FilterName.Total = 0;
|
||||
while(true)
|
||||
{
|
||||
if(fgets(Buffer, 256, pFile) == NULL)
|
||||
break;
|
||||
|
||||
if(strcmp(Buffer, "\n") == 0)
|
||||
continue;
|
||||
|
||||
strcpy(Temp, strtok(Buffer, "\n"));
|
||||
char *Upper = _strlwr(Temp);
|
||||
|
||||
strcpy(g_FilterName.FilterStrings[g_FilterName.Total], Upper);
|
||||
g_FilterName.Total = g_FilterName.Total + 1;
|
||||
}
|
||||
|
||||
fclose(pFile);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// <20><><EFBFBD><EFBFBD>
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||
pFile = fopen(AccountFileName, "r");
|
||||
if(pFile != NULL)
|
||||
{
|
||||
while(true)
|
||||
{
|
||||
if(fgets(Buffer, 256, pFile) == NULL)
|
||||
break;
|
||||
|
||||
if(strcmp(Buffer, "\n") == 0)
|
||||
continue;
|
||||
|
||||
strcpy(Temp, strtok(Buffer, "\n"));
|
||||
char *Upper = _strlwr(Temp);
|
||||
|
||||
strcpy(g_AccountName.FilterStrings[g_AccountName.Total], Upper);
|
||||
g_AccountName.Total = g_AccountName.Total + 1;
|
||||
}
|
||||
|
||||
fclose(pFile);
|
||||
}
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//Interface////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// NameCheck [ public ]
|
||||
// - <20≯<EFBFBD> <20>˻<EFBFBD>. Ư<><C6AF> <20≯<EFBFBD><CCB8><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>Ǹ<EFBFBD> false <20><><EFBFBD><EFBFBD>
|
||||
//
|
||||
// Parameter :
|
||||
// 1st : <20≯<EFBFBD>
|
||||
//
|
||||
// Return:
|
||||
//
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||
bool Filter::NameCheck(const char *CheckName_In)
|
||||
{
|
||||
char CheckName[CHAR_INFOST::MAX_NAME_LEN] = "";
|
||||
|
||||
strncpy(CheckName, CheckName_In, sizeof(char) * CHAR_INFOST::MAX_NAME_LEN);
|
||||
CheckName[CHAR_INFOST::MAX_NAME_LEN - 1] = 0;
|
||||
|
||||
char *Upper = _strlwr(CheckName);
|
||||
for(unsigned short ACount = 0; ACount < g_FilterName.Total; ACount++)
|
||||
{
|
||||
if(strstr(Upper, g_FilterName.FilterStrings[ACount]) != NULL)
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//Interface////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// AccountCheck [ public ]
|
||||
// - <20><><EFBFBD><EFBFBD> üũ
|
||||
//
|
||||
// Parameter :
|
||||
// 1st : <20><><EFBFBD><EFBFBD>
|
||||
//
|
||||
// Return:
|
||||
//
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||
bool Filter::AccountCheck(const char *Account_In)
|
||||
{
|
||||
for(unsigned short ACount = 0; ACount < g_FilterName.Total; ACount++)
|
||||
{
|
||||
if(!strcmp(Account_In, g_AccountName.FilterStrings[ACount]) != NULL)
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//Interface////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// ClearFilterDB [ public ]
|
||||
// - <20><><EFBFBD><EFBFBD> üĿ<C3BC><C4BF> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
||||
//
|
||||
// Parameter :
|
||||
//
|
||||
// Return:
|
||||
//
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||
void Filter::ClearFilterDB(void)
|
||||
{
|
||||
for (int nIndex=0; nIndex<g_FilterName.Total; nIndex++)
|
||||
{
|
||||
strcpy(g_FilterName.FilterStrings[nIndex], "\0");
|
||||
}
|
||||
|
||||
g_FilterName.Total = 0;
|
||||
}
|
||||
|
||||
//Interface////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SaveFilterDBToBinary [ public ]
|
||||
// - <20><><EFBFBD><EFBFBD> üĿ<C3BC><C4BF> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>̳ʸ<CCB3> <20><><EFBFBD>Ϸ<EFBFBD> <20><><EFBFBD><EFBFBD>
|
||||
//
|
||||
// Parameter :
|
||||
// 1st : <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20≯<EFBFBD>
|
||||
// 2nd : <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20≯<EFBFBD>
|
||||
//
|
||||
// Return:
|
||||
//
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||
bool Filter::SaveFilterDBToBinary(const char* szFileNameBinary, const char* szTrashFile)
|
||||
{
|
||||
HANDLE hFile = CreateFile(szFileNameBinary,GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
|
||||
|
||||
if (hFile == INVALID_HANDLE_VALUE) { return false; }
|
||||
|
||||
CEnsureCloseHandle file(hFile);
|
||||
|
||||
unsigned long dwFilterSize = static_cast<unsigned long>(MAX_FILTER_LEN * g_FilterName.Total);
|
||||
unsigned long dwCompressSize = dwFilterSize;
|
||||
|
||||
char* lpFilterInfo = new char[dwFilterSize];
|
||||
char* lpCompressedInfo = new char[dwFilterSize];
|
||||
|
||||
if (NULL == lpFilterInfo || NULL == lpCompressedInfo)
|
||||
{
|
||||
ERRLOG0(g_Log, "<EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>մϴ<D5B4>.");
|
||||
return false;
|
||||
}
|
||||
|
||||
CEnsureDeleteArray<char> filterInfo(lpFilterInfo);
|
||||
CEnsureDeleteArray<char> compressInfo(lpCompressedInfo);
|
||||
|
||||
memcpy(lpFilterInfo, g_FilterName.FilterStrings, dwFilterSize);
|
||||
ENCODE_HEADER(lpFilterInfo, dwFilterSize, 0, 1);
|
||||
COMPRESS(lpFilterInfo, dwFilterSize, lpCompressedInfo, &dwCompressSize);
|
||||
|
||||
unsigned long dwWritten = 0;
|
||||
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>(<28><><EFBFBD><EFBFBD>) <20>ڷ<EFBFBD>
|
||||
HANDLE hTrashFile = CreateFile(szTrashFile, GENERIC_READ, FILE_SHARE_READ, NULL,
|
||||
OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
|
||||
|
||||
if (hTrashFile == INVALID_HANDLE_VALUE)
|
||||
{
|
||||
ERRLOG1(g_Log, "%s <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><> <20><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD>.", szTrashFile);
|
||||
return false;
|
||||
}
|
||||
|
||||
CEnsureCloseHandle trashFile(hTrashFile);
|
||||
|
||||
unsigned long dwRead = 0;
|
||||
unsigned long dwFileHighSize = 0;
|
||||
unsigned long dwFileSize = GetFileSize(hTrashFile, &dwFileHighSize);
|
||||
|
||||
char* lpAllocated = new char[dwFileSize];
|
||||
CEnsureDeleteArray<char> allocated(lpAllocated);
|
||||
|
||||
if (false == ReadFile(hTrashFile, lpAllocated, dwFileSize, &dwRead, NULL))
|
||||
{
|
||||
ERRLOG0(g_Log, "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD>.");
|
||||
return false;
|
||||
}
|
||||
|
||||
WriteFile(hFile, &dwFileSize, sizeof(unsigned long), &dwWritten, 0);
|
||||
WriteFile(hFile, lpAllocated, dwFileSize, &dwWritten, 0);
|
||||
|
||||
// <20>ùٸ<C3B9> <20>ڷ<EFBFBD>
|
||||
WriteFile(hFile, &dwFilterSize, sizeof(unsigned long), &dwWritten, 0); // <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ũ<><C5A9>
|
||||
WriteFile(hFile, lpCompressedInfo, dwCompressSize, &dwWritten, 0); // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ũ<><C5A9>
|
||||
return true;
|
||||
}
|
||||
|
||||
//Interface////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// LoadFilterDBFromBinary [ public ]
|
||||
// - <20><><EFBFBD>̳ʸ<CCB3> <20><><EFBFBD>Ͽ<EFBFBD><CFBF><EFBFBD> <20><><EFBFBD><EFBFBD> üĿ<C3BC><C4BF> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
||||
//
|
||||
// Parameter :
|
||||
// 1st : <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20≯<EFBFBD>
|
||||
//
|
||||
// Return:
|
||||
//
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||
bool Filter::LoadFilterDBFromBinary(const char* szFileNameBinary)
|
||||
{
|
||||
HANDLE hFile = CreateFile(szFileNameBinary,GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
|
||||
|
||||
if (hFile == INVALID_HANDLE_VALUE) { return false; }
|
||||
|
||||
CEnsureCloseHandle hfile(hFile);
|
||||
|
||||
unsigned long dwRead = 0;
|
||||
unsigned long dwFileHighSize = 0;
|
||||
unsigned long dwFileSize = GetFileSize(hFile, &dwFileHighSize);
|
||||
|
||||
char* lpAllocated = new char[dwFileSize];
|
||||
CEnsureDeleteArray<char> allocated(lpAllocated);
|
||||
|
||||
if (NULL == lpAllocated)
|
||||
{
|
||||
ERRLOG0(g_Log, "<EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>մϴ<D5B4>.");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (false == ReadFile(hFile, lpAllocated, dwFileSize, &dwRead, NULL))
|
||||
{
|
||||
ERRLOG1(g_Log, "<EFBFBD>б<EFBFBD> <20><><EFBFBD><EFBFBD> : %d<><64><EFBFBD><EFBFBD>", GetLastError());
|
||||
return false;
|
||||
}
|
||||
|
||||
unsigned long dwHeaderSize = sizeof(unsigned long) + *reinterpret_cast<unsigned long*>(lpAllocated) + sizeof(unsigned long);
|
||||
unsigned long dwDecompressedSize = *reinterpret_cast<unsigned long*>(lpAllocated + dwHeaderSize - sizeof(unsigned long));
|
||||
|
||||
ClearFilterDB();
|
||||
|
||||
g_FilterName.Total = static_cast<unsigned short>(dwDecompressedSize / MAX_FILTER_LEN);
|
||||
|
||||
DECOMPRESS(lpAllocated + dwHeaderSize, dwFileSize - dwHeaderSize,
|
||||
reinterpret_cast<char *>(&g_FilterName.FilterStrings), &dwDecompressedSize);
|
||||
DECODE_HEADER(reinterpret_cast<char *>(&g_FilterName.FilterStrings), dwDecompressedSize, 0, 1);
|
||||
return true;
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// <20><><EFBFBD><EFBFBD>
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||
#ifndef _Filter
|
||||
#define _Filter
|
||||
|
||||
namespace Filter
|
||||
{
|
||||
const char LimitFileName[] = "./Script/Server/WordFilter.txt";
|
||||
const char FilterFileName[] = "./Script/Server/Abuse.txt";
|
||||
const char AccountFileName[] = "./Script/Server/Account.txt";
|
||||
|
||||
enum
|
||||
{
|
||||
LIMIT_STRING_NUM = 4000,
|
||||
MAX_FILTER_LEN = 15
|
||||
};
|
||||
|
||||
struct FilterName
|
||||
{
|
||||
unsigned short Total;
|
||||
char FilterStrings[LIMIT_STRING_NUM][MAX_FILTER_LEN];
|
||||
};
|
||||
|
||||
bool InitFilter(const char* szFilterFileName = NULL);
|
||||
bool NameCheck(const char *CheckName_In);
|
||||
bool AccountCheck(const char *Account_In);
|
||||
|
||||
void ClearFilterDB(void);
|
||||
bool SaveFilterDBToBinary(const char* szFileNameBinary, const char* szTrashFile);
|
||||
bool LoadFilterDBFromBinary(const char* szFileNameBinary);
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,79 @@
|
||||
#include "stdafx.h"
|
||||
#include "ConsoleCMDFactory.h"
|
||||
#include <BaseLibrary/Utility/Math/Math.h>
|
||||
|
||||
CConsoleCMDFactory::StringCMD::StringCMD(const TCHAR* szCommand, CConsoleCommand* lpCMD)
|
||||
: m_szCommand(szCommand), m_lpCMD(lpCMD),
|
||||
m_dwHashValue(Math::HashFunc::sdbmHash(reinterpret_cast<const unsigned char*>(szCommand)))
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
CConsoleCMDFactory::CConsoleCMDFactory()
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
CConsoleCMDFactory::~CConsoleCMDFactory()
|
||||
{
|
||||
for(CMDVector::iterator itr = m_CMDVector.begin();
|
||||
itr != m_CMDVector.end(); ++itr)
|
||||
{
|
||||
delete itr->m_lpCMD;
|
||||
}
|
||||
|
||||
m_CMDVector.clear();
|
||||
}
|
||||
|
||||
|
||||
bool CConsoleCMDFactory::AddCommand(const TCHAR* szCommand, CConsoleCommand* lpConsoleCommand)
|
||||
{
|
||||
if(0 == szCommand, 0 == lpConsoleCommand)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
m_CMDVector.push_back(StringCMD(szCommand, lpConsoleCommand));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// Desc : <20>ִ<EFBFBD> <20><><EFBFBD>ڿ<EFBFBD><DABF><EFBFBD> Ŀ<>ǵ<EFBFBD> <20><><EFBFBD><EFBFBD>.
|
||||
CConsoleCommand* CConsoleCMDFactory::Create(const TCHAR* szCommand, size_t nCommandLength)
|
||||
{
|
||||
// ù<><C3B9>° WhiteSpace<63><65> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>Ÿ<EFBFBD><C5B8><EFBFBD> <20><><EFBFBD>Ѵ<EFBFBD>.
|
||||
size_t nIndex = 0;
|
||||
for (; nIndex < nCommandLength; ++nIndex)
|
||||
{
|
||||
if (TEXT('\0') == szCommand[nIndex] || TEXT(' ') == szCommand[nIndex] ||
|
||||
TEXT('\t') == szCommand[nIndex] || TEXT('\n') == szCommand[nIndex])
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
const int MAX_BUFFER = 256;
|
||||
char szCommandOnly[MAX_BUFFER];
|
||||
|
||||
if(nIndex < MAX_BUFFER)
|
||||
{
|
||||
memcpy(szCommandOnly, szCommand, nIndex);
|
||||
szCommandOnly[nIndex] = 0;
|
||||
|
||||
for (CMDVector::iterator itr = m_CMDVector.begin();
|
||||
itr != m_CMDVector.end(); ++itr)
|
||||
{
|
||||
StringCMD& stringCMD = *itr;
|
||||
|
||||
if (0 == _tcscmp(stringCMD.m_szCommand, szCommandOnly))
|
||||
{
|
||||
return stringCMD.m_lpCMD->Clone(szCommand, nCommandLength);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
#ifndef _CONSOLE_COMMAND_FACTORY_H_
|
||||
#define _CONSOLE_COMMAND_FACTORY_H_
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <winsock2.h>
|
||||
#include <windows.h>
|
||||
|
||||
#include <Pattern/Command.h>
|
||||
|
||||
#include <vector>
|
||||
|
||||
class CConsoleCommand : public CCommand
|
||||
{
|
||||
protected:
|
||||
|
||||
virtual CConsoleCommand* Clone(const TCHAR* szCommand, size_t nCommandLength) = 0;
|
||||
friend class CConsoleCMDFactory;
|
||||
};
|
||||
|
||||
// Singleton Ŀ<>ǵ<EFBFBD> <20>ν<EFBFBD><CEBD>Ͻ<EFBFBD>. ( <20>ΰ<EFBFBD> Ŀ<>ǵ尡 <20><><EFBFBD><EFBFBD> <20><><EFBFBD>쿡 <20><><EFBFBD><EFBFBD>. )
|
||||
template<typename Derived>
|
||||
class CConsoleCMDSingleton : public CConsoleCommand
|
||||
{
|
||||
public:
|
||||
inline virtual CConsoleCommand* Clone(const TCHAR* szCommand, size_t nCommandLength);
|
||||
virtual bool Destroy() { return true; }
|
||||
};
|
||||
|
||||
template<typename Derived>
|
||||
inline CConsoleCommand* CConsoleCMDSingleton<Derived>::Clone(const TCHAR* szCommand, size_t nCommandLength)
|
||||
{
|
||||
static Derived Instance;
|
||||
return &Instance;
|
||||
}
|
||||
|
||||
// <20>ܼ<EFBFBD> Ŀ<>ǵ<EFBFBD> <20><><EFBFBD>丮.
|
||||
class CConsoleCMDFactory
|
||||
{
|
||||
public:
|
||||
|
||||
enum
|
||||
{
|
||||
MAX_CMD_BUFFER = 512 // <20>ִ<EFBFBD> Ŀ<>ǵ<EFBFBD> <20><><EFBFBD><EFBFBD> ũ<><C5A9>.
|
||||
};
|
||||
|
||||
CConsoleCMDFactory();
|
||||
virtual ~CConsoleCMDFactory();
|
||||
|
||||
// Desc : Ŀ<>ǵ带 <20>߰<EFBFBD><DFB0>Ѵ<EFBFBD>. szCommand<6E><64> <20>ݵ<EFBFBD><DDB5><EFBFBD> <20><><EFBFBD>ڿ<EFBFBD> <20><><EFBFBD>ͷ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>̿<EFBFBD><CCBF>߸<EFBFBD> <20>Ѵ<EFBFBD>.
|
||||
bool AddCommand(const TCHAR* szCommand, CConsoleCommand* lpConsoleCommand);
|
||||
|
||||
// Desc : Ŀ<>ǵ尡 <20><><EFBFBD>Ŀ<EFBFBD><C4BF><EFBFBD> <20>ʿ<EFBFBD><CABF>ϸ<EFBFBD>, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><>.
|
||||
CConsoleCommand* Create(const TCHAR* szCommand, size_t nCommandLength);
|
||||
|
||||
protected:
|
||||
|
||||
struct StringCMD
|
||||
{
|
||||
unsigned long m_dwHashValue;
|
||||
const TCHAR* m_szCommand;
|
||||
CConsoleCommand* m_lpCMD;
|
||||
|
||||
StringCMD(const TCHAR* szCommand, CConsoleCommand* lpCMD);
|
||||
};
|
||||
|
||||
typedef std::vector<StringCMD> CMDVector;
|
||||
CMDVector m_CMDVector;
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,323 @@
|
||||
#include "stdafx.h"
|
||||
#include "ConsoleWindow.h"
|
||||
|
||||
#include <windowsx.h>
|
||||
#include <Pattern/Command.h>
|
||||
#include "ConsoleCMDFactory.h"
|
||||
|
||||
const TCHAR* WINCONSOLE_CLASSNAME = TEXT("RowConsoleWindow");
|
||||
const TCHAR* WINCONSOLE_FONTNAME = TEXT("Arial");
|
||||
|
||||
const int WINCONSOLE_FONTSIZE = 10; // font height<68><74>. ^^;;
|
||||
const unsigned int WINCONSOLE_WIDTH = 480;
|
||||
const unsigned int WINCONSOLE_HEIGHT = 640;
|
||||
|
||||
const unsigned int WINCONSOLE_INFO_HEIGHT = 450;
|
||||
const unsigned int WINCONSOLE_INPUT_HEIGHT = 24;
|
||||
const unsigned int WINCONSOLE_OUTPUT_HEIGHT = WINCONSOLE_HEIGHT - WINCONSOLE_INFO_HEIGHT - WINCONSOLE_INPUT_HEIGHT-30;
|
||||
const unsigned int WINCONSOLE_X = (GetSystemMetrics(SM_CXSCREEN) - WINCONSOLE_WIDTH - 20);
|
||||
const unsigned int WINCONSOLE_Y = (20);
|
||||
|
||||
const unsigned int MAX_OUTPUT_COUNT = 50;
|
||||
|
||||
const UINT CConsoleWindow::ms_PrintOutputMsg = RegisterWindowMessage(TEXT("ConsoleWindowCustomPrintOutput"));
|
||||
const UINT CConsoleWindow::ms_PrintInfoMsg = RegisterWindowMessage(TEXT("ConsoleWindowCustomPrintInfo"));
|
||||
const TCHAR* CConsoleWindow::ms_this = TEXT("RowConsoleWindow");
|
||||
|
||||
|
||||
CConsoleWindow::CConsoleWindow(HINSTANCE hInstance, HWND hParentWnd,
|
||||
CConsoleCMDFactory& CMDFactory, CCommandProcess& CMDProcess)
|
||||
: m_hParentWnd(hParentWnd), m_hWnd(0),
|
||||
m_hWndInfo(0), m_hWndInput(0), m_hWndOutput(0),
|
||||
m_hFont(0), m_fOldProc(0), m_hInstance(hInstance),
|
||||
m_CMDFactory(CMDFactory), m_CMDProcess(CMDProcess),
|
||||
m_MsgPool(MAX_MESSAGE_SIZE)
|
||||
{
|
||||
memset(m_szWindowName, 0, sizeof(char) * MAX_WINDOW_NAME);
|
||||
}
|
||||
|
||||
|
||||
CConsoleWindow::~CConsoleWindow()
|
||||
{
|
||||
Destroy();
|
||||
}
|
||||
|
||||
|
||||
bool CConsoleWindow::Initialize(const char* szWindowName)
|
||||
{
|
||||
ConsoleWindowLock::Syncronize sync(m_ConsoleWindowLock);
|
||||
|
||||
if(0 != m_hWnd)
|
||||
{
|
||||
// <20>̹<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>Ǿ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ʴ´<CAB4>.
|
||||
return true;
|
||||
}
|
||||
|
||||
strncpy(m_szWindowName, szWindowName, MAX_WINDOW_NAME - 1);
|
||||
m_szWindowName[MAX_WINDOW_NAME - 1] = 0;
|
||||
|
||||
WNDCLASS wc;
|
||||
|
||||
wc.cbClsExtra = 0;
|
||||
wc.cbWndExtra = 0;
|
||||
wc.hbrBackground = (HBRUSH)GetStockObject(GRAY_BRUSH);
|
||||
wc.hCursor = LoadCursor(0, IDC_ARROW);
|
||||
wc.hIcon = LoadIcon(0, IDI_APPLICATION);
|
||||
wc.hInstance = m_hInstance;
|
||||
wc.lpfnWndProc = CConsoleWindow::ConsoleWindowProc;
|
||||
wc.lpszClassName = WINCONSOLE_CLASSNAME;
|
||||
wc.lpszMenuName = 0;
|
||||
wc.style = CS_HREDRAW | CS_VREDRAW;
|
||||
|
||||
if (!RegisterClass(&wc))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
m_hWnd = CreateWindowEx(WS_EX_CLIENTEDGE, WINCONSOLE_CLASSNAME, m_szWindowName, WS_VISIBLE,
|
||||
WINCONSOLE_X, WINCONSOLE_Y, WINCONSOLE_WIDTH, WINCONSOLE_HEIGHT, m_hParentWnd, 0, m_hInstance, 0);
|
||||
|
||||
if(0 == m_hWnd)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if(FALSE == SetProp(m_hWnd, ms_this, reinterpret_cast<HANDLE>(this)))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
m_hWndInfo = CreateWindowEx(WS_EX_CLIENTEDGE, "EDIT", "information ====================================",
|
||||
WS_CHILD | WS_VISIBLE | WS_VSCROLL | ES_READONLY | ES_MULTILINE,
|
||||
0, 0, WINCONSOLE_WIDTH - 10, WINCONSOLE_INFO_HEIGHT, m_hWnd, 0, m_hInstance, 0);
|
||||
|
||||
if(0 == m_hWndInfo)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
m_hWndOutput = CreateWindowEx(WS_EX_CLIENTEDGE, "LISTBOX", "", WS_CHILD | WS_VISIBLE | WS_VSCROLL | LBS_NOSEL,
|
||||
0, WINCONSOLE_INFO_HEIGHT, WINCONSOLE_WIDTH - 10, WINCONSOLE_OUTPUT_HEIGHT,
|
||||
m_hWnd, 0, m_hInstance, 0);
|
||||
|
||||
if(0 == m_hWndOutput)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
m_hWndInput = CreateWindowEx(WS_EX_CLIENTEDGE, "EDIT", "", WS_CHILD | WS_VISIBLE, 0,
|
||||
WINCONSOLE_INFO_HEIGHT + WINCONSOLE_OUTPUT_HEIGHT-10, WINCONSOLE_WIDTH - 10,
|
||||
WINCONSOLE_INPUT_HEIGHT, m_hWnd, 0, m_hInstance, 0);
|
||||
|
||||
if(0 == m_hWndInput)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
m_fOldProc = (LONG_PTR)SetWindowLongPtr(m_hWndInput, GWLP_WNDPROC,
|
||||
(LONG)((LONG_PTR)CConsoleWindow::InputWindowProc));
|
||||
|
||||
if(FALSE == SetProp(m_hWndInput, ms_this, reinterpret_cast<HANDLE>(this)))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
//subclass the edit control
|
||||
if ((m_hFont = CreateFont(-(WINCONSOLE_FONTSIZE), 0, // Height, Font-width
|
||||
0, 0, // Angle
|
||||
FW_NORMAL, // Weight
|
||||
FALSE, // Italic
|
||||
FALSE, // Underline
|
||||
FALSE, // ...
|
||||
DEFAULT_CHARSET,
|
||||
OUT_DEFAULT_PRECIS,
|
||||
CLIP_DEFAULT_PRECIS,
|
||||
DEFAULT_QUALITY, // DEFAULT_PITCH | FF_DONTCARE,
|
||||
FIXED_PITCH | FF_DONTCARE,
|
||||
WINCONSOLE_FONTNAME)) == 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// <20><EFBFBD><F1B5BFB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><EFBFBD><DEBD><EFBFBD> ť<><C5A5> <20><><EFBFBD><EFBFBD><EFBFBD>ϱ<EFBFBD> <20><><EFBFBD>ؼ<EFBFBD> SendMessage <20><> PostMessage <20><> <20>ٲ<EFBFBD>. 2002.09.07
|
||||
PostMessage(m_hWndInfo, WM_SETFONT, (WPARAM)m_hFont, (LPARAM)MAKELPARAM(FALSE, 0));
|
||||
PostMessage(m_hWndOutput, WM_SETFONT, (WPARAM)m_hFont, (LPARAM)MAKELPARAM(FALSE, 0));
|
||||
PostMessage(m_hWndInput, WM_SETFONT, (WPARAM)m_hFont, (LPARAM)MAKELPARAM(FALSE, 0));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
#define SAFE_DESTROY_WND(hWnd) if(0 != (hWnd)) { DestroyWindow((hWnd)); (hWnd) = 0; }
|
||||
|
||||
bool CConsoleWindow::Destroy()
|
||||
{
|
||||
ConsoleWindowLock::Syncronize sync(m_ConsoleWindowLock);
|
||||
|
||||
if (m_hFont)
|
||||
{
|
||||
DeleteObject((HGDIOBJ)m_hFont);
|
||||
m_hFont = 0;
|
||||
}
|
||||
|
||||
SAFE_DESTROY_WND(m_hWndInfo);
|
||||
SAFE_DESTROY_WND(m_hWndInput);
|
||||
SAFE_DESTROY_WND(m_hWndOutput);
|
||||
SAFE_DESTROY_WND(m_hWnd);
|
||||
|
||||
UnregisterClass(WINCONSOLE_CLASSNAME, m_hInstance);
|
||||
return true;
|
||||
}
|
||||
|
||||
void CConsoleWindow::PrintOutput(const TCHAR* lpFormat, ...)
|
||||
{
|
||||
ConsoleWindowLock::Syncronize sync(m_ConsoleWindowLock);
|
||||
|
||||
if(0 != m_hWnd)
|
||||
{
|
||||
TCHAR* szText = reinterpret_cast<TCHAR*>(m_MsgPool.malloc());
|
||||
if(0 != szText)
|
||||
{
|
||||
va_list arguments;
|
||||
va_start(arguments, lpFormat);
|
||||
int nLength = _vsntprintf(szText, MAX_MESSAGE_SIZE - 1, lpFormat, arguments);
|
||||
va_end(arguments);
|
||||
|
||||
if(0 < nLength)
|
||||
{
|
||||
szText[nLength] = 0;
|
||||
PostMessage(m_hWnd, ms_PrintOutputMsg, (WPARAM)szText, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CConsoleWindow::PrintInfo(const TCHAR* lpFormat, ...)
|
||||
{
|
||||
ConsoleWindowLock::Syncronize sync(m_ConsoleWindowLock);
|
||||
|
||||
if(0 != m_hWnd)
|
||||
{
|
||||
TCHAR* szText = reinterpret_cast<TCHAR*>(m_MsgPool.malloc());
|
||||
if(0 != szText)
|
||||
{
|
||||
va_list arguments;
|
||||
va_start(arguments, lpFormat);
|
||||
int nLength = _vsntprintf(szText, MAX_MESSAGE_SIZE - 1, lpFormat, arguments);
|
||||
va_end(arguments);
|
||||
|
||||
if(0 < nLength)
|
||||
{
|
||||
szText[nLength] = 0;
|
||||
PostMessage(m_hWnd, ms_PrintInfoMsg, (WPARAM)szText, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
LRESULT CALLBACK CConsoleWindow::ConsoleWindowProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
CConsoleWindow* lpConsoleWindow =
|
||||
reinterpret_cast<CConsoleWindow*>(GetProp(hWnd, ms_this));
|
||||
|
||||
if(0 == lpConsoleWindow )
|
||||
{
|
||||
return DefWindowProc(hWnd, msg, wParam, lParam);
|
||||
}
|
||||
|
||||
if(msg == ms_PrintOutputMsg && 0 != wParam)
|
||||
{
|
||||
TCHAR* szText = reinterpret_cast<TCHAR*>(wParam);
|
||||
|
||||
HWND hWndOutput = lpConsoleWindow->m_hWndOutput;
|
||||
|
||||
int nEndIndex = ListBox_GetCount(hWndOutput);
|
||||
if(nEndIndex > MAX_OUTPUT_COUNT)
|
||||
{
|
||||
ListBox_DeleteString(hWndOutput, 0);
|
||||
}
|
||||
|
||||
ListBox_AddString(hWndOutput, szText);
|
||||
ListBox_SetTopIndex(hWndOutput, nEndIndex - 1);
|
||||
|
||||
ConsoleWindowLock::Syncronize sync(lpConsoleWindow->m_ConsoleWindowLock);
|
||||
lpConsoleWindow->m_MsgPool.free(szText);
|
||||
}
|
||||
else if (msg == ms_PrintInfoMsg && 0 != wParam)
|
||||
{
|
||||
TCHAR* szText = reinterpret_cast<TCHAR*>(wParam);
|
||||
|
||||
HWND hWndInfo = lpConsoleWindow->m_hWndInfo;
|
||||
|
||||
SetWindowText(hWndInfo, szText);
|
||||
UpdateWindow(hWndInfo);
|
||||
|
||||
ConsoleWindowLock::Syncronize sync(lpConsoleWindow->m_ConsoleWindowLock);
|
||||
lpConsoleWindow->m_MsgPool.free(szText);
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (msg)
|
||||
{
|
||||
case WM_CLOSE:
|
||||
SetWindowLongPtr(lpConsoleWindow->m_hWndInput, GWLP_WNDPROC, (LONG)lpConsoleWindow->m_fOldProc);
|
||||
PostQuitMessage(0);
|
||||
break;
|
||||
|
||||
case WM_CTLCOLORLISTBOX :
|
||||
SetBkColor((HDC) wParam, GetSysColor(COLOR_BTNFACE));
|
||||
return (LRESULT) GetSysColorBrush(COLOR_BTNFACE);
|
||||
|
||||
default:
|
||||
return DefWindowProc(hWnd, msg, wParam, lParam);
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
LRESULT CALLBACK CConsoleWindow::InputWindowProc(HWND hWnd, WORD msg, WORD wParam, LONG lParam)
|
||||
{
|
||||
CConsoleWindow* lpConsoleWindow =
|
||||
reinterpret_cast<CConsoleWindow*>(GetProp(hWnd, ms_this));
|
||||
|
||||
if(0 == lpConsoleWindow || 0 == lpConsoleWindow->m_fOldProc)
|
||||
{
|
||||
return DefWindowProc(hWnd, msg, wParam, lParam);
|
||||
}
|
||||
else if (WM_CHAR == msg)
|
||||
{
|
||||
if (VK_RETURN == wParam)
|
||||
{
|
||||
lpConsoleWindow->CreateCommand();
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
return (LONG)CallWindowProc((WNDPROC)lpConsoleWindow->m_fOldProc, hWnd, msg, wParam, lParam);
|
||||
}
|
||||
|
||||
|
||||
void CConsoleWindow::CreateCommand()
|
||||
{
|
||||
TCHAR szCommand[CConsoleCMDFactory::MAX_CMD_BUFFER];
|
||||
|
||||
int nLength = GetWindowText(m_hWndInput, szCommand, CConsoleCMDFactory::MAX_CMD_BUFFER);
|
||||
if(0 < nLength)
|
||||
{
|
||||
CConsoleCommand* lpCommand = m_CMDFactory.Create(szCommand, nLength);
|
||||
if(0 != lpCommand)
|
||||
{
|
||||
PrintOutput(szCommand);
|
||||
m_CMDProcess.Add(lpCommand);
|
||||
}
|
||||
else
|
||||
{
|
||||
PrintOutput(TEXT("Can't recognize command. Please reinput."));
|
||||
}
|
||||
}
|
||||
|
||||
SetWindowText(m_hWndInput, "");
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
#ifndef _CONSOLE_WINDOW_H_
|
||||
#define _CONSOLE_WINDOW_H_
|
||||
|
||||
#include <winsock2.h>
|
||||
#include <windows.h>
|
||||
#include <tchar.h>
|
||||
#include <Thread/Lock.h>
|
||||
#include <boost/pool/pool.hpp>
|
||||
|
||||
// <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
||||
class CCommandProcess;
|
||||
class CConsoleCMDFactory;
|
||||
|
||||
class CConsoleWindow
|
||||
{
|
||||
public:
|
||||
|
||||
enum Const
|
||||
{
|
||||
MAX_MESSAGE_SIZE = 8192,
|
||||
MAX_WINDOW_NAME = 128
|
||||
};
|
||||
|
||||
CConsoleWindow(HINSTANCE hInstance, HWND hParentWnd,
|
||||
CConsoleCMDFactory& CMDFactory, CCommandProcess& CMDProcess);
|
||||
virtual ~CConsoleWindow();
|
||||
|
||||
bool Initialize(const char* szWindowName);
|
||||
bool Destroy();
|
||||
|
||||
CCommandProcess& GetCMDProcess() { return m_CMDProcess; }
|
||||
CConsoleCMDFactory& GetConsoleCMDFactory() { return m_CMDFactory; }
|
||||
|
||||
void PrintOutput(const TCHAR* lpFormat, ...);
|
||||
void PrintInfo(const TCHAR* lpFormat, ...);
|
||||
|
||||
private:
|
||||
|
||||
void CreateCommand();
|
||||
|
||||
// static members
|
||||
static LRESULT CALLBACK ConsoleWindowProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
|
||||
static LRESULT CALLBACK InputWindowProc(HWND hWnd, WORD msg, WORD wParam, LONG lParam);
|
||||
|
||||
static const UINT ms_PrintOutputMsg;
|
||||
static const UINT ms_PrintInfoMsg;
|
||||
static const TCHAR* ms_this;
|
||||
|
||||
typedef CCSLock ConsoleWindowLock;
|
||||
|
||||
ConsoleWindowLock m_ConsoleWindowLock;
|
||||
CACHE_PAD(Padding, sizeof(ConsoleWindowLock));
|
||||
|
||||
HWND m_hParentWnd;
|
||||
HWND m_hWnd;
|
||||
HWND m_hWndInfo;
|
||||
HWND m_hWndInput;
|
||||
HWND m_hWndOutput;
|
||||
|
||||
HFONT m_hFont;
|
||||
HINSTANCE m_hInstance;
|
||||
LONG_PTR m_fOldProc;
|
||||
|
||||
char m_szWindowName[MAX_WINDOW_NAME];
|
||||
|
||||
CCommandProcess& m_CMDProcess;
|
||||
CConsoleCMDFactory& m_CMDFactory;
|
||||
|
||||
boost::pool<> m_MsgPool;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,48 @@
|
||||
#include "stdafx.h"
|
||||
#include "MsgProc.h"
|
||||
|
||||
CMsgProcessMgr::CMsgProcessMgr()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
CMsgProcessMgr::~CMsgProcessMgr()
|
||||
{
|
||||
Clear();
|
||||
}
|
||||
|
||||
|
||||
bool CMsgProcessMgr::Register(UINT uMsg, CMsgProc* lpMsgProcessProc)
|
||||
{
|
||||
return m_MessageProcessMap.insert(
|
||||
MessageProcessMap::value_type(uMsg, lpMsgProcessProc)).second;
|
||||
}
|
||||
|
||||
|
||||
bool CMsgProcessMgr::Remove(UINT uMsg)
|
||||
{
|
||||
return (0 != m_MessageProcessMap.erase(uMsg));
|
||||
}
|
||||
|
||||
|
||||
CMsgProc* CMsgProcessMgr::FindMsgProc(UINT uMsg)
|
||||
{
|
||||
MessageProcessMap::iterator find = m_MessageProcessMap.find(uMsg);
|
||||
MessageProcessMap::iterator end = m_MessageProcessMap.end();
|
||||
|
||||
return (find != end) ? find->second : 0;
|
||||
}
|
||||
|
||||
|
||||
void CMsgProcessMgr::Clear()
|
||||
{
|
||||
MessageProcessMap::iterator pos = m_MessageProcessMap.begin();
|
||||
MessageProcessMap::iterator end = m_MessageProcessMap.end();
|
||||
|
||||
for(; pos != end; ++pos)
|
||||
{
|
||||
delete pos->second;
|
||||
}
|
||||
|
||||
m_MessageProcessMap.clear();
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
#ifndef _GM_NETWORK_MSG_PROC_
|
||||
#define _GM_NETWORK_MSG_PROC_
|
||||
|
||||
#include <winsock2.h>
|
||||
#include <windows.h>
|
||||
#include <map>
|
||||
|
||||
class CMsgProc
|
||||
{
|
||||
public:
|
||||
virtual ~CMsgProc() = 0;
|
||||
virtual LRESULT operator () (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) = 0;
|
||||
};
|
||||
|
||||
inline CMsgProc::~CMsgProc() { }
|
||||
|
||||
class CMsgProcessMgr
|
||||
{
|
||||
public:
|
||||
|
||||
CMsgProcessMgr();
|
||||
~CMsgProcessMgr();
|
||||
|
||||
bool Register(UINT uMsg, CMsgProc* lpMsgProcessProc);
|
||||
bool Remove(UINT uMsg);
|
||||
|
||||
CMsgProc* FindMsgProc(UINT uMsg);
|
||||
|
||||
void Clear();
|
||||
|
||||
private:
|
||||
|
||||
typedef std::map<UINT, CMsgProc*> MessageProcessMap;
|
||||
|
||||
MessageProcessMap m_MessageProcessMap;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,213 @@
|
||||
#include "stdafx.h"
|
||||
#include "TimerProc.h"
|
||||
|
||||
const TCHAR* CTimerProcMgr::ms_this = TEXT("CTimerProcMgr");
|
||||
|
||||
const CTimerProcMgr::TIMER_ID CTimerProcMgr::INVALID_TIMER_ID = 0xFFFFFFFF;
|
||||
const CTimerProcMgr::PROC_ID CTimerProcMgr::INVALID_PROC_ID = 0xFFFFFFFF;
|
||||
|
||||
|
||||
CTimerProcMgr::CTimerProcMgr()
|
||||
: m_nProcIDCounter(1),
|
||||
m_nTimerIDCounter(1)
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
CTimerProcMgr::~CTimerProcMgr()
|
||||
{
|
||||
ClearAll();
|
||||
}
|
||||
|
||||
|
||||
CTimerProcMgr::TIMER_ID CTimerProcMgr::CreateTimer(HWND hOwnerWnd, unsigned long dwInterval)
|
||||
{
|
||||
TIMER_ID nTimerID = GetTimerID(hOwnerWnd, dwInterval);
|
||||
|
||||
if(INVALID_TIMER_ID == nTimerID)
|
||||
{
|
||||
std::pair<TimerMap::iterator, bool> result_pair;
|
||||
result_pair.second = false;
|
||||
|
||||
do
|
||||
{
|
||||
nTimerID = m_nTimerIDCounter++;
|
||||
|
||||
result_pair = m_TimerMap.insert(
|
||||
TimerMap::value_type(nTimerID, InternalTimerData(hOwnerWnd, dwInterval)));
|
||||
|
||||
if(result_pair.second)
|
||||
{
|
||||
if(0 == SetTimer(hOwnerWnd, nTimerID, dwInterval, CTimerProcMgr::TimerProc))
|
||||
{
|
||||
nTimerID = INVALID_TIMER_ID;
|
||||
m_TimerMap.erase(result_pair.first);
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
SetProp(hOwnerWnd, ms_this, this);
|
||||
}
|
||||
}
|
||||
|
||||
} while(!result_pair.second);
|
||||
}
|
||||
|
||||
return nTimerID;
|
||||
}
|
||||
|
||||
bool CTimerProcMgr::RemoveTimer(TIMER_ID nTimerID)
|
||||
{
|
||||
TimerMap::iterator find = m_TimerMap.find(nTimerID);
|
||||
TimerMap::iterator end = m_TimerMap.end();
|
||||
|
||||
if(find != end)
|
||||
{
|
||||
InternalTimerData& timerData = find->second;
|
||||
KillTimer(timerData.m_hOwnerWnd, find->first);
|
||||
|
||||
TimerProcessList::iterator process_pos = timerData.m_timerProcessList.begin();
|
||||
TimerProcessList::iterator process_end = timerData.m_timerProcessList.end();
|
||||
|
||||
for(;process_pos != process_end; ++process_pos)
|
||||
{
|
||||
delete process_pos->m_lpTimerProc;
|
||||
}
|
||||
|
||||
timerData.m_timerProcessList.clear();
|
||||
|
||||
m_TimerMap.erase(find);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
CTimerProcMgr::TIMER_ID CTimerProcMgr::GetTimerID(HWND hOwnerWnd, unsigned long dwInterval)
|
||||
{
|
||||
TimerMap::iterator pos = m_TimerMap.begin();
|
||||
TimerMap::iterator end = m_TimerMap.end();
|
||||
|
||||
for(; pos != end; ++pos)
|
||||
{
|
||||
InternalTimerData& timerData = pos->second;
|
||||
|
||||
if(timerData.m_hOwnerWnd == hOwnerWnd &&
|
||||
timerData.m_dwInterval == dwInterval)
|
||||
{
|
||||
return pos->first;
|
||||
}
|
||||
}
|
||||
|
||||
return INVALID_TIMER_ID;
|
||||
}
|
||||
|
||||
|
||||
CTimerProcMgr::PROC_ID CTimerProcMgr::AddProc(TIMER_ID nTimerID, CTimerProc* lpTimerProc)
|
||||
{
|
||||
TimerMap::iterator find = m_TimerMap.find(nTimerID);
|
||||
TimerMap::iterator end = m_TimerMap.end();
|
||||
|
||||
if(find != end)
|
||||
{
|
||||
InternalTimerData& timerData = find->second;
|
||||
|
||||
PROC_ID nProcID = m_nProcIDCounter++;
|
||||
timerData.m_timerProcessList.push_back(InternalProcessData(nProcID, lpTimerProc));
|
||||
|
||||
return nProcID;
|
||||
}
|
||||
|
||||
return INVALID_PROC_ID;
|
||||
}
|
||||
|
||||
|
||||
bool CTimerProcMgr::RemoveProc(PROC_ID nProcID)
|
||||
{
|
||||
TimerMap::iterator pos = m_TimerMap.begin();
|
||||
TimerMap::iterator end = m_TimerMap.end();
|
||||
|
||||
TimerProcessList::iterator process_pos;
|
||||
TimerProcessList::iterator process_end;
|
||||
|
||||
for(; pos != end; ++pos)
|
||||
{
|
||||
InternalTimerData& timerData = pos->second;
|
||||
|
||||
process_pos = timerData.m_timerProcessList.begin();
|
||||
process_end = timerData.m_timerProcessList.end();
|
||||
|
||||
for(; process_pos != process_end; ++process_pos)
|
||||
{
|
||||
InternalProcessData& processData = *process_pos;
|
||||
|
||||
if(processData.m_nProcessID == nProcID)
|
||||
{
|
||||
delete processData.m_lpTimerProc;
|
||||
timerData.m_timerProcessList.erase(process_pos);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
void CTimerProcMgr::ClearAll()
|
||||
{
|
||||
TimerMap::iterator pos = m_TimerMap.begin();
|
||||
TimerMap::iterator end = m_TimerMap.end();
|
||||
|
||||
for(;pos != end; ++pos)
|
||||
{
|
||||
InternalTimerData& timerData = pos->second;
|
||||
KillTimer(timerData.m_hOwnerWnd, pos->first);
|
||||
|
||||
TimerProcessList::iterator process_pos = timerData.m_timerProcessList.begin();
|
||||
TimerProcessList::iterator process_end = timerData.m_timerProcessList.end();
|
||||
|
||||
for(;process_pos != process_end; ++process_pos)
|
||||
{
|
||||
delete process_pos->m_lpTimerProc;
|
||||
}
|
||||
|
||||
timerData.m_timerProcessList.clear();
|
||||
}
|
||||
|
||||
m_TimerMap.clear();
|
||||
}
|
||||
|
||||
|
||||
VOID CALLBACK CTimerProcMgr::TimerProc(HWND hWnd, UINT uMsg,
|
||||
UINT_PTR nTimerID, DWORD dwTime)
|
||||
{
|
||||
CTimerProcMgr* lpTimerProcMgr =
|
||||
reinterpret_cast<CTimerProcMgr*>(GetProp(hWnd, ms_this));
|
||||
|
||||
if(0 != lpTimerProcMgr && uMsg == WM_TIMER)
|
||||
{
|
||||
TimerMap::iterator find = lpTimerProcMgr->m_TimerMap.find(nTimerID);
|
||||
TimerMap::iterator end = lpTimerProcMgr->m_TimerMap.end();
|
||||
|
||||
if(find != end)
|
||||
{
|
||||
InternalTimerData& timerData = find->second;
|
||||
|
||||
TimerProcessList::iterator process_pos = timerData.m_timerProcessList.begin();
|
||||
TimerProcessList::iterator process_end = timerData.m_timerProcessList.end();
|
||||
|
||||
for(; process_pos != process_end; ++process_pos)
|
||||
{
|
||||
InternalProcessData& processData = *process_pos;
|
||||
|
||||
if(0 != processData.m_lpTimerProc)
|
||||
{
|
||||
(*processData.m_lpTimerProc)(hWnd, uMsg, nTimerID, dwTime);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
#ifndef _GM_NETWORK_TIMER_PROC_
|
||||
#define _GM_NETWORK_TIMER_PROC_
|
||||
|
||||
#include <winsock2.h>
|
||||
#include <windows.h>
|
||||
#include <list>
|
||||
#include <map>
|
||||
|
||||
class CTimerProc
|
||||
{
|
||||
public:
|
||||
virtual ~CTimerProc() { }
|
||||
virtual VOID operator () (HWND hWnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime) = 0;
|
||||
};
|
||||
|
||||
|
||||
class CTimerProcMgr
|
||||
{
|
||||
public:
|
||||
|
||||
CTimerProcMgr();
|
||||
~CTimerProcMgr();
|
||||
|
||||
typedef unsigned int TIMER_ID;
|
||||
typedef unsigned int PROC_ID;
|
||||
|
||||
static const TIMER_ID INVALID_TIMER_ID;
|
||||
static const PROC_ID INVALID_PROC_ID;
|
||||
|
||||
TIMER_ID CreateTimer(HWND hOwnerWnd, unsigned long dwInterval);
|
||||
bool RemoveTimer(TIMER_ID nTimerID);
|
||||
|
||||
TIMER_ID GetTimerID(HWND hOwnerWnd, unsigned long dwInterval);
|
||||
|
||||
PROC_ID AddProc(TIMER_ID nTimerID, CTimerProc* lpTimerProc);
|
||||
bool RemoveProc(PROC_ID nProcID);
|
||||
|
||||
void ClearAll();
|
||||
|
||||
private:
|
||||
|
||||
static VOID CALLBACK TimerProc(HWND hWnd, UINT uMsg, UINT_PTR nTimerID, DWORD dwTime);
|
||||
|
||||
struct InternalProcessData
|
||||
{
|
||||
PROC_ID m_nProcessID;
|
||||
CTimerProc* m_lpTimerProc;
|
||||
|
||||
InternalProcessData(PROC_ID nProcessID, CTimerProc* lpTimerProc)
|
||||
: m_nProcessID(nProcessID), m_lpTimerProc(lpTimerProc)
|
||||
{
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
typedef std::list<InternalProcessData> TimerProcessList;
|
||||
|
||||
struct InternalTimerData
|
||||
{
|
||||
HWND m_hOwnerWnd;
|
||||
unsigned long m_dwInterval;
|
||||
TimerProcessList m_timerProcessList;
|
||||
|
||||
InternalTimerData(HWND hOwnerWnd, unsigned long dwInterval)
|
||||
: m_hOwnerWnd(hOwnerWnd), m_dwInterval(dwInterval)
|
||||
{
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
// Key : TimerID
|
||||
typedef std::map<TIMER_ID, InternalTimerData> TimerMap;
|
||||
|
||||
static const TCHAR* ms_this;
|
||||
|
||||
TimerMap m_TimerMap;
|
||||
PROC_ID m_nProcIDCounter;
|
||||
TIMER_ID m_nTimerIDCounter;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,637 @@
|
||||
#include "stdafx.h"
|
||||
#include "ServerWindowFramework.h"
|
||||
|
||||
#include <Thread/Lock.h>
|
||||
#include <Thread/ThreadMgr.h>
|
||||
#include <Pattern/Command.h>
|
||||
|
||||
#include <Log/ServerLog.h>
|
||||
#include <Network/IOCP/IOCPNet.h>
|
||||
#include <Utility/Time/Pulse/Pulse.h>
|
||||
#include <Stream/Buffer/Buffer.h>
|
||||
#include <Stream/Buffer/BufferFactory.h>
|
||||
|
||||
#include "./SysTray/SysTray.h"
|
||||
#include "./ConsoleWindow/ConsoleWindow.h"
|
||||
#include "./ConsoleWIndow/ConsoleCMDFactory.h"
|
||||
|
||||
#include "./MsgProc/MsgProc.h"
|
||||
#include "./MsgProc/TimerProc.h"
|
||||
|
||||
#include <Network/Dispatch/ServerRequest.h>
|
||||
|
||||
#include <Utility/Setup/ServerSetup.h>
|
||||
#include <Network/Packet/ManagePacketCmd.h>
|
||||
|
||||
#include <mmsystem.h>
|
||||
|
||||
namespace ServerWindowFrameworkConst
|
||||
{
|
||||
enum Const
|
||||
{
|
||||
INITIALIZE_SUCCESS = (1 << 0),
|
||||
DESTROY_CALLED = (1 << 1),
|
||||
DEFAULT_PROCESS_TICK = 100 // 0.1<EFBFBD>ʸ<EFBFBD><EFBFBD><EFBFBD> <20>ѹ<EFBFBD><D1B9><EFBFBD> ó<><C3B3>
|
||||
};
|
||||
};
|
||||
|
||||
const char* CServerWindowFramework::ms_this = TEXT("CServerWindowFramework");
|
||||
const UINT CServerWindowFramework::ms_SendDataMsg = RegisterWindowMessage("Send WM_COPYDATAMessage");
|
||||
|
||||
/*
|
||||
// Ʈ<><C6AE><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʈ<EFBFBD><C6AE> <20>ش<EFBFBD>.
|
||||
class CCheckSysTray : public CTimerProc
|
||||
{
|
||||
public:
|
||||
|
||||
CCheckSysTray(CSysTray& sysTray) : m_sysTray(sysTray) { }
|
||||
virtual ~CCheckSysTray() { }
|
||||
virtual VOID operator () (HWND hWnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime) { m_sysTray.Update(); }
|
||||
|
||||
private:
|
||||
|
||||
CSysTray& m_sysTray;
|
||||
};
|
||||
*/
|
||||
|
||||
class CSendDataToManageClient : public CMsgProc
|
||||
{
|
||||
public:
|
||||
|
||||
virtual LRESULT operator () (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
CBuffer* lpBuffer = reinterpret_cast<CBuffer*>(lParam);
|
||||
|
||||
if(0 != lpBuffer)
|
||||
{
|
||||
const char* szManageClientWindowName = CServerSetup::GetManageClientWindowName();
|
||||
|
||||
HWND hManageWnd = FindWindow(szManageClientWindowName, szManageClientWindowName);
|
||||
if(0 != hManageWnd)
|
||||
{
|
||||
COPYDATASTRUCT copyStruct;
|
||||
|
||||
copyStruct.dwData = 0;
|
||||
copyStruct.cbData = lpBuffer->length();
|
||||
copyStruct.lpData = lpBuffer->rd_ptr();
|
||||
|
||||
SendMessage(hManageWnd, WM_COPYDATA, 0, (LPARAM)©Struct);
|
||||
}
|
||||
|
||||
SAFE_RELEASE_BUFFER(lpBuffer);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
};
|
||||
|
||||
class CRecvCommandFromManageClient : public CMsgProc
|
||||
{
|
||||
public:
|
||||
|
||||
CRecvCommandFromManageClient(
|
||||
CServerWindowFramework& serverWindowFramework,
|
||||
CConsoleCMDFactory& commandFactory,
|
||||
CCommandProcess& commandProcess)
|
||||
: m_ServerWindowFramework(serverWindowFramework),
|
||||
m_CommandFactory(commandFactory),
|
||||
m_CommandProcess(commandProcess)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
virtual LRESULT operator () (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
if(0 != lParam)
|
||||
{
|
||||
COPYDATASTRUCT& copyDataStruct = *reinterpret_cast<PCOPYDATASTRUCT>(lParam);
|
||||
|
||||
ServerManage::ManageCommand* lpManageCmd =
|
||||
reinterpret_cast<ServerManage::ManageCommand*>(copyDataStruct.lpData);
|
||||
|
||||
if(ServerManage::CMD::ExecuteCommand == lpManageCmd->GetCmd())
|
||||
{
|
||||
char szCmdBuffer[CConsoleCMDFactory::MAX_CMD_BUFFER];
|
||||
|
||||
CCommand* lpCommand = 0;
|
||||
int nLength = _snprintf(szCmdBuffer, CConsoleCMDFactory::MAX_CMD_BUFFER - 1,
|
||||
"%s", reinterpret_cast<char*>(lpManageCmd + 1));
|
||||
|
||||
szCmdBuffer[CConsoleCMDFactory::MAX_CMD_BUFFER - 1] = 0;
|
||||
|
||||
if(0 < nLength)
|
||||
{
|
||||
lpCommand = m_CommandFactory.Create(szCmdBuffer, nLength);
|
||||
}
|
||||
|
||||
if(0 != lpCommand)
|
||||
{
|
||||
m_CommandProcess.Add(lpCommand);
|
||||
m_ServerWindowFramework.PrintOutput(szCmdBuffer);
|
||||
}
|
||||
else
|
||||
{
|
||||
ERRLOG1(g_Log, "Command create failed from ManageTool. CMD:%s", szCmdBuffer);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
CServerWindowFramework& m_ServerWindowFramework;
|
||||
CConsoleCMDFactory& m_CommandFactory;
|
||||
CCommandProcess& m_CommandProcess;
|
||||
};
|
||||
|
||||
|
||||
CServerWindowFramework::CServerWindowFramework()
|
||||
: m_hWnd(0),
|
||||
m_hInstance(0),
|
||||
m_nMenuID(0),
|
||||
m_dwInternalFlags(0),
|
||||
m_dwServerStatus(0),
|
||||
m_lpSysTray(0),
|
||||
m_lpConsoleWindow(0),
|
||||
m_lpCommandProcess(new (std::nothrow) CCommandProcess),
|
||||
m_lpCommandFactory(new (std::nothrow) CConsoleCMDFactory),
|
||||
m_lpIOCPNet(new (std::nothrow) CIOCPNet),
|
||||
m_lpMsgProcessMgr(new (std::nothrow) CMsgProcessMgr),
|
||||
m_lpTimerProcessMgr(new (std::nothrow) CTimerProcMgr),
|
||||
m_lpBufferFactory(new (std::nothrow) CPoolBufferFactory)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
CServerWindowFramework::~CServerWindowFramework()
|
||||
{
|
||||
Destroy();
|
||||
}
|
||||
|
||||
|
||||
bool CServerWindowFramework::Initialize(HINSTANCE hInstance, const char* szWndApplicationName,
|
||||
const TCHAR* szCmdLine, int nICON_ID, int nMenu_ID)
|
||||
{
|
||||
const char* szErrorLogText = 0;
|
||||
|
||||
#define INIT_ERR_TEXT(DetailError) TEXT("this:0x%p/ServerWindowFramework initialize failed - "##DetailError)
|
||||
|
||||
TIMECAPS tc;
|
||||
memset(&tc, 0, sizeof(TIMECAPS));
|
||||
|
||||
if(0 == m_lpCommandProcess || 0 == m_lpCommandFactory || 0 == m_lpIOCPNet ||
|
||||
0 == m_lpMsgProcessMgr || 0 == m_lpTimerProcessMgr || 0 == m_lpBufferFactory)
|
||||
{
|
||||
// <20><>ü <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
||||
szErrorLogText = INIT_ERR_TEXT("Create defaultobject failed");
|
||||
}
|
||||
else if (timeGetDevCaps(&tc, sizeof(TIMECAPS)) != TIMERR_NOERROR)
|
||||
{
|
||||
// Ÿ<≯<EFBFBD> <20>ð<EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
||||
szErrorLogText = INIT_ERR_TEXT("Get timer resolution failed");
|
||||
}
|
||||
else if (TIMERR_NOERROR != timeBeginPeriod(min(max(tc.wPeriodMin, unsigned int(1)), tc.wPeriodMax)))
|
||||
{
|
||||
// Ÿ<≯<EFBFBD> <20>ð<EFBFBD> <20>ּҰ<D6BC><D2B0><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
||||
szErrorLogText = INIT_ERR_TEXT("Set timer resolution failed");
|
||||
}
|
||||
else if(!InitializeFramework(hInstance, szWndApplicationName, nICON_ID, nMenu_ID))
|
||||
{
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD>ӿ<EFBFBD>ũ <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
||||
szErrorLogText = INIT_ERR_TEXT("InitialzeFramework failed");
|
||||
}
|
||||
else if(!ApplicationSpecificInit(szCmdLine))
|
||||
{
|
||||
// <20><EFBFBD><DEBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
||||
szErrorLogText = INIT_ERR_TEXT("ApplicationSpecificInit failed");
|
||||
}
|
||||
|
||||
if(0 != szErrorLogText)
|
||||
{
|
||||
ERRLOG1(g_Log, szErrorLogText, this);
|
||||
return false;
|
||||
}
|
||||
|
||||
#undef INIT_ERR_TEXT
|
||||
|
||||
// <20>ʱ<EFBFBD>ȭ <20><><EFBFBD><EFBFBD>
|
||||
SendManageClientPing();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CServerWindowFramework::isValid()
|
||||
{
|
||||
return (m_dwInternalFlags & ServerWindowFrameworkConst::INITIALIZE_SUCCESS) &&
|
||||
!(m_dwInternalFlags & ServerWindowFrameworkConst::DESTROY_CALLED);
|
||||
}
|
||||
|
||||
|
||||
bool CServerWindowFramework::InitializeFramework(HINSTANCE hInstance,
|
||||
const char* szWndApplicationName,
|
||||
int nICON_ID, int nMenu_ID)
|
||||
{
|
||||
if(!(m_dwInternalFlags & ServerWindowFrameworkConst::INITIALIZE_SUCCESS))
|
||||
{
|
||||
_sntprintf(m_szAppName, MAX_PATH - 1, _T("%s"), szWndApplicationName);
|
||||
m_szAppName[MAX_PATH - 1] = 0;
|
||||
|
||||
m_hInstance = hInstance;
|
||||
m_nMenuID = nMenu_ID;
|
||||
|
||||
WNDCLASS wndClass;
|
||||
|
||||
wndClass.hInstance = hInstance;
|
||||
wndClass.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(nICON_ID));
|
||||
wndClass.lpszClassName = m_szAppName;
|
||||
|
||||
wndClass.style = 0;
|
||||
wndClass.lpfnWndProc = (WNDPROC)CServerWindowFramework::ServerWindowFrameworkProc;
|
||||
wndClass.cbClsExtra = 0;
|
||||
wndClass.cbWndExtra = 0;
|
||||
wndClass.hCursor = 0;
|
||||
wndClass.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
|
||||
wndClass.lpszMenuName = 0;
|
||||
|
||||
if (!RegisterClass(&wndClass))
|
||||
{
|
||||
ERRLOG1(g_Log, "RegisterClass failed. ErrorCode:%d.", GetLastError());
|
||||
return false;
|
||||
}
|
||||
|
||||
m_hWnd = CreateWindow(wndClass.lpszClassName, m_szAppName, WS_OVERLAPPEDWINDOW | WS_MINIMIZE,
|
||||
0, 0, 0, 0, 0, 0, wndClass.hInstance, 0);
|
||||
|
||||
if (0 == m_hWnd)
|
||||
{
|
||||
ERRLOG1(g_Log, "CreateWindow failed. ErrorCode:%d", GetLastError());
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!SetProp(m_hWnd, ms_this, this))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
m_lpSysTray = new CSysTray(m_hWnd, wndClass.hInstance);
|
||||
m_lpConsoleWindow = new CConsoleWindow(wndClass.hInstance, m_hWnd,
|
||||
*m_lpCommandFactory, *m_lpCommandProcess);
|
||||
|
||||
if(0 == m_lpSysTray || 0 == m_lpConsoleWindow)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!m_lpSysTray->AddIcon(szWndApplicationName,
|
||||
LoadIcon(wndClass.hInstance, MAKEINTRESOURCE(nICON_ID)), nICON_ID))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!m_lpMsgProcessMgr->Register(ms_SendDataMsg, new CSendDataToManageClient))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else if(!m_lpMsgProcessMgr->Register(WM_COPYDATA,
|
||||
new CRecvCommandFromManageClient(*this, *m_lpCommandFactory, *m_lpCommandProcess)))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!m_lpIOCPNet->Initialize())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
m_dwInternalFlags |= ServerWindowFrameworkConst::INITIALIZE_SUCCESS;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void CServerWindowFramework::Destroy()
|
||||
{
|
||||
if(!(m_dwInternalFlags & ServerWindowFrameworkConst::DESTROY_CALLED))
|
||||
{
|
||||
m_dwInternalFlags |= ServerWindowFrameworkConst::DESTROY_CALLED;
|
||||
|
||||
delete m_lpIOCPNet;
|
||||
m_lpIOCPNet = 0;
|
||||
|
||||
delete m_lpMsgProcessMgr;
|
||||
m_lpMsgProcessMgr = 0;
|
||||
|
||||
delete m_lpTimerProcessMgr;
|
||||
m_lpTimerProcessMgr = 0;
|
||||
|
||||
delete m_lpSysTray;
|
||||
m_lpSysTray = 0;
|
||||
|
||||
if(0 != m_hWnd)
|
||||
{
|
||||
DestroyWindow(m_hWnd);
|
||||
m_hWnd = 0;
|
||||
}
|
||||
|
||||
delete m_lpConsoleWindow;
|
||||
m_lpConsoleWindow = 0;
|
||||
|
||||
delete m_lpCommandProcess;
|
||||
m_lpCommandProcess = 0;
|
||||
|
||||
delete m_lpCommandFactory;
|
||||
m_lpCommandFactory = 0;
|
||||
|
||||
delete m_lpBufferFactory;
|
||||
m_lpBufferFactory = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void CServerWindowFramework::ProcessMessage()
|
||||
{
|
||||
MSG message;
|
||||
|
||||
while(GetMessage(&message, 0, 0, 0))
|
||||
{
|
||||
if(!IsDialogMessage(m_hWnd, &message))
|
||||
{
|
||||
TranslateMessage(&message);
|
||||
DispatchMessage(&message);
|
||||
}
|
||||
}
|
||||
|
||||
SERLOG1(g_Log, "this:0x%p/finish server", this);
|
||||
SERLOG1(g_SessionLog, "this:0x%p/finish server", this);
|
||||
|
||||
CServerRequest::GetInstance().RequestOff();
|
||||
CServerRequest::GetInstance().RemoveAllRequest();
|
||||
|
||||
// <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>. <20><><EFBFBD><EFBFBD><EFBFBD>带 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.
|
||||
ProcessThreadList::iterator pos = m_ProcessThreadList.begin();
|
||||
ProcessThreadList::iterator end = m_ProcessThreadList.end();
|
||||
|
||||
for(;pos != end; ++pos)
|
||||
{
|
||||
// TODO : 2<>ʰ<EFBFBD> <20><><EFBFBD><EFBFBD>.. <20><><EFBFBD>⼭ <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD>.
|
||||
|
||||
CThread* lpProcessThread = *pos;
|
||||
CThreadMgr::Stop(lpProcessThread, 2000);
|
||||
};
|
||||
|
||||
SERLOG1(g_Log, "this:0x%p/finish process threads", this);
|
||||
|
||||
pos = m_ProcessThreadList.begin();
|
||||
end = m_ProcessThreadList.end();
|
||||
for(;pos != end; ++pos)
|
||||
{
|
||||
delete *pos;
|
||||
}
|
||||
|
||||
m_ProcessThreadList.clear();
|
||||
|
||||
Destroy();
|
||||
}
|
||||
|
||||
LRESULT CALLBACK CServerWindowFramework::ServerWindowFrameworkProc(HWND hWnd, UINT uMsg,
|
||||
WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
CServerWindowFramework* lpServerWindowFramework = GetThisPtr(hWnd);
|
||||
|
||||
// Preprocess Messages
|
||||
if(WM_DESTROY == uMsg)
|
||||
{
|
||||
PostQuitMessage(0);
|
||||
}
|
||||
else if(0 != lpServerWindowFramework)
|
||||
{
|
||||
CMsgProc* lpMsgProc = 0;
|
||||
|
||||
if(0 != lpServerWindowFramework->m_lpMsgProcessMgr)
|
||||
{
|
||||
lpMsgProc = lpServerWindowFramework->m_lpMsgProcessMgr->FindMsgProc(uMsg);
|
||||
}
|
||||
|
||||
if(0 != lpMsgProc)
|
||||
{
|
||||
return (*lpMsgProc)(hWnd, uMsg, wParam, lParam);
|
||||
}
|
||||
else if(uMsg == CSysTray::GetSysTrayNotifyMsg())
|
||||
{
|
||||
switch(lParam)
|
||||
{
|
||||
case WM_RBUTTONUP:
|
||||
{
|
||||
CSysTray* lpSysTray = lpServerWindowFramework->m_lpSysTray;
|
||||
if(0 != lpSysTray)
|
||||
{
|
||||
HMENU hMenu = LoadMenu(lpServerWindowFramework->m_hInstance,
|
||||
MAKEINTRESOURCE(lpServerWindowFramework->m_nMenuID));
|
||||
|
||||
if(0 != hMenu)
|
||||
{
|
||||
HMENU hSubMenu = GetSubMenu(hMenu, 0);
|
||||
|
||||
if(0 != hSubMenu)
|
||||
{
|
||||
lpSysTray->ShowPopupMenu(hWnd, hSubMenu);
|
||||
DestroyMenu(hSubMenu);
|
||||
}
|
||||
|
||||
DestroyMenu(hMenu);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
return DefWindowProc(hWnd, uMsg, wParam, lParam);
|
||||
}
|
||||
|
||||
|
||||
void CServerWindowFramework::PrintOutput(const char* lpFormat, ... )
|
||||
{
|
||||
if(0 != m_lpConsoleWindow)
|
||||
{
|
||||
char szText[CConsoleWindow::MAX_MESSAGE_SIZE];
|
||||
|
||||
va_list arguments;
|
||||
va_start(arguments, lpFormat);
|
||||
|
||||
int nLength = _vsntprintf(szText,
|
||||
CConsoleWindow::MAX_MESSAGE_SIZE - 1, lpFormat, arguments);
|
||||
|
||||
va_end(arguments);
|
||||
|
||||
if(0 < nLength)
|
||||
{
|
||||
szText[nLength] = 0;
|
||||
m_lpConsoleWindow->PrintOutput(szText);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CServerWindowFramework::PrintInfo(const char* lpFormat, ... )
|
||||
{
|
||||
if(0 != m_lpConsoleWindow)
|
||||
{
|
||||
char szText[CConsoleWindow::MAX_MESSAGE_SIZE];
|
||||
|
||||
va_list arguments;
|
||||
va_start(arguments, lpFormat);
|
||||
|
||||
int nLength = _vsntprintf(szText,
|
||||
CConsoleWindow::MAX_MESSAGE_SIZE - 1, lpFormat, arguments);
|
||||
|
||||
va_end(arguments);
|
||||
|
||||
if(0 < nLength)
|
||||
{
|
||||
szText[nLength] = 0;
|
||||
m_lpConsoleWindow->PrintInfo(szText);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool CServerWindowFramework::AddProcessThread(CThread* lpProcessThread)
|
||||
{
|
||||
const char* szErrorString = 0;
|
||||
|
||||
if(0 == lpProcessThread)
|
||||
{
|
||||
szErrorString = TEXT("this:0x%p/Process thread pointer is 0");
|
||||
}
|
||||
else if(INVALID_HANDLE_VALUE == CThreadMgr::Run(lpProcessThread))
|
||||
{
|
||||
szErrorString = TEXT("this:0x%p/Process thread start failed");
|
||||
}
|
||||
else
|
||||
{
|
||||
m_ProcessThreadList.push_back(lpProcessThread);
|
||||
return true;
|
||||
}
|
||||
|
||||
ERRLOG1(g_Log, szErrorString, lpProcessThread);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
bool CServerWindowFramework::SendManageClientPacket(const void* lpData, unsigned short usLength)
|
||||
{
|
||||
if(0 != m_lpBufferFactory)
|
||||
{
|
||||
CBuffer* lpBuffer = CREATE_BUFFER(*m_lpBufferFactory, usLength);
|
||||
|
||||
if(0 != lpBuffer)
|
||||
{
|
||||
memcpy(lpBuffer->wr_ptr(), lpData, usLength);
|
||||
lpBuffer->wr_ptr(usLength);
|
||||
|
||||
if(0 != PostMessage(m_hWnd, ms_SendDataMsg, 0,
|
||||
reinterpret_cast<LPARAM>(lpBuffer)))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
SAFE_RELEASE_BUFFER(lpBuffer);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
void CServerWindowFramework::SendManageClientPing()
|
||||
{
|
||||
ServerManage::PktManagePing managePing;
|
||||
|
||||
GetModuleFileName(0, managePing.m_szAppFullPathName, MAX_PATH - 1);
|
||||
managePing.m_szAppFullPathName[MAX_PATH - 1] = 0;
|
||||
|
||||
_snprintf(managePing.m_szWindowName, MAX_PATH - 1, "%s", m_szAppName);
|
||||
managePing.m_szWindowName[MAX_PATH - 1] = 0;
|
||||
|
||||
_snprintf(managePing.m_szCommandLine, MAX_PATH * 2 - 1, "%s", GetCommandLine());
|
||||
managePing.m_szCommandLine[MAX_PATH * 2 - 1] = 0;
|
||||
|
||||
managePing.m_dwStatusFlag = m_dwServerStatus;
|
||||
managePing.InitPtHead(sizeof(ServerManage::PktManagePing), ServerManage::CMD::IPC_ManagePing, 0, 0);
|
||||
|
||||
SendManageClientPacket(&managePing, managePing.GetLen());
|
||||
}
|
||||
|
||||
|
||||
// ---------------------------------------------------------------------------------------------
|
||||
// ó<><C3B3> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
//
|
||||
|
||||
CProcessThread::CProcessThread(CServerWindowFramework& ServerWindowFramework)
|
||||
: m_bExit(FALSE), m_nProcessTick(ServerWindowFrameworkConst::DEFAULT_PROCESS_TICK),
|
||||
m_ServerWindowFramework(ServerWindowFramework)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
CProcessThread::CProcessThread(CServerWindowFramework& ServerWindowFramework, long nProcessTick)
|
||||
: m_bExit(FALSE), m_nProcessTick(nProcessTick),
|
||||
m_ServerWindowFramework(ServerWindowFramework)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
CProcessThread::~CProcessThread()
|
||||
{
|
||||
CThreadMgr::Stop(this, INFINITE);
|
||||
}
|
||||
|
||||
unsigned int CProcessThread::Run()
|
||||
{
|
||||
if(!m_ServerWindowFramework.isValid())
|
||||
{
|
||||
// <20><><EFBFBD><EFBFBD> <20>α<EFBFBD> <20><><EFBFBD><EFBFBD>
|
||||
return -1;
|
||||
}
|
||||
|
||||
CCommandProcess& CommandProcess = *m_ServerWindowFramework.GetCommandProcess();
|
||||
CIOCPNet& IOCPNetwork = *m_ServerWindowFramework.GetIOCPNet();
|
||||
CServerRequest& ServerRequest = CServerRequest::GetInstance();
|
||||
|
||||
CPulse& Pulse = CPulse::GetInstance();
|
||||
Pulse.SetTicksPerPulse(m_nProcessTick);
|
||||
|
||||
while(!IsEndLoop())
|
||||
{
|
||||
unsigned long dwCurrentPulse = Pulse.CheckSleep();
|
||||
|
||||
CommandProcess.ProcessAll(); // Ŀ<>ǵ<EFBFBD> ť ó<><C3B3>
|
||||
IOCPNetwork.Process(); // IOCP Networkó<6B><C3B3>
|
||||
|
||||
// <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> ó<><C3B3>.
|
||||
InternalRun(Pulse);
|
||||
|
||||
if(Pulse.ProcessBySecond(1))
|
||||
{
|
||||
// ServerRequest ó<><C3B3>. 1<>ʸ<EFBFBD><CAB8><EFBFBD> timeout request<73><74> ó<><C3B3><EFBFBD>Ѵ<EFBFBD>.
|
||||
ServerRequest.RemoveTimeoutRequest();
|
||||
}
|
||||
|
||||
if(Pulse.ProcessBySecond(5))
|
||||
{
|
||||
// ManageClient<6E><74> 5<>ʸ<EFBFBD><CAB8><EFBFBD> Ping<6E><67><EFBFBD><EFBFBD> <20><>, Application Name<6D><65> <20><><EFBFBD><EFBFBD><EFBFBD>Ѵ<EFBFBD>.
|
||||
m_ServerWindowFramework.SendManageClientPing();
|
||||
}
|
||||
}
|
||||
|
||||
// Ŭ<><C5AC><EFBFBD><EFBFBD> <20>ڵ带 <20>ִ´<D6B4>.
|
||||
Cleanup(Pulse);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,138 @@
|
||||
#ifndef _CSERVER_WINDOW_FRAMEWORK_
|
||||
#define _CSERVER_WINDOW_FRAMEWORK_
|
||||
|
||||
#include <winsock2.h>
|
||||
#include <windows.h>
|
||||
#include <tchar.h>
|
||||
#include <climits>
|
||||
#include <Thread/Lock.h>
|
||||
#include <Thread/Thread.h>
|
||||
|
||||
#include <list>
|
||||
|
||||
// <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
||||
class CSysTray;
|
||||
class CConsoleWindow;
|
||||
|
||||
class CCommand;
|
||||
class CCommandProcess;
|
||||
|
||||
class CConsoleCMDFactory;
|
||||
class CIOCPNet;
|
||||
|
||||
class CMsgProcessMgr;
|
||||
class CTimerProcMgr;
|
||||
|
||||
class CPulse;
|
||||
class CBufferFactory;
|
||||
class CServerWindowFramework;
|
||||
|
||||
|
||||
// <20><><EFBFBD>μ<EFBFBD><CEBC><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
class CProcessThread : public CThread
|
||||
{
|
||||
public:
|
||||
|
||||
CProcessThread(CServerWindowFramework& ServerWindowFramework);
|
||||
CProcessThread(CServerWindowFramework& ServerWindowFramework, long nProcessTick);
|
||||
virtual ~CProcessThread();
|
||||
|
||||
protected:
|
||||
|
||||
virtual void InternalRun(CPulse& Pulse) = 0;
|
||||
virtual void Cleanup(CPulse& Pulse) = 0;
|
||||
|
||||
private:
|
||||
|
||||
virtual unsigned int Run(); // <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20>Ǵ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ִ´<D6B4>.
|
||||
virtual BOOL End() { InterlockedExchange(&m_bExit, TRUE); return TRUE; }
|
||||
BOOL IsEndLoop() { return InterlockedCompareExchange(&m_bExit, TRUE, TRUE); }
|
||||
|
||||
volatile LONG m_bExit;
|
||||
long m_nProcessTick;
|
||||
CServerWindowFramework& m_ServerWindowFramework;
|
||||
};
|
||||
|
||||
class CServerWindowFramework
|
||||
{
|
||||
public:
|
||||
|
||||
bool Initialize(HINSTANCE hInstance, const TCHAR* szWndApplicationName,
|
||||
const char* szCmdLine, int nICON_ID, int nMenu_ID);
|
||||
|
||||
HWND GetWnd() { return m_hWnd; }
|
||||
void ProcessMessage();
|
||||
|
||||
bool isValid();
|
||||
|
||||
void PrintOutput(const char* lpFormat, ...);
|
||||
void PrintInfo(const char* lpFormat, ...);
|
||||
|
||||
bool SendManageClientPacket(const void* lpData, unsigned short usLength);
|
||||
void SendManageClientPing();
|
||||
|
||||
void SetStatusFlag(unsigned long dwServerStatus) { m_dwServerStatus = dwServerStatus; }
|
||||
unsigned long GetStatusFlag() { return m_dwServerStatus; }
|
||||
|
||||
CMsgProcessMgr* GetMsgProcessMgr() { return m_lpMsgProcessMgr; }
|
||||
CTimerProcMgr* GetTimerProcMgr() { return m_lpTimerProcessMgr; }
|
||||
CIOCPNet* GetIOCPNet() { return m_lpIOCPNet; }
|
||||
CConsoleWindow* GetConsoleWindow() { return m_lpConsoleWindow; }
|
||||
CCommandProcess* GetCommandProcess() { return m_lpCommandProcess; }
|
||||
CConsoleCMDFactory* GetCommandFactory() { return m_lpCommandFactory; } // <20><><EFBFBD>ο<EFBFBD><CEBF><EFBFBD> <20><><EFBFBD><EFBFBD>
|
||||
|
||||
private:
|
||||
|
||||
bool InitWindow(WNDCLASS& wndClass, const char* szWndApplicationName);
|
||||
void Destroy();
|
||||
|
||||
protected:
|
||||
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>Ƽ<DEBE> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ϵ<EFBFBD><CFB5><EFBFBD> <20><>.
|
||||
CServerWindowFramework();
|
||||
virtual ~CServerWindowFramework();
|
||||
|
||||
// <20>ݵ<EFBFBD><DDB5><EFBFBD> <20>ʱ<EFBFBD>ȭ<EFBFBD><C8AD> <20><> <20>־<EFBFBD><D6BE><EFBFBD> <20><>.
|
||||
bool InitializeFramework(HINSTANCE hInstance, const TCHAR* szWndApplicationName, int nICON_ID, int nMenu_ID);
|
||||
|
||||
// <20><EFBFBD><DEBD><EFBFBD> <20><><EFBFBD>μ<EFBFBD><CEBC><EFBFBD> <20>߰<EFBFBD>, Ŀ<>ǵ<EFBFBD> <20>߰<EFBFBD>, Listener<65>߰<EFBFBD> <20><><EFBFBD><EFBFBD> ó<><C3B3><EFBFBD><EFBFBD> <20>Ѵ<EFBFBD>.
|
||||
virtual bool ApplicationSpecificInit(const TCHAR* szCmdLine) = 0;
|
||||
|
||||
// ó<><C3B3> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>߰<EFBFBD>.
|
||||
bool AddProcessThread(CThread* lpProcessThread);
|
||||
|
||||
static CServerWindowFramework* GetThisPtr(HWND hWnd) { return reinterpret_cast<CServerWindowFramework*>(GetProp(hWnd, ms_this)); }
|
||||
static LRESULT CALLBACK ServerWindowFrameworkProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
|
||||
static VOID CALLBACK FrameworkTimerProc(HWND hWnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime);
|
||||
|
||||
private:
|
||||
|
||||
typedef std::list<CThread*> ProcessThreadList;
|
||||
|
||||
HINSTANCE m_hInstance;
|
||||
HWND m_hWnd;
|
||||
int m_nMenuID;
|
||||
unsigned long m_dwInternalFlags;
|
||||
unsigned long m_dwServerStatus;
|
||||
|
||||
CSysTray* m_lpSysTray; // <20><><EFBFBD>ο<EFBFBD><CEBF><EFBFBD> <20><><EFBFBD><EFBFBD>
|
||||
CConsoleWindow* m_lpConsoleWindow; // <20><><EFBFBD>ο<EFBFBD><CEBF><EFBFBD> <20><><EFBFBD><EFBFBD>
|
||||
CCommandProcess* m_lpCommandProcess; // <20><><EFBFBD>ο<EFBFBD><CEBF><EFBFBD> <20><><EFBFBD><EFBFBD>
|
||||
CConsoleCMDFactory* m_lpCommandFactory; // <20><><EFBFBD>ο<EFBFBD><CEBF><EFBFBD> <20><><EFBFBD><EFBFBD>
|
||||
|
||||
CIOCPNet* m_lpIOCPNet; // <20><><EFBFBD>ο<EFBFBD><CEBF><EFBFBD> <20><><EFBFBD><EFBFBD>
|
||||
|
||||
CMsgProcessMgr* m_lpMsgProcessMgr; // <20><EFBFBD><DEBD><EFBFBD> <20><><EFBFBD>μ<EFBFBD><CEBC><EFBFBD> <20>Ŵ<EFBFBD><C5B4><EFBFBD>
|
||||
CTimerProcMgr* m_lpTimerProcessMgr; // Ÿ<≯<EFBFBD> <20><><EFBFBD>μ<EFBFBD><CEBC><EFBFBD> <20>Ŵ<EFBFBD><C5B4><EFBFBD>
|
||||
|
||||
CBufferFactory* m_lpBufferFactory; // <20><><EFBFBD><EFBFBD> Factory
|
||||
|
||||
ProcessThreadList m_ProcessThreadList;
|
||||
|
||||
char m_szAppName[MAX_PATH];
|
||||
|
||||
static const char* ms_this;
|
||||
static const UINT ms_SendDataMsg;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,104 @@
|
||||
#include "stdafx.h"
|
||||
#include "SysTray.h"
|
||||
|
||||
#include <shellapi.h>
|
||||
#include <stdio.h>
|
||||
|
||||
|
||||
// constructor and destructor
|
||||
CSysTray::CSysTray(HWND hWnd, HINSTANCE hInstance)
|
||||
: m_hWnd(hWnd), m_hInstance(hInstance), m_uIconCount(0)
|
||||
{
|
||||
memset(&m_IconData, 0, sizeof(NOTIFYICONDATA));
|
||||
}
|
||||
|
||||
CSysTray::~CSysTray()
|
||||
{
|
||||
RemoveIcon();
|
||||
}
|
||||
|
||||
|
||||
// add item
|
||||
BOOL CSysTray::AddIcon(const char *lpToolTip, HICON hIcon, UINT uID)
|
||||
{
|
||||
BOOL res;
|
||||
|
||||
if(0 != m_IconData.cbSize)
|
||||
{
|
||||
RemoveIcon();
|
||||
}
|
||||
|
||||
m_IconData.cbSize = sizeof(NOTIFYICONDATA);
|
||||
m_IconData.hWnd = m_hWnd;
|
||||
m_IconData.uID = uID;
|
||||
m_IconData.uFlags = NIF_MESSAGE|NIF_ICON|NIF_TIP;
|
||||
m_IconData.hIcon = hIcon;
|
||||
m_IconData.uCallbackMessage = GetSysTrayNotifyMsg();
|
||||
|
||||
if (lpToolTip)
|
||||
{
|
||||
_snprintf(m_IconData.szTip, 64, "%s", lpToolTip);
|
||||
}
|
||||
else
|
||||
{
|
||||
_snprintf(m_IconData.szTip, 64, "Temp Application");
|
||||
}
|
||||
|
||||
res = Shell_NotifyIcon(NIM_ADD, &m_IconData);
|
||||
|
||||
if(res)
|
||||
{
|
||||
m_uIconCount++;
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
// remove item
|
||||
BOOL CSysTray::RemoveIcon(void)
|
||||
{
|
||||
BOOL res = Shell_NotifyIcon(NIM_DELETE, &m_IconData);
|
||||
|
||||
//decrement the counter
|
||||
if (res)
|
||||
{
|
||||
if(m_IconData.hIcon)
|
||||
{
|
||||
DestroyIcon(m_IconData.hIcon);
|
||||
}
|
||||
|
||||
--m_uIconCount;
|
||||
|
||||
memset(&m_IconData, 0, sizeof(NOTIFYICONDATA));
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
BOOL CSysTray::Update()
|
||||
{
|
||||
if(0 != m_IconData.cbSize)
|
||||
{
|
||||
return Shell_NotifyIcon(NIM_MODIFY, &m_IconData);
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// show popup menu
|
||||
void CSysTray::ShowPopupMenu(HWND hWnd, HMENU hMenu)
|
||||
{
|
||||
POINT mouse;
|
||||
GetCursorPos(&mouse);
|
||||
|
||||
SetForegroundWindow(hWnd);
|
||||
TrackPopupMenu(hMenu, TPM_LEFTALIGN | TPM_RIGHTBUTTON, mouse.x, mouse.y, 0, hWnd, NULL);
|
||||
SetForegroundWindow(hWnd);
|
||||
}
|
||||
|
||||
const UINT CSysTray::GetSysTrayNotifyMsg()
|
||||
{
|
||||
static const UINT s_MsgID = RegisterWindowMessage(TEXT("CSysTrayNotifyMessage"));
|
||||
return s_MsgID;
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
#ifndef _MY_SYSTRAY_H_
|
||||
#define _MY_SYSTRAY_H_
|
||||
|
||||
// 2002<30><32> 9<><39> 3<><33>
|
||||
// <20><><EFBFBD><EFBFBD>ȣ
|
||||
#pragma once
|
||||
|
||||
#include <winsock2.h>
|
||||
#include <windows.h>
|
||||
#include <shellapi.h>
|
||||
|
||||
|
||||
class CSysTray
|
||||
{
|
||||
private:
|
||||
|
||||
NOTIFYICONDATA m_IconData;
|
||||
|
||||
HWND m_hWnd;
|
||||
HINSTANCE m_hInstance;
|
||||
UINT m_uIconCount;
|
||||
|
||||
public:
|
||||
|
||||
// constructor and destructor
|
||||
CSysTray(HWND hWnd, HINSTANCE hInstance);
|
||||
~CSysTray();
|
||||
|
||||
BOOL AddIcon(const char *lpToolTip, HICON hIcon, UINT uID);
|
||||
BOOL RemoveIcon();
|
||||
BOOL Update();
|
||||
|
||||
void ShowPopupMenu(HWND hWnd, HMENU hMenu);
|
||||
|
||||
static const UINT GetSysTrayNotifyMsg();
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,51 @@
|
||||
#ifndef _GLOBAL_CONSTANTS_H_
|
||||
#define _GLOBAL_CONSTANTS_H_
|
||||
|
||||
namespace GameRYL
|
||||
{
|
||||
enum GameContents
|
||||
{
|
||||
LEVEL_LIMIT_80 = (1 << 0), // 80<38><30><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
||||
LEVEL_LIMIT_90 = (1 << 1) | LEVEL_LIMIT_80, // 90<39><30><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
||||
LEVEL_LIMIT_100 = (1 << 2) | LEVEL_LIMIT_90 | LEVEL_LIMIT_80, // 100<30><30><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
||||
|
||||
CAMP = (1 << 3), // <20><><EFBFBD><EFBFBD>
|
||||
CAMP_UPGRADE = (1 << 4) | CAMP, // <20><><EFBFBD><EFBFBD> <20><>ȭ
|
||||
SIEGE = (1 << 5) | CAMP_UPGRADE | CAMP, // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
|
||||
JUDGE_PROTOTYPE = (1 << 6), // <20><><EFBFBD>Ʊ<EFBFBD> <20>ĺ<EFBFBD> (<28>ʱ<EFBFBD> <20><><EFBFBD><EFBFBD>)
|
||||
|
||||
ACCESSORY = (1 << 7), // <20>Ǽ<EFBFBD><C7BC>縮
|
||||
RUNE = (1 << 8), // <20><>
|
||||
BATTLE_LOHAN = (1 << 9), // <20><>Ʋ <20><><EFBFBD><EFBFBD>
|
||||
STONE_BATTLE = (1 << 10), // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
LOTTO = (1 << 11), // <20>븸 <20>ζ<EFBFBD>.
|
||||
SHOW_ENEMYNAME = (1 << 12), // <20><><EFBFBD><EFBFBD> ij<><C4B3><EFBFBD><EFBFBD> ǥ<><C7A5>
|
||||
NEWZONE_ZONE9 = (1 << 13), // <20>ű<EFBFBD><C5B1><EFBFBD>
|
||||
REBALANCE_OVERITEM = (1 << 14), // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
||||
FIFTHSKILL_LOCKITEM = (1 << 15) // 5<>ܰ<EFBFBD> <20><>ų <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
};
|
||||
|
||||
enum ServiceNation
|
||||
{
|
||||
KOREA = 0, // <20>ѱ<EFBFBD> (<28><><EFBFBD><EFBFBD>Ʈ)
|
||||
GLOBAL = 1, // <20>۷ι<DBB7><CEB9><EFBFBD>
|
||||
CHINA = 2, // <20>߱<EFBFBD>
|
||||
THAILAND = 3, // <20>±<EFBFBD> IME<4D><45><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
||||
JAPAN = 4, // <20>Ϻ<EFBFBD> <20><><EFBFBD>¿붧<C2BF><EBB6A7><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
||||
|
||||
MAX_NATION_TYPE = 5
|
||||
};
|
||||
|
||||
// Ŭ<><C5AC><EFBFBD>̾<EFBFBD>Ʈ<EFBFBD><C6AE> (<28><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>˸°<CBB8> Ŭ<><C5AC><EFBFBD>̾<EFBFBD>Ʈ <20><>ƾ <20>и<EFBFBD><D0B8><EFBFBD> <20><><EFBFBD><EFBFBD>...)
|
||||
enum ServerType
|
||||
{
|
||||
SERVER_TEST = 0, // <20><EFBFBD>Ʈ <20><><EFBFBD><EFBFBD>
|
||||
SERVER_REGULAR = 1, // <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
||||
SERVER_BATTLE_LOHAN = 2, // <20><>Ʋ <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
||||
|
||||
MAX_SERVER_TYPE = 3
|
||||
};
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,920 @@
|
||||
#include "stdafx.h"
|
||||
#include "ServerSetup.h"
|
||||
|
||||
#include <Log/ServerLog.h>
|
||||
|
||||
#include <Utility/Math/Math.h>
|
||||
#include <Utility/Registry/RegFunctions.h>
|
||||
#include <Network/Winsock/SocketFactory.h>
|
||||
#include <Network/Packet/PacketStruct/ServerInfo.h>
|
||||
|
||||
const int MAX_INI_STRING = 260;
|
||||
const char szINIFileName[] = "DemonSetup.ini";
|
||||
|
||||
static OleDB::ConnType GetConnTypeFromString(const TCHAR* szConnType)
|
||||
{
|
||||
const int MAX_CONNTYPE_STRING = 64;
|
||||
TCHAR szBuffer[MAX_CONNTYPE_STRING];
|
||||
|
||||
_sntprintf(szBuffer, MAX_CONNTYPE_STRING, "%s", szConnType);
|
||||
szBuffer[MAX_CONNTYPE_STRING - 1] = 0;
|
||||
|
||||
_tcsupr(szBuffer);
|
||||
|
||||
OleDB::ConnType eConnType = OleDB::ConnType_MSSQL;
|
||||
|
||||
if (0 == _tcscmp(szBuffer, "MSSQL")) { eConnType = OleDB::ConnType_MSSQL; }
|
||||
else if (0 == _tcscmp(szBuffer, "ODBC")) { eConnType = OleDB::ConnType_ODBC; }
|
||||
else if (0 == _tcscmp(szBuffer, "ORACLE")) { eConnType = OleDB::ConnType_ORACLE; }
|
||||
|
||||
return eConnType;
|
||||
}
|
||||
|
||||
CServerSetup& CServerSetup::GetInstance()
|
||||
{
|
||||
static CServerSetup serverSetup;
|
||||
return serverSetup;
|
||||
}
|
||||
|
||||
|
||||
CServerSetup::CServerSetup()
|
||||
: m_dwLimitVer(0),
|
||||
m_dwClientVer(0),
|
||||
m_dwBillingType(0),
|
||||
m_dwAuthType(0),
|
||||
m_eNationType(GameRYL::KOREA),
|
||||
m_bHanCheck(false),
|
||||
m_bHackCheck(false),
|
||||
m_bAdminIPCheck(false),
|
||||
m_bDuelModeCheck(false),
|
||||
m_bLotteryEvent(false),
|
||||
m_bLevelUpEvent(false),
|
||||
m_bBattleAuth(false),
|
||||
m_bBattleGame(false),
|
||||
m_bBattleAgent(false),
|
||||
m_bSupressCharCreate(false),
|
||||
m_bSupressCharDelete(false),
|
||||
m_cRestrictedPart1ToPart2Level(0),
|
||||
m_cMaxTransferPart1ToPart2Count(0),
|
||||
m_dwUserLimit(0),
|
||||
m_dwCheckSum(0),
|
||||
m_dwExp(0),
|
||||
m_dwDrop(0),
|
||||
m_dwFame(0),
|
||||
m_dwRefine(0),
|
||||
m_dwMileage(0),
|
||||
m_dwEquipCorr(0),
|
||||
m_wBattleLimit(0),
|
||||
m_wBattleLimitPer(0),
|
||||
m_dwGameContentsFlag(0)
|
||||
{
|
||||
memset(&m_ServerID, 0, sizeof(SERVER_ID));
|
||||
|
||||
memset(&m_stPart1UnifiedDBInfo, 0, sizeof(DBInfo));
|
||||
memset(&m_stAdminToolDBInfo, 0, sizeof(DBInfo));
|
||||
memset(&m_stKeeperDBInfo, 0, sizeof(DBInfo));
|
||||
memset(&m_stAuthDBInfo, 0, sizeof(DBInfo));
|
||||
memset(&m_stGameDBInfo, 0, sizeof(DBInfo));
|
||||
memset(&m_stLogDBInfo, 0, sizeof(DBInfo));
|
||||
}
|
||||
|
||||
CServerSetup::~CServerSetup()
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
unsigned long CServerSetup::GetServerID(void)
|
||||
{
|
||||
return m_ServerID;
|
||||
}
|
||||
|
||||
char CServerSetup::GetServerGroup(void)
|
||||
{
|
||||
SERVER_ID serverID;
|
||||
serverID.dwID = m_ServerID;
|
||||
|
||||
return serverID.sID.Group;
|
||||
}
|
||||
|
||||
char CServerSetup::GetServerZone(void)
|
||||
{
|
||||
SERVER_ID serverID;
|
||||
serverID.dwID = m_ServerID;
|
||||
|
||||
return serverID.sID.ID;
|
||||
}
|
||||
|
||||
char CServerSetup::GetServerChannel(void)
|
||||
{
|
||||
SERVER_ID serverID;
|
||||
serverID.dwID = m_ServerID;
|
||||
|
||||
return serverID.sID.Channel;
|
||||
}
|
||||
|
||||
|
||||
bool CServerSetup::Initialize(ServerType eServerType)
|
||||
{
|
||||
bool bResult = false;
|
||||
|
||||
switch (eServerType)
|
||||
{
|
||||
case LoginServer: bResult = InitLoginServer(); break;
|
||||
case AuthServer: bResult = InitAuthServer(); break;
|
||||
case GameServer: bResult = InitGameServer(); break;
|
||||
case AgentServer: bResult = InitAgentServer(); break;
|
||||
case UIDServer: bResult = InitUIDServer(); break;
|
||||
case LogServer: bResult = InitLogServer(); break;
|
||||
case ChatServer: bResult = InitChatServer(); break;
|
||||
}
|
||||
|
||||
// GameRYL::REBALANCE_OVERITEM |
|
||||
switch (m_eNationType)
|
||||
{
|
||||
case GameRYL::KOREA: m_dwGameContentsFlag = GameRYL::FIFTHSKILL_LOCKITEM | GameRYL::LEVEL_LIMIT_90 | GameRYL::SIEGE | GameRYL::ACCESSORY | GameRYL::JUDGE_PROTOTYPE | GameRYL::STONE_BATTLE; break;
|
||||
// <20><><EFBFBD>翬 S<><EFBFBD><D7B7>̵<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ǰ<EFBFBD>
|
||||
// case GameRYL::GLOBAL: m_dwGameContentsFlag = GameRYL::REBALANCE_OVERITEM | GameRYL::FIFTHSKILL_LOCKITEM | GameRYL::LEVEL_LIMIT_90 | GameRYL::SIEGE | GameRYL::ACCESSORY | GameRYL::JUDGE_PROTOTYPE | GameRYL::STONE_BATTLE; break;
|
||||
// <20>Ʒ<EFBFBD><C6B7><EFBFBD> <20><><EFBFBD><EFBFBD>
|
||||
case GameRYL::GLOBAL: m_dwGameContentsFlag = GameRYL::FIFTHSKILL_LOCKITEM | GameRYL::LEVEL_LIMIT_90 | GameRYL::SIEGE | GameRYL::ACCESSORY | GameRYL::JUDGE_PROTOTYPE | GameRYL::STONE_BATTLE; break;
|
||||
case GameRYL::CHINA: m_dwGameContentsFlag = GameRYL::FIFTHSKILL_LOCKITEM | GameRYL::LEVEL_LIMIT_90 | GameRYL::SIEGE | GameRYL::ACCESSORY | GameRYL::JUDGE_PROTOTYPE | GameRYL::STONE_BATTLE; break;
|
||||
case GameRYL::THAILAND: m_dwGameContentsFlag = GameRYL::FIFTHSKILL_LOCKITEM | GameRYL::LEVEL_LIMIT_90 | GameRYL::SIEGE | GameRYL::ACCESSORY | GameRYL::JUDGE_PROTOTYPE | GameRYL::STONE_BATTLE; break;
|
||||
case GameRYL::JAPAN: m_dwGameContentsFlag = GameRYL::FIFTHSKILL_LOCKITEM | GameRYL::LEVEL_LIMIT_90 | GameRYL::SIEGE | GameRYL::ACCESSORY | GameRYL::JUDGE_PROTOTYPE | GameRYL::STONE_BATTLE; break;
|
||||
}
|
||||
|
||||
return bResult;
|
||||
}
|
||||
|
||||
bool CServerSetup::InitLoginServer(void)
|
||||
{
|
||||
char szServerID[MAX_INI_STRING] = "";
|
||||
char szPingCheck[MAX_INI_STRING] = "";
|
||||
char szAloneMode[MAX_INI_STRING] = "";
|
||||
char szLimitVer[MAX_INI_STRING] = "";
|
||||
|
||||
const char* szErrorString = "Unknown Error";
|
||||
|
||||
if (!Registry::ReadString(szINIFileName, "LoginServer", "ServerID", szServerID, MAX_INI_STRING))
|
||||
{
|
||||
szErrorString = "LoginServer : <20><><EFBFBD><EFBFBD> <20><><EFBFBD>̵<EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>.";
|
||||
}
|
||||
else if (!Registry::ReadString(szINIFileName, "LoginServer", "PingCheck", szPingCheck, MAX_INI_STRING))
|
||||
{
|
||||
szErrorString = "LoginServer : <20><>üũ <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>.";
|
||||
}
|
||||
else if (!Registry::ReadString(szINIFileName, "LoginServer", "AloneMode", szAloneMode, MAX_INI_STRING))
|
||||
{
|
||||
szErrorString = "LoginServer : ȥ<><C8A5> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>.";
|
||||
}
|
||||
else if (!Registry::ReadString(szINIFileName, "LoginServer", "LeastPatchVer", szLimitVer, MAX_INI_STRING))
|
||||
{
|
||||
szErrorString = "LoginServer : Ŭ<><C5AC><EFBFBD>̾<EFBFBD>Ʈ <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>";
|
||||
}
|
||||
else if (!Registry::ReadString(szINIFileName, "LoginServer", "PatchAddr", m_chPatchAddr, MAX_PATH))
|
||||
{
|
||||
szErrorString = "LoginServer : <20><>ġ <20>ּ<EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>.";
|
||||
}
|
||||
else
|
||||
{
|
||||
m_ServerID = atol(szServerID);
|
||||
m_bPingCheck = (1 == atol(szPingCheck));
|
||||
m_bAlone = (1 == atol(szAloneMode));
|
||||
m_dwClientVer = atol(szLimitVer);
|
||||
return true;
|
||||
}
|
||||
|
||||
ERRLOG0(g_Log, szErrorString);
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CServerSetup::InitAuthServer(void)
|
||||
{
|
||||
char szServerID[MAX_INI_STRING] = "";
|
||||
char szAuthType[MAX_INI_STRING] = "";
|
||||
char szDBAgentAddr[MAX_INI_STRING] = "";
|
||||
|
||||
char szPingCheck[MAX_INI_STRING] = "";
|
||||
char szHanCheck[MAX_INI_STRING] = "";
|
||||
|
||||
char szBattleServer[MAX_INI_STRING] = "";
|
||||
char szBattleAgeLimit[MAX_INI_STRING] = "";
|
||||
char szSupressCharCreate[MAX_INI_STRING] = "";
|
||||
char szSupressCharDelete[MAX_INI_STRING] = "";
|
||||
char szTestGroupAuth[MAX_INI_STRING] = "";
|
||||
|
||||
char szAuthDBType[MAX_INI_STRING] = "";
|
||||
char szAdminToolDBType[MAX_INI_STRING] = "";
|
||||
|
||||
|
||||
char szGammaniaCode[MAX_INI_STRING] = "";
|
||||
char szGammaniaRegin[MAX_INI_STRING] = "";
|
||||
char szGammaniaAddr[MAX_INI_STRING] = "";
|
||||
char szGammaniaPort1[MAX_INI_STRING] = "";
|
||||
char szGammaniaPort2[MAX_INI_STRING] = "";
|
||||
|
||||
const char* szErrorString = "Unknown Error";
|
||||
|
||||
if (!Registry::ReadString(szINIFileName, "AuthServer", "ServerID", szServerID, MAX_INI_STRING))
|
||||
{
|
||||
szErrorString = "AuthServer : <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD>̵<EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>.";
|
||||
}
|
||||
else if (!Registry::ReadString(szINIFileName, "AuthServer", "AuthType", szAuthType, MAX_INI_STRING))
|
||||
{
|
||||
szErrorString = "AuthServer : <20><><EFBFBD><EFBFBD> Ÿ<><C5B8> <20>б<EFBFBD> <20><><EFBFBD><EFBFBD>";
|
||||
}
|
||||
else if (!Registry::ReadString(szINIFileName, "AuthServer", "DBAgentAddr", szDBAgentAddr, MAX_INI_STRING))
|
||||
{
|
||||
szErrorString = "AuthServer : <20>߰<EFBFBD> <20><><EFBFBD><EFBFBD> <20>ּ<EFBFBD> <20>б<EFBFBD> <20><><EFBFBD><EFBFBD>";
|
||||
}
|
||||
else if (!Registry::ReadString(szINIFileName, "AuthServer", "PingCheck", szPingCheck, MAX_INI_STRING))
|
||||
{
|
||||
szErrorString = "AuthServer : <20><>üũ <20><><EFBFBD><EFBFBD>.";
|
||||
}
|
||||
else if (!Registry::ReadString(szINIFileName, "AuthServer", "KoreanLangCheck", szHanCheck, MAX_INI_STRING))
|
||||
{
|
||||
szErrorString = "AuthServer : <20>ѱ<EFBFBD>üũ <20><><EFBFBD><EFBFBD>.";
|
||||
}
|
||||
else if (!Registry::ReadString(szINIFileName, "AuthServer", "BattleServerAuth", szBattleServer, MAX_INI_STRING))
|
||||
{
|
||||
szErrorString = "AuthServer : <20><>Ʋ<EFBFBD><C6B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20>б<EFBFBD> <20><><EFBFBD><EFBFBD>";
|
||||
}
|
||||
else if (!Registry::ReadString(szINIFileName, "AuthServer", "TestGroupAuth", szTestGroupAuth, MAX_INI_STRING))
|
||||
{
|
||||
szErrorString = "AuthServer : <20><EFBFBD>Ʈ<EFBFBD><EFBFBD><D7B7><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><D7B7><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20>б<EFBFBD> <20><><EFBFBD><EFBFBD>";
|
||||
}
|
||||
else if (!Registry::ReadString(szINIFileName, "AuthServer", "GammaniaServerCode", szGammaniaCode, MAX_INI_STRING))
|
||||
{
|
||||
szErrorString = "AuthServer : <20><><EFBFBD><EFBFBD><EFBFBD>Ͼ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ڵ<EFBFBD> <20>б<EFBFBD> <20><><EFBFBD><EFBFBD>";
|
||||
}
|
||||
else if (!Registry::ReadString(szINIFileName, "AuthServer", "GammaniaRegin", szGammaniaRegin, MAX_INI_STRING))
|
||||
{
|
||||
szErrorString = "AuthServer : <20><><EFBFBD><EFBFBD><EFBFBD>Ͼ<EFBFBD> Regin <20>ڵ<EFBFBD> <20>б<EFBFBD> <20><><EFBFBD><EFBFBD>";
|
||||
}
|
||||
else if (!Registry::ReadString(szINIFileName, "AuthServer", "GammaniaAddr", szGammaniaAddr, MAX_INI_STRING))
|
||||
{
|
||||
szErrorString = "AuthServer : <20><><EFBFBD><EFBFBD><EFBFBD>Ͼ<EFBFBD> Addr <20>б<EFBFBD> <20><><EFBFBD><EFBFBD>";
|
||||
}
|
||||
else if (!Registry::ReadString(szINIFileName, "AuthServer", "GammaniaPort1", szGammaniaPort1, MAX_INI_STRING))
|
||||
{
|
||||
szErrorString = "AuthServer : <20><><EFBFBD><EFBFBD><EFBFBD>Ͼ<EFBFBD> Port1 <20>б<EFBFBD> <20><><EFBFBD><EFBFBD>";
|
||||
}
|
||||
else if (!Registry::ReadString(szINIFileName, "AuthServer", "GammaniaPort2", szGammaniaPort2, MAX_INI_STRING))
|
||||
{
|
||||
szErrorString = "AuthServer : <20><><EFBFBD><EFBFBD><EFBFBD>Ͼ<EFBFBD> Port2 <20>б<EFBFBD> <20><><EFBFBD><EFBFBD>";
|
||||
}
|
||||
else if (
|
||||
!Registry::ReadString(szINIFileName, "AuthServer", "AuthDBType", szAuthDBType, MAX_INI_STRING) ||
|
||||
!Registry::ReadString(szINIFileName, "AuthServer", "AuthDBAddr", m_stAuthDBInfo.m_szDBAddr, DBInfo::MAX_BUFFER) ||
|
||||
!Registry::ReadString(szINIFileName, "AuthServer", "AuthDBName", m_stAuthDBInfo.m_szDBName, DBInfo::MAX_BUFFER) ||
|
||||
!Registry::ReadString(szINIFileName, "AuthServer", "AuthDBUser", m_stAuthDBInfo.m_szDBUser, DBInfo::MAX_BUFFER) ||
|
||||
!Registry::ReadString(szINIFileName, "AuthServer", "AuthDBPass", m_stAuthDBInfo.m_szDBPass, DBInfo::MAX_BUFFER))
|
||||
{
|
||||
szErrorString = "AuthServer : <20><><EFBFBD><EFBFBD> DB<44><42><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>";
|
||||
}
|
||||
else if (
|
||||
!Registry::ReadString(szINIFileName, "AuthServer", "AdminToolDBType", szAdminToolDBType, MAX_INI_STRING) ||
|
||||
!Registry::ReadString(szINIFileName, "AuthServer", "AdminToolDBAddr", m_stAdminToolDBInfo.m_szDBAddr, DBInfo::MAX_BUFFER) ||
|
||||
!Registry::ReadString(szINIFileName, "AuthServer", "AdminToolDBName", m_stAdminToolDBInfo.m_szDBName, DBInfo::MAX_BUFFER) ||
|
||||
!Registry::ReadString(szINIFileName, "AuthServer", "AdminToolDBUser", m_stAdminToolDBInfo.m_szDBUser, DBInfo::MAX_BUFFER) ||
|
||||
!Registry::ReadString(szINIFileName, "AuthServer", "AdminToolDBPass", m_stAdminToolDBInfo.m_szDBPass, DBInfo::MAX_BUFFER))
|
||||
{
|
||||
szErrorString = "AuthServer : <20><EFBFBD><EEBFB5> DB<44><42><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>";
|
||||
}
|
||||
else
|
||||
{
|
||||
m_stAuthDBInfo.m_ConnType = GetConnTypeFromString(szAuthDBType);
|
||||
m_stAdminToolDBInfo.m_ConnType = GetConnTypeFromString(szAdminToolDBType);
|
||||
|
||||
Registry::ReadString(szINIFileName, "AuthServer", "SupressCharCreate", szSupressCharCreate, MAX_INI_STRING);
|
||||
m_bSupressCharCreate = (1 == atoi(szSupressCharCreate));
|
||||
|
||||
Registry::ReadString(szINIFileName, "AuthServer", "SupressCharDelete", szSupressCharDelete, MAX_INI_STRING);
|
||||
m_bSupressCharDelete = (1 == atoi(szSupressCharDelete));
|
||||
|
||||
m_ServerID = atoi(szServerID);
|
||||
m_bPingCheck = (1 == atoi(szPingCheck));
|
||||
m_bHanCheck = (1 == atoi(szHanCheck));
|
||||
m_dwAuthType = atoi(szAuthType);
|
||||
m_ServerAddress[AgentServer].set_addr(szDBAgentAddr, DBAgentServerAuthServerListen);
|
||||
m_bBattleAuth = (1 == atoi(szBattleServer));
|
||||
m_bTestGroupAuth = (1 == atoi(szTestGroupAuth));
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// edith 2008.01.21 <20><><EFBFBD><EFBFBD><EFBFBD>Ͼ<EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>..
|
||||
strcpy(m_szGammaniaCode, szGammaniaCode);
|
||||
strcpy(m_szGammaniaRegin, szGammaniaRegin);
|
||||
strcpy(m_szGammaniaAddr, szGammaniaAddr);
|
||||
|
||||
m_GammaniaPort1 = atoi(szGammaniaPort1);
|
||||
m_GammaniaPort2 = atoi(szGammaniaPort2);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
ERRLOG0(g_Log, szErrorString);
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CServerSetup::InitAgentServer(void)
|
||||
{
|
||||
char szServerID[MAX_INI_STRING] = "";
|
||||
char szBillingType[MAX_INI_STRING] = "";
|
||||
char szPingCheck[MAX_INI_STRING] = "";
|
||||
char szAdminIPCheck[MAX_INI_STRING] = "";
|
||||
char szServerVersion[MAX_INI_STRING] = "";
|
||||
|
||||
char szCheckSum[MAX_INI_STRING] = "";
|
||||
char szLoginServerAddr[MAX_INI_STRING] = "";
|
||||
char szUIDServerAddr[MAX_INI_STRING];
|
||||
char szBattleServer[MAX_INI_STRING] = "";
|
||||
char szAgentServerType[MAX_INI_STRING];
|
||||
char szNationType[MAX_INI_STRING] = "";
|
||||
|
||||
char szUserLimit[MAX_INI_STRING] = "";
|
||||
char szBattleLimit[MAX_INI_STRING] = "";
|
||||
char szBattleLimitPer[MAX_INI_STRING] = "";
|
||||
|
||||
char szGameDBConnType[MAX_INI_STRING] = "";
|
||||
|
||||
const char* szErrorString = "Unknown Error";
|
||||
|
||||
if (!Registry::ReadString(szINIFileName, "DBAgentServer", "ServerID", szServerID, MAX_INI_STRING))
|
||||
{
|
||||
szErrorString = "DBAgentServer : <20><><EFBFBD><EFBFBD> <20><><EFBFBD>̵<EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>";
|
||||
}
|
||||
else if (!Registry::ReadString(szINIFileName, "DBAgentServer", "ServerType", szAgentServerType, MAX_INI_STRING))
|
||||
{
|
||||
szErrorString = "DBAgentServer : <20><><EFBFBD><EFBFBD> Ÿ<><C5B8> <20>б<EFBFBD> <20><><EFBFBD><EFBFBD>";
|
||||
}
|
||||
else if (!Registry::ReadString(szINIFileName, "DBAgentServer", "BillingType", szBillingType, MAX_INI_STRING))
|
||||
{
|
||||
szErrorString = "DBAgentServer : <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> Ÿ<><C5B8> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>";
|
||||
}
|
||||
else if (!Registry::ReadString(szINIFileName, "DBAgentServer", "NationType", szNationType, MAX_INI_STRING))
|
||||
{
|
||||
szErrorString = "DBAgentServer : <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>";
|
||||
}
|
||||
else if (!Registry::ReadString(szINIFileName, "DBAgentServer", "ClientVersion", szServerVersion, MAX_INI_STRING))
|
||||
{
|
||||
szErrorString = "DBAgentServer : Ŭ<><C5AC><EFBFBD>̾<EFBFBD>Ʈ <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>";
|
||||
}
|
||||
else if (!Registry::ReadString(szINIFileName, "DBAgentServer", "PatchAddress", m_chPatchAddr, MAX_INI_STRING))
|
||||
{
|
||||
szErrorString = "DBAgentServer : <20><>ġ <20>ּ<EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>.";
|
||||
}
|
||||
else if (!Registry::ReadString(szINIFileName, "DBAgentServer", "LoginServerAddr", szLoginServerAddr, MAX_INI_STRING))
|
||||
{
|
||||
szErrorString = "DBAgentServer : <20>α<EFBFBD><CEB1><EFBFBD> <20><><EFBFBD><EFBFBD> <20>ּ<EFBFBD> <20>б<EFBFBD> <20><><EFBFBD><EFBFBD>";
|
||||
}
|
||||
else if (!Registry::ReadString(szINIFileName, "DBAgentServer", "UIDServerAddr", szUIDServerAddr, MAX_INI_STRING))
|
||||
{
|
||||
szErrorString = "DBAgentServer : UID <20><><EFBFBD><EFBFBD> <20>ּ<EFBFBD> <20>б<EFBFBD> <20><><EFBFBD><EFBFBD>";
|
||||
}
|
||||
else if (!Registry::ReadString(szINIFileName, "DBAgentServer", "CheckSum", szCheckSum, MAX_INI_STRING))
|
||||
{
|
||||
szErrorString = "DBAgentServer : üũ<C3BC><C5A9> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>";
|
||||
}
|
||||
else if (!Registry::ReadString(szINIFileName, "DBAgentServer", "PingCheck", szPingCheck, MAX_INI_STRING))
|
||||
{
|
||||
szErrorString = "DBAgentServer : <20><>üũ <20><><EFBFBD><EFBFBD>";
|
||||
}
|
||||
else if (!Registry::ReadString(szINIFileName, "DBAgentServer", "AdminIPCheck", szAdminIPCheck, MAX_INI_STRING))
|
||||
{
|
||||
szErrorString = "DBAgentServer : <20><><EFBFBD><EFBFBD> IPüũ <20><><EFBFBD><EFBFBD>.";
|
||||
}
|
||||
else if (!Registry::ReadString(szINIFileName, "DBAgentServer", "BattleServer", szBattleServer, MAX_INI_STRING))
|
||||
{
|
||||
szErrorString = "DBAgentServer : <20>߰<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><>Ʋ<EFBFBD><C6B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20>б<EFBFBD> <20><><EFBFBD><EFBFBD>";
|
||||
}
|
||||
else if (!Registry::ReadString(szINIFileName, "DBAgentServer", "LimitServerGroupUserNum", szUserLimit, MAX_INI_STRING))
|
||||
{
|
||||
szErrorString = "DBAgentServer : <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>";
|
||||
}
|
||||
else if (!Registry::ReadString(szINIFileName, "DBAgentServer", "LimitBattleUser", szBattleLimit, MAX_INI_STRING))
|
||||
{
|
||||
szErrorString = "DBAgentServer : <20><>Ʋ<EFBFBD><EFBFBD><D7B6><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20>ο<EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>.";
|
||||
}
|
||||
else if (!Registry::ReadString(szINIFileName, "DBAgentServer", "LimitBattleUserPer", szBattleLimitPer, MAX_INI_STRING))
|
||||
{
|
||||
szErrorString = "DBAgentServer : <20><>Ʋ<EFBFBD><EFBFBD><D7B6><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20>ο<EFBFBD> <20>ۼ<EFBFBD>Ʈ <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>.";
|
||||
}
|
||||
else if (
|
||||
!Registry::ReadString(szINIFileName, "DBAgentServer", "GameDBType", szGameDBConnType, MAX_INI_STRING) ||
|
||||
!Registry::ReadString(szINIFileName, "DBAgentServer", "GameDBAddr", m_stGameDBInfo.m_szDBAddr, DBInfo::MAX_BUFFER) ||
|
||||
!Registry::ReadString(szINIFileName, "DBAgentServer", "GameDBName", m_stGameDBInfo.m_szDBName, DBInfo::MAX_BUFFER) ||
|
||||
!Registry::ReadString(szINIFileName, "DBAgentServer", "GameDBUser", m_stGameDBInfo.m_szDBUser, DBInfo::MAX_BUFFER) ||
|
||||
!Registry::ReadString(szINIFileName, "DBAgentServer", "GameDBPass", m_stGameDBInfo.m_szDBPass, DBInfo::MAX_BUFFER))
|
||||
{
|
||||
szErrorString = "DBAgentServer : <20><><EFBFBD><EFBFBD> DB<44><42><EFBFBD><EFBFBD> <20>б<EFBFBD> <20><><EFBFBD><EFBFBD>";
|
||||
}
|
||||
else
|
||||
{
|
||||
m_stGameDBInfo.m_ConnType = GetConnTypeFromString(szGameDBConnType);
|
||||
|
||||
m_ServerID = atol(szServerID);
|
||||
m_dwBillingType = atoi(szBillingType);
|
||||
m_bPingCheck = (1 == atoi(szPingCheck));
|
||||
m_bAdminIPCheck = (1 == atoi(szAdminIPCheck));
|
||||
m_dwClientVer = atol(szServerVersion);
|
||||
|
||||
m_dwUserLimit = atol(szUserLimit);
|
||||
m_wBattleLimit = static_cast<unsigned short>(atol(szBattleLimit));
|
||||
m_wBattleLimitPer = static_cast<unsigned short>(atol(szBattleLimitPer));
|
||||
m_dwCheckSum = Math::Convert::Atoi(szCheckSum);
|
||||
m_ServerAddress[LoginServer].set_addr(szLoginServerAddr, LoginServerDBAgentServerListen);
|
||||
|
||||
m_ServerAddress[UIDServer].set_addr(szUIDServerAddr, UIDServerDBAgentServerListen);
|
||||
m_bBattleAgent = (1 == atoi(szBattleServer));
|
||||
m_eAgentServerType = static_cast<UnifiedConst::AgentServerType>(atoi(szAgentServerType));
|
||||
m_eNationType = static_cast<GameRYL::ServiceNation>(atol(szNationType));
|
||||
|
||||
// <20><>Ʈ2 <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>϶<EFBFBD><CFB6><EFBFBD> <20>ʿ<EFBFBD><CABF><EFBFBD> <20><><EFBFBD><EFBFBD>
|
||||
if (UnifiedConst::Part2Unified == m_eAgentServerType)
|
||||
{
|
||||
char szPart1UnifiedAgentAddr[MAX_INI_STRING];
|
||||
char szRestrictedPart1ToPart2Level[MAX_INI_STRING];
|
||||
char szMaxTransferCount[MAX_INI_STRING];
|
||||
|
||||
if (!Registry::ReadString(szINIFileName, "DBAgentServer",
|
||||
"Part1UnifiedAgentAddr", szPart1UnifiedAgentAddr, MAX_INI_STRING))
|
||||
{
|
||||
ERRLOG0(g_Log, "<EFBFBD><EFBFBD>Ʈ1 <20><><EFBFBD><EFBFBD> <20>߰<EFBFBD> <20><><EFBFBD><EFBFBD> <20>ּ<EFBFBD> <20>б<EFBFBD> <20><><EFBFBD><EFBFBD>");
|
||||
return false;
|
||||
}
|
||||
else if (!Registry::ReadString(szINIFileName, "DBAgentServer",
|
||||
"RestrictedPart1ToPart2Level", szRestrictedPart1ToPart2Level, MAX_INI_STRING))
|
||||
{
|
||||
ERRLOG0(g_Log, "<EFBFBD><EFBFBD>Ʈ1<EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><>Ʈ2<C6AE><32> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ּҷ<D6BC><D2B7><EFBFBD> <20>б<EFBFBD> <20><><EFBFBD><EFBFBD>");
|
||||
return false;
|
||||
}
|
||||
else if (!Registry::ReadString(szINIFileName, "DBAgentServer",
|
||||
"MaxTransferCharNum", szMaxTransferCount, MAX_INI_STRING))
|
||||
{
|
||||
ERRLOG0(g_Log, "<EFBFBD><EFBFBD>Ʈ1<EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><>Ʈ2<C6AE><32> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ִ<EFBFBD> ij<><C4B3><EFBFBD><EFBFBD> <20><> <20>б<EFBFBD> <20><><EFBFBD><EFBFBD>");
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_Part1UnifiedAgentAddr.set_addr(szPart1UnifiedAgentAddr, DBAgentAdminToolServerListen);
|
||||
m_cRestrictedPart1ToPart2Level = static_cast<unsigned char>(atoi(szRestrictedPart1ToPart2Level));
|
||||
m_cMaxTransferPart1ToPart2Count = static_cast<unsigned char>(atoi(szMaxTransferCount));
|
||||
}
|
||||
}
|
||||
else if (UnifiedConst::Part2Selectable == m_eAgentServerType)
|
||||
{
|
||||
char szSelectableUnifiedServerNum[MAX_INI_STRING];
|
||||
|
||||
if (!Registry::ReadString(szINIFileName, "DBAgentServer",
|
||||
"Part2SelectableUnifiedServerNum", szSelectableUnifiedServerNum, MAX_INI_STRING))
|
||||
{
|
||||
ERRLOG0(g_Log, "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20>б<EFBFBD> <20><><EFBFBD><EFBFBD>");
|
||||
return false;
|
||||
}
|
||||
|
||||
m_dwSelectableUnifiedServerNum = atol(szSelectableUnifiedServerNum);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
ERRLOG0(g_Log, szErrorString);
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CServerSetup::InitUIDServer(void)
|
||||
{
|
||||
char szFreeCheck[MAX_INI_STRING] = "";
|
||||
char szIgnoreFlag[MAX_INI_STRING] = "";
|
||||
char szBillingType[MAX_INI_STRING] = "";
|
||||
char szHanUnitedBillingAddr[MAX_INI_STRING] = "";
|
||||
char szBillingDBConnType[MAX_INI_STRING] = "";
|
||||
|
||||
char szGammaniaCode[MAX_INI_STRING] = "";
|
||||
char szGammaniaRegin[MAX_INI_STRING] = "";
|
||||
char szGammaniaAddr[MAX_INI_STRING] = "";
|
||||
char szGammaniaPort1[MAX_INI_STRING] = "";
|
||||
char szGammaniaPort2[MAX_INI_STRING] = "";
|
||||
|
||||
|
||||
const char* szErrorString = "Unknown Error";
|
||||
|
||||
if (!Registry::ReadString(szINIFileName, "UIDServer", "FreeCheck", szFreeCheck, MAX_INI_STRING))
|
||||
{
|
||||
szErrorString = "UIDServer : <20><><EFBFBD><EFBFBD>üũ <20><><EFBFBD><EFBFBD>.";
|
||||
}
|
||||
else if (!Registry::ReadString(szINIFileName, "UIDServer", "IgnoreFlag", szIgnoreFlag, MAX_INI_STRING))
|
||||
{
|
||||
szErrorString = "UIDServer : <20>÷<EFBFBD><C3B7><EFBFBD> <20><><EFBFBD><EFBFBD> üũ <20><><EFBFBD><EFBFBD>.";
|
||||
}
|
||||
else if (!Registry::ReadString(szINIFileName, "UIDServer", "BillingType", szBillingType, MAX_INI_STRING))
|
||||
{
|
||||
szErrorString = "UIDServer : <20><><EFBFBD><EFBFBD> Ÿ<><C5B8> <20>б<EFBFBD> <20><><EFBFBD><EFBFBD>";
|
||||
}
|
||||
else if (!Registry::ReadString(szINIFileName, "UIDServer", "GammaniaServerCode", szGammaniaCode, MAX_INI_STRING))
|
||||
{
|
||||
szErrorString = "UIDServer : <20><><EFBFBD><EFBFBD><EFBFBD>Ͼ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ڵ<EFBFBD> <20>б<EFBFBD> <20><><EFBFBD><EFBFBD>";
|
||||
}
|
||||
else if (!Registry::ReadString(szINIFileName, "UIDServer", "GammaniaRegin", szGammaniaRegin, MAX_INI_STRING))
|
||||
{
|
||||
szErrorString = "UIDServer : <20><><EFBFBD><EFBFBD><EFBFBD>Ͼ<EFBFBD> Regin <20>ڵ<EFBFBD> <20>б<EFBFBD> <20><><EFBFBD><EFBFBD>";
|
||||
}
|
||||
else if (!Registry::ReadString(szINIFileName, "UIDServer", "GammaniaAddr", szGammaniaAddr, MAX_INI_STRING))
|
||||
{
|
||||
szErrorString = "UIDServer : <20><><EFBFBD><EFBFBD><EFBFBD>Ͼ<EFBFBD> Addr <20>б<EFBFBD> <20><><EFBFBD><EFBFBD>";
|
||||
}
|
||||
else if (!Registry::ReadString(szINIFileName, "UIDServer", "GammaniaPort1", szGammaniaPort1, MAX_INI_STRING))
|
||||
{
|
||||
szErrorString = "UIDServer : <20><><EFBFBD><EFBFBD><EFBFBD>Ͼ<EFBFBD> Port1 <20>б<EFBFBD> <20><><EFBFBD><EFBFBD>";
|
||||
}
|
||||
else if (!Registry::ReadString(szINIFileName, "UIDServer", "GammaniaPort2", szGammaniaPort2, MAX_INI_STRING))
|
||||
{
|
||||
szErrorString = "UIDServer : <20><><EFBFBD><EFBFBD><EFBFBD>Ͼ<EFBFBD> Port2 <20>б<EFBFBD> <20><><EFBFBD><EFBFBD>";
|
||||
}
|
||||
else
|
||||
{
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// edith 2008.01.21 <20><><EFBFBD><EFBFBD><EFBFBD>Ͼ<EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>..
|
||||
strcpy(m_szGammaniaCode, szGammaniaCode);
|
||||
strcpy(m_szGammaniaRegin, szGammaniaRegin);
|
||||
strcpy(m_szGammaniaAddr, szGammaniaAddr);
|
||||
|
||||
m_GammaniaPort1 = atoi(szGammaniaPort1);
|
||||
m_GammaniaPort2 = atoi(szGammaniaPort2);
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
m_bFreeCheck = (1 == atoi(szFreeCheck));
|
||||
m_bIgnoreFlag = (1 == atoi(szIgnoreFlag));
|
||||
m_dwBillingType = atoi(szBillingType);
|
||||
|
||||
if (m_dwBillingType == GamaUnitedBilling &&
|
||||
!Registry::ReadString(szINIFileName, "UIDServer", "HanUnitedBillingAddr",
|
||||
szHanUnitedBillingAddr, MAX_INI_STRING))
|
||||
{
|
||||
szErrorString = "UIDServer : <20>Ѱ<EFBFBD><D1B0><EFBFBD> <20><><EFBFBD>պ<EFBFBD><D5BA><EFBFBD> <20>ּ<EFBFBD> <20>б<EFBFBD> <20><><EFBFBD><EFBFBD>";
|
||||
}
|
||||
else if (
|
||||
!Registry::ReadString(szINIFileName, "UIDServer", "BillingDBType", szBillingDBConnType, MAX_INI_STRING) ||
|
||||
!Registry::ReadString(szINIFileName, "UIDServer", "BillingDBAddr", m_stKeeperDBInfo.m_szDBAddr, DBInfo::MAX_BUFFER) ||
|
||||
!Registry::ReadString(szINIFileName, "UIDServer", "BillingDBName", m_stKeeperDBInfo.m_szDBName, DBInfo::MAX_BUFFER) ||
|
||||
!Registry::ReadString(szINIFileName, "UIDServer", "BillingDBUser", m_stKeeperDBInfo.m_szDBUser, DBInfo::MAX_BUFFER) ||
|
||||
!Registry::ReadString(szINIFileName, "UIDServer", "BillingDBPass", m_stKeeperDBInfo.m_szDBPass, DBInfo::MAX_BUFFER))
|
||||
{
|
||||
szErrorString = "UIDServer : <20><><EFBFBD><EFBFBD> DB <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20>б<EFBFBD> <20><><EFBFBD><EFBFBD>";
|
||||
}
|
||||
else
|
||||
{
|
||||
m_stKeeperDBInfo.m_ConnType =
|
||||
GetConnTypeFromString(szBillingDBConnType);
|
||||
|
||||
unsigned short usPort = static_cast<unsigned short>(
|
||||
Registry::ReadInt(szINIFileName, "UIDServer", "HanUnitedBillingPort"));
|
||||
|
||||
m_HanUnitedBillingAddr.set_addr(szHanUnitedBillingAddr, usPort);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
ERRLOG0(g_Log, szErrorString);
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CServerSetup::InitChatServer(void)
|
||||
{
|
||||
char szChatServerID[MAX_INI_STRING] = "";
|
||||
char szDBAgentServerAddr[MAX_INI_STRING] = "";
|
||||
char szChatPingCheck[MAX_INI_STRING] = "";
|
||||
char szChatToolIPCheck[MAX_INI_STRING] = "";
|
||||
char szAdminToolDBType[MAX_INI_STRING] = "";
|
||||
|
||||
const char* szErrorString = "Unknown Error";
|
||||
|
||||
if (!Registry::ReadString(szINIFileName, "ChatServer", "ServerID", szChatServerID, MAX_INI_STRING))
|
||||
{
|
||||
szErrorString = "ChatServer : <20><><EFBFBD><EFBFBD> ID <20>б<EFBFBD> <20><><EFBFBD><EFBFBD>";
|
||||
}
|
||||
else if (!Registry::ReadString(szINIFileName, "ChatServer", "PingCheck", szChatPingCheck, MAX_INI_STRING))
|
||||
{
|
||||
szErrorString = "ChatServer : <20><> üũ <20>б<EFBFBD> <20><><EFBFBD><EFBFBD>";
|
||||
}
|
||||
else if (!Registry::ReadString(szINIFileName, "ChatServer", "UserIPCheck", szChatToolIPCheck, MAX_INI_STRING))
|
||||
{
|
||||
szErrorString = "ChatServer : <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> IP üũ <20>б<EFBFBD> <20><><EFBFBD><EFBFBD>";
|
||||
}
|
||||
else if (!Registry::ReadString(szINIFileName, "ChatServer", "DBAgentAddress", szDBAgentServerAddr, MAX_INI_STRING))
|
||||
{
|
||||
szErrorString = "ChatServer : <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>߰<EFBFBD> <20><><EFBFBD><EFBFBD> <20>ּ<EFBFBD> <20>б<EFBFBD> <20><><EFBFBD><EFBFBD>";
|
||||
}
|
||||
else if (
|
||||
!Registry::ReadString(szINIFileName, "ChatServer", "AdminToolDBType", szAdminToolDBType, MAX_INI_STRING) ||
|
||||
!Registry::ReadString(szINIFileName, "ChatServer", "AdminToolDBAddr", m_stAdminToolDBInfo.m_szDBAddr, DBInfo::MAX_BUFFER) ||
|
||||
!Registry::ReadString(szINIFileName, "ChatServer", "AdminToolDBName", m_stAdminToolDBInfo.m_szDBName, DBInfo::MAX_BUFFER) ||
|
||||
!Registry::ReadString(szINIFileName, "ChatServer", "AdminToolDBUser", m_stAdminToolDBInfo.m_szDBUser, DBInfo::MAX_BUFFER) ||
|
||||
!Registry::ReadString(szINIFileName, "ChatServer", "AdminToolDBPass", m_stAdminToolDBInfo.m_szDBPass, DBInfo::MAX_BUFFER))
|
||||
{
|
||||
szErrorString = "ChatServer : <20> DB <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20>б<EFBFBD> <20><><EFBFBD><EFBFBD>(For chat ban)";
|
||||
}
|
||||
else
|
||||
{
|
||||
m_stAdminToolDBInfo.m_ConnType =
|
||||
GetConnTypeFromString(szAdminToolDBType);
|
||||
|
||||
m_ServerID = atoi(szChatServerID);
|
||||
m_bPingCheck = (1 == atoi(szChatPingCheck)) ? true : false;
|
||||
m_bChatToolIPCheck = (1 == atol(szChatToolIPCheck)) ? true : false;
|
||||
m_ServerAddress[AgentServer].set_addr(szDBAgentServerAddr, DBAgentServerChatServerListen);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
ERRLOG0(g_Log, szErrorString);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
bool CServerSetup::InitLogServer()
|
||||
{
|
||||
char szLogDBType[MAX_INI_STRING] = "";
|
||||
|
||||
if (!Registry::ReadString(szINIFileName, "LogServer", "LogDBType", szLogDBType, MAX_INI_STRING) ||
|
||||
!Registry::ReadString(szINIFileName, "LogServer", "LogDBAddr", m_stLogDBInfo.m_szDBAddr, DBInfo::MAX_BUFFER) ||
|
||||
!Registry::ReadString(szINIFileName, "LogServer", "LogDBName", m_stLogDBInfo.m_szDBName, DBInfo::MAX_BUFFER) ||
|
||||
!Registry::ReadString(szINIFileName, "LogServer", "LogDBUser", m_stLogDBInfo.m_szDBUser, DBInfo::MAX_BUFFER) ||
|
||||
!Registry::ReadString(szINIFileName, "LogServer", "LogDBPass", m_stLogDBInfo.m_szDBPass, DBInfo::MAX_BUFFER))
|
||||
{
|
||||
ERRLOG0(g_Log, "LogServer : <20>α<EFBFBD> DB <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20>б<EFBFBD> <20><><EFBFBD><EFBFBD>");
|
||||
}
|
||||
else
|
||||
{
|
||||
m_stLogDBInfo.m_ConnType = GetConnTypeFromString(szLogDBType);
|
||||
return true;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
const char* CServerSetup::GetServerWindowName(ServerType eServerType)
|
||||
{
|
||||
const char* lpWindowName = 0;
|
||||
|
||||
switch(eServerType)
|
||||
{
|
||||
case LoginServer: lpWindowName = "Login Server"; break;
|
||||
case AuthServer: lpWindowName = "Auth Server"; break;
|
||||
case GameServer: lpWindowName = "Game Server"; break;
|
||||
case AgentServer: lpWindowName = "Agent Server"; break;
|
||||
case UIDServer: lpWindowName = "UID Server"; break;
|
||||
case AdminToolServer: lpWindowName = "AdminToolServer"; break;
|
||||
case LogServer: lpWindowName = "Log Server"; break;
|
||||
case ChatServer: lpWindowName = "Chat Server"; break;
|
||||
}
|
||||
|
||||
return lpWindowName;
|
||||
}
|
||||
|
||||
const char* CServerSetup::GetManageClientWindowName()
|
||||
{
|
||||
return "ManageClient";
|
||||
}
|
||||
|
||||
bool CServerSetup::InitGameServer(void)
|
||||
{
|
||||
// <09><><EFBFBD>⼭ Ŀ<>ǵ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>Ľ<EFBFBD><C4BD>ؼ<EFBFBD><D8BC><EFBFBD> <20><><EFBFBD>ǰ<EFBFBD><C7B0><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>־<EFBFBD><D6BE>ָ<EFBFBD> <20><>;
|
||||
// <09><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> "-z1 -c1"<22><> Ŀ<>ǵ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>϶<EFBFBD><CFB6><EFBFBD> <20><><EFBFBD><EFBFBD> [Zone_0101]
|
||||
|
||||
char szSection[MAX_INI_STRING];
|
||||
char szServerID[MAX_INI_STRING] = "";
|
||||
char szPingCheck[MAX_INI_STRING] = "";
|
||||
char szSpeedHack[MAX_INI_STRING] = "";
|
||||
char szLotteryEvent[MAX_INI_STRING] = "";
|
||||
char szLevelUpEvent[MAX_INI_STRING] = "";
|
||||
char szDeathPenaltyEvent[MAX_INI_STRING] = "";
|
||||
char szExp[MAX_INI_STRING] = "";
|
||||
char szDrop[MAX_INI_STRING] = "";
|
||||
char szFame[MAX_INI_STRING] = "";
|
||||
char szRefine[MAX_INI_STRING] = "";
|
||||
char szMileage[MAX_INI_STRING] = "";
|
||||
char szEquipCorr[MAX_INI_STRING] = "";
|
||||
|
||||
char szBattleLimit[MAX_INI_STRING] = "";
|
||||
char szBattleLimitPer[MAX_INI_STRING] = "";
|
||||
|
||||
|
||||
char szDBAgentServerAddr[MAX_INI_STRING] = "";
|
||||
char szLogServerAddr[MAX_INI_STRING] = "";
|
||||
char szChatServerAddr[MAX_INI_STRING] = "";
|
||||
char szNationType[MAX_INI_STRING] = "";
|
||||
char szBattleServer[MAX_INI_STRING] = "";
|
||||
|
||||
const char* szErrorString = "(z:%02d, c:%02d) Unknown Error";
|
||||
|
||||
int nZoneIndex = GetZoneFromCmdLine();
|
||||
int nChannelIndex = GetChannelFromCmdLine();
|
||||
|
||||
int nLength = _snprintf( szSection, MAX_INI_STRING - 1, "Zone_%02d%02d", nZoneIndex, nChannelIndex);
|
||||
if (nLength <= 0)
|
||||
{
|
||||
szErrorString = "(z:%02d, c:%02d) Ŀ<>ǵ<EFBFBD> <20><><EFBFBD><EFBFBD> <20>Ľ<EFBFBD> <20><><EFBFBD><EFBFBD>";
|
||||
}
|
||||
else if (!Registry::ReadString(szINIFileName, szSection, "ServerID", szServerID, MAX_INI_STRING))
|
||||
{
|
||||
szErrorString = "(z:%02d, c:%02d) <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD>̵<EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>.";
|
||||
}
|
||||
else if (!Registry::ReadString(szINIFileName, szSection, "PingCheck", szPingCheck, MAX_INI_STRING))
|
||||
{
|
||||
szErrorString = "(z:%02d, c:%02d) <20><>üũ <20>б<EFBFBD> <20><><EFBFBD><EFBFBD>.";
|
||||
}
|
||||
else if (!Registry::ReadString(szINIFileName, szSection, "SpeedHackCheck", szSpeedHack, MAX_INI_STRING))
|
||||
{
|
||||
szErrorString = "(z:%02d, c:%02d) <20><>üũ <20>б<EFBFBD> <20><><EFBFBD><EFBFBD>.";
|
||||
}
|
||||
else if (!Registry::ReadString(szINIFileName, szSection, "LotteryEvent", szLotteryEvent, MAX_INI_STRING))
|
||||
{
|
||||
szErrorString = "(z:%02d, c:%02d) <20><><EFBFBD><EFBFBD> <20>̺<EFBFBD>Ʈ üũ <20>б<EFBFBD> <20><><EFBFBD><EFBFBD>.";
|
||||
}
|
||||
else if (!Registry::ReadString(szINIFileName, szSection, "LevelUpEvent", szLevelUpEvent, MAX_INI_STRING))
|
||||
{
|
||||
szErrorString = "(z:%02d, c:%02d) <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>̺<EFBFBD>Ʈ üũ <20><><EFBFBD><EFBFBD>.";
|
||||
}
|
||||
else if (!Registry::ReadString(szINIFileName, szSection, "DeathPenaltyEvent", szDeathPenaltyEvent, MAX_INI_STRING))
|
||||
{
|
||||
szErrorString = "(z:%02d, c:%02d) <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>г<EFBFBD>Ƽ <20>̺<EFBFBD>Ʈ üũ <20><><EFBFBD><EFBFBD>.";
|
||||
}
|
||||
else if (!Registry::ReadString(szINIFileName, szSection, "ExpRate", szExp, MAX_INI_STRING))
|
||||
{
|
||||
szErrorString = "(z:%02d, c:%02d) <20><><EFBFBD><EFBFBD>ġ <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>.";
|
||||
}
|
||||
else if (!Registry::ReadString(szINIFileName, szSection, "DropRate", szDrop, MAX_INI_STRING))
|
||||
{
|
||||
szErrorString = "(z:%02d, c:%02d) <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>.";
|
||||
}
|
||||
else if (!Registry::ReadString(szINIFileName, szSection, "Fame", szFame, MAX_INI_STRING))
|
||||
{
|
||||
szErrorString = "(z:%02d, c:%02d) <20><><EFBFBD><EFBFBD>ġ <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>.";
|
||||
}
|
||||
else if (!Registry::ReadString(szINIFileName, szSection, "Refine", szRefine, MAX_INI_STRING))
|
||||
{
|
||||
szErrorString = "(z:%02d, c:%02d) <20><><EFBFBD>ü<EFBFBD><C3BC><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>.";
|
||||
}
|
||||
else if (!Registry::ReadString(szINIFileName, szSection, "Mileage", szMileage, MAX_INI_STRING))
|
||||
{
|
||||
szErrorString = "(z:%02d, c:%02d) <20><><EFBFBD>ϸ<EFBFBD><CFB8><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>.";
|
||||
}
|
||||
else if (!Registry::ReadString(szINIFileName, szSection, "EquipCorrRate", szEquipCorr, MAX_INI_STRING))
|
||||
{
|
||||
szErrorString = "(z:%02d, c:%02d) <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>.";
|
||||
}
|
||||
else if (!Registry::ReadString(szINIFileName, szSection, "DBAgentServerAddr", szDBAgentServerAddr, MAX_INI_STRING))
|
||||
{
|
||||
szErrorString = "(z:%02d, c:%02d) <20>߰<EFBFBD> <20><><EFBFBD><EFBFBD> <20>ּ<EFBFBD> <20>б<EFBFBD> <20><><EFBFBD><EFBFBD>";
|
||||
}
|
||||
else if (!Registry::ReadString(szINIFileName, szSection, "LogServerAddr", szLogServerAddr, MAX_INI_STRING))
|
||||
{
|
||||
szErrorString = "(z:%02d, c:%02d) <20>α<EFBFBD> <20><><EFBFBD><EFBFBD> <20>ּ<EFBFBD> <20>б<EFBFBD> <20><><EFBFBD><EFBFBD>";
|
||||
}
|
||||
else if (!Registry::ReadString(szINIFileName, szSection, "ChatServerAddr", szChatServerAddr, MAX_INI_STRING))
|
||||
{
|
||||
szErrorString = "(z:%02d, c:%02d) ä<><C3A4> <20><><EFBFBD><EFBFBD> <20>ּ<EFBFBD> <20>б<EFBFBD> <20><><EFBFBD><EFBFBD>";
|
||||
}
|
||||
else if (!Registry::ReadString(szINIFileName, szSection, "BattleUserLimit", szBattleLimit, MAX_INI_STRING))
|
||||
{
|
||||
szErrorString = "(z:%02d, c:%02d) <20><>Ʋ<EFBFBD><EFBFBD><D7B6><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20>ο<EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>.";
|
||||
}
|
||||
else if (!Registry::ReadString(szINIFileName, szSection, "BattleUserLimitPer", szBattleLimitPer, MAX_INI_STRING))
|
||||
{
|
||||
szErrorString = "(z:%02d, c:%02d) <20><>Ʋ<EFBFBD><EFBFBD><D7B6><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20>ο<EFBFBD> <20>ۼ<EFBFBD>Ʈ <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>.";
|
||||
}
|
||||
else if (!Registry::ReadString(szINIFileName, "Zone_ETC", "GameServerNation", szNationType, MAX_INI_STRING))
|
||||
{
|
||||
szErrorString = "(z:%02d, c:%02d) <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20>б<EFBFBD> <20><><EFBFBD><EFBFBD>";
|
||||
}
|
||||
else if (!Registry::ReadString(szINIFileName, "Zone_ETC", "BattleServerGroup", szBattleServer, MAX_INI_STRING))
|
||||
{
|
||||
szErrorString = "(z:%02d, c:%02d) <20><>Ʋ<EFBFBD><C6B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20>б<EFBFBD> <20><><EFBFBD><EFBFBD>";
|
||||
}
|
||||
else
|
||||
{
|
||||
m_ServerID = atol(szServerID);
|
||||
m_bPingCheck = (1 == atol(szPingCheck));
|
||||
m_bHackCheck = (1 == atol(szSpeedHack));
|
||||
m_bLotteryEvent = (1 == atol(szLotteryEvent));
|
||||
m_bLevelUpEvent = (1 == atol(szLevelUpEvent));
|
||||
m_bDeathPenaltyEvent = (1 == atol(szDeathPenaltyEvent));
|
||||
m_bBattleGame = (1 == atol(szBattleServer));
|
||||
|
||||
m_dwExp = atol(szExp);
|
||||
m_dwDrop = atol(szDrop);
|
||||
m_dwFame = atol(szFame);
|
||||
m_dwRefine = atol(szRefine);
|
||||
m_dwMileage = atol(szMileage);
|
||||
m_dwEquipCorr = atoi(szEquipCorr);
|
||||
m_wBattleLimit = static_cast<unsigned short>(atol(szBattleLimit));
|
||||
m_wBattleLimitPer = static_cast<unsigned short>(atol(szBattleLimitPer));
|
||||
|
||||
m_eNationType = static_cast<GameRYL::ServiceNation>(atoi(szNationType));
|
||||
|
||||
m_ServerAddress[AgentServer].set_addr(szDBAgentServerAddr, DBAgentServerGameServerListen);
|
||||
m_ServerAddress[LogServer].set_addr(szLogServerAddr, LogServerOtherServerListen);
|
||||
m_ServerAddress[ChatServer].set_addr(szChatServerAddr, ChatServerGameServerListen);
|
||||
|
||||
|
||||
CTCPFactory tcpFactory;
|
||||
|
||||
char szMyAddress[MAX_INI_STRING];
|
||||
tcpFactory.GetNetworkInfo(szMyAddress, MAX_INI_STRING);
|
||||
|
||||
m_P1GameServerUDPAddr.set_addr(szMyAddress, GetP1GameServerUDPPort(m_ServerID));
|
||||
return true;
|
||||
}
|
||||
|
||||
ERRLOG2(g_Log, szErrorString, nZoneIndex, nChannelIndex);
|
||||
return false;
|
||||
}
|
||||
|
||||
unsigned short CServerSetup::GetGameServerTCPPort(unsigned long dwServerID)
|
||||
{
|
||||
SERVER_ID serverID;
|
||||
serverID.dwID = dwServerID;
|
||||
|
||||
return serverID.GetZone() + serverID.GetChannel() * MAX_ZONE + GameServerClientBaseListen;
|
||||
}
|
||||
|
||||
unsigned short CServerSetup::GetP1GameServerUDPPort(unsigned long dwServerID)
|
||||
{
|
||||
SERVER_ID serverID;
|
||||
serverID.dwID = dwServerID;
|
||||
|
||||
return serverID.GetZone() + serverID.GetChannel() * MAX_ZONE + P1GameServerClientUDPListen;
|
||||
}
|
||||
|
||||
char CServerSetup::GetZoneFromCmdLine()
|
||||
{
|
||||
char szCommandLineBuffer[MAX_PATH];
|
||||
const char* szDelimit = " \r\n\t";
|
||||
|
||||
char cZone = 1;
|
||||
|
||||
int nLength = _snprintf(szCommandLineBuffer, MAX_PATH - 1, "%s", GetCommandLine());
|
||||
if(nLength < 0)
|
||||
{
|
||||
// TODO : write error code
|
||||
ERRLOG0(g_Log, "CommandLine Parse failed - Zone");
|
||||
}
|
||||
else
|
||||
{
|
||||
char* szToken = strtok(szCommandLineBuffer, szDelimit);
|
||||
while(0 != szToken)
|
||||
{
|
||||
if(0 == strcmp(szToken, "-z"))
|
||||
{
|
||||
// <20><> <20><>ȣ <20>Ľ<EFBFBD>
|
||||
szToken = strtok(0, szDelimit);
|
||||
if(0 != szToken)
|
||||
{
|
||||
cZone = static_cast<char>(atoi(szToken));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
szToken = strtok(0, szDelimit);
|
||||
}
|
||||
}
|
||||
|
||||
return cZone;
|
||||
}
|
||||
|
||||
char CServerSetup::GetChannelFromCmdLine()
|
||||
{
|
||||
char szCommandLineBuffer[MAX_PATH];
|
||||
const char* szDelimit = " \r\n\t";
|
||||
|
||||
char cChannel = 0;
|
||||
|
||||
int nLength = _snprintf(szCommandLineBuffer, MAX_PATH - 1, "%s", GetCommandLine());
|
||||
if(nLength < 0)
|
||||
{
|
||||
// TODO : write error code
|
||||
ERRLOG0(g_Log, "CommandLine Parse failed - Channel");
|
||||
}
|
||||
else
|
||||
{
|
||||
char* szToken = strtok(szCommandLineBuffer, szDelimit);
|
||||
while(0 != szToken)
|
||||
{
|
||||
if(0 == strcmp(szToken, "-c"))
|
||||
{
|
||||
// Channel <20><>ȣ <20>Ľ<EFBFBD>
|
||||
szToken = strtok(0, szDelimit);
|
||||
if(0 != szToken)
|
||||
{
|
||||
cChannel = static_cast<char>(atoi(szToken));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
szToken = strtok(0, szDelimit);
|
||||
}
|
||||
}
|
||||
|
||||
return cChannel;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,301 @@
|
||||
#ifndef _CGAMESERVER_ADDRESS_H_
|
||||
#define _CGAMESERVER_ADDRESS_H_
|
||||
|
||||
#include <winsock2.h>
|
||||
#include <windows.h>
|
||||
|
||||
#include <vector>
|
||||
#include <DB/OleDB.h>
|
||||
|
||||
#include <Network/Address/INET_Addr.h>
|
||||
#include <Network/Packet/PacketStruct/UnifiedCharPacket.h>
|
||||
|
||||
#include <Utility/Setup/GlobalConstants.h>
|
||||
|
||||
|
||||
class CServerSetup
|
||||
{
|
||||
public:
|
||||
|
||||
static CServerSetup& GetInstance();
|
||||
|
||||
enum DefaultPorts
|
||||
{
|
||||
// Ruleset
|
||||
// 10000 ~ 11000 port : <20>ܺ<EFBFBD> <20><><EFBFBD><EFBFBD>
|
||||
// 11001 ~ 12000 port : <20>系<EFBFBD><E7B3BB><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
||||
// 12001 ~ 13000 port : <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>θ<EFBFBD> <20><><EFBFBD><EFBFBD> (<28><><EFBFBD>γ<EFBFBD><CEB3><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>)
|
||||
|
||||
// Ŭ<><C5AC><EFBFBD>̾<EFBFBD>Ʈ -> <20><><EFBFBD><EFBFBD> (<28>ܺ<EFBFBD> -> <20><><EFBFBD><EFBFBD>, <20><><EFBFBD><EFBFBD><EFBFBD>ϸ<EFBFBD> <20>ȵ<EFBFBD>(Ŭ<><C5AC><EFBFBD>̾<EFBFBD>Ʈ<EFBFBD><C6AE> <20>ϵ<EFBFBD><CFB5>ڵ<EFBFBD> <20>Ǿ<EFBFBD> <20><><EFBFBD><EFBFBD>))
|
||||
LoginServerLauncherListen = 10101, // <20><>ó -> <20>α<EFBFBD><CEB1>μ<EFBFBD><CEBC><EFBFBD>
|
||||
AuthServerClientListen = 10210, // Ŭ<><C5AC><EFBFBD>̾<EFBFBD>Ʈ -> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
|
||||
// Ŭ<><C5AC><EFBFBD>̾<EFBFBD>Ʈ -> <20><><EFBFBD><EFBFBD> (<28>ܺ<EFBFBD> -> <20><><EFBFBD><EFBFBD>, <20><><EFBFBD><EFBFBD><EFBFBD>ص<EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>.. <20><>Ʈ2<C6AE><32> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>)
|
||||
P1ChatServerClientListen = 10111,
|
||||
|
||||
// Ŭ<><C5AC><EFBFBD>̾<EFBFBD>Ʈ -> <20><><EFBFBD>Ӽ<EFBFBD><D3BC><EFBFBD> (<28>ܺ<EFBFBD> -> <20><><EFBFBD><EFBFBD>, <20><>Ģ<EFBFBD><C4A2> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ٲ㵵 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.)
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> TCP<43><50>Ʈ. GameServerBaseTCPPort + ä<><C3A4> <20><>ȣ(0~4) * 20 + <20><> <20><>ȣ(1~20)
|
||||
GameServerClientBaseListen = 10400,
|
||||
MAX_ZONE = 20,
|
||||
MAX_CHANNEL = 5,
|
||||
|
||||
// Ŭ<><C5AC><EFBFBD>̾<EFBFBD>Ʈ -> <20><><EFBFBD>Ӽ<EFBFBD><D3BC><EFBFBD> (<28>ܺ<EFBFBD> -> <20><><EFBFBD><EFBFBD>, <20><>Ģ<EFBFBD><C4A2> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ٲ㵵 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.)
|
||||
// <20><>Ʈ 1 <20><><EFBFBD><EFBFBD><EFBFBD>̴<EFBFBD>. <20><>Ʈ 2<><32> UDP<44><50> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ʴ´<CAB4>.
|
||||
P1GameServerClientUDPListen = 10500,
|
||||
|
||||
// <20><><EFBFBD><EFBFBD> <20><>Ʈ<EFBFBD><C6AE>, <20>ܺο<DCBA><CEBF><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ip<69><70> <20><><EFBFBD>ؼ<EFBFBD><D8BC><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ϵ<EFBFBD><CFB5><EFBFBD> <20>Ѵ<EFBFBD>.
|
||||
// 11001 ~ 11100 <20><>Ʈ<EFBFBD><C6AE> PCAnywhereȤ<65><C8A4> Remote Desktop<6F><70><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD>ؼ<EFBFBD> <20><><EFBFBD><EFBFBD> <20>д<EFBFBD>.
|
||||
P1AdminToolServerClientListen = 11121, // <20><>Ʈ 1 <20><EFBFBD><EEBFB5> Ŭ<><C5AC><EFBFBD>̾<EFBFBD>Ʈ -> <20><>Ʈ 1 <20><EFBFBD><EEBFB5> <20><><EFBFBD><EFBFBD>
|
||||
P2AdminToolServerClientListen = 11122, // <20><>Ʈ 2 <20><EFBFBD><EEBFB5> Ŭ<><C5AC><EFBFBD>̾<EFBFBD>Ʈ -> <20><>Ʈ 2 <20><EFBFBD><EEBFB5> <20><><EFBFBD><EFBFBD>
|
||||
LogServerLogClientListen = 11123, // <20>α<EFBFBD> Ŭ<><C5AC><EFBFBD>̾<EFBFBD>Ʈ(<28>α<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><>) -> <20>α<EFBFBD> <20><><EFBFBD><EFBFBD>
|
||||
ManageServerManageToolListen = 11124, // <20><><EFBFBD><EFBFBD> <20><> -> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
||||
ChatServerMonitoringToolListen = 11125, // ä<><C3A4> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> -> ä<>ü<EFBFBD><C3BC><EFBFBD>
|
||||
StatServerManageServerListen = 11126, // <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> -> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
||||
|
||||
// <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> (<28>ܺο<DCBA><CEBF><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD>ƾ<EFBFBD> <20>Ѵ<EFBFBD>, <20><><EFBFBD>ΰ<EFBFBD> <20><><EFBFBD>Ḹ <20><><EFBFBD><EFBFBD><EFBFBD>Ѵ<EFBFBD>)
|
||||
UIDServerDBAgentServerListen = 12531, // DB<44>߰輭<DFB0><E8BCAD> -> UID<49><44><EFBFBD><EFBFBD>
|
||||
LoginServerDBAgentServerListen = 12532, // DB<44>߰輭<DFB0><E8BCAD> -> <20>α<EFBFBD><CEB1>μ<EFBFBD><CEBC><EFBFBD>
|
||||
|
||||
DBAgentServerGameServerListen = 12533, // <20><><EFBFBD>Ӽ<EFBFBD><D3BC><EFBFBD> -> DB<44>߰輭<DFB0><E8BCAD>
|
||||
DBAgentServerAuthServerListen = 12534, // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> -> DB<44>߰輭<DFB0><E8BCAD>
|
||||
DBAgentServerChatServerListen = 12535, // ä<>ü<EFBFBD><C3BC><EFBFBD> -> DB<44>߰輭<DFB0><E8BCAD>
|
||||
DBAgentAdminToolServerListen = 12536, // <20><EFBFBD><EEBFB5> <20><><EFBFBD><EFBFBD> -> DB<44>߰輭<DFB0><E8BCAD>
|
||||
|
||||
ChatServerGameServerListen = 12537, // <20><><EFBFBD>Ӽ<EFBFBD><D3BC><EFBFBD> -> ä<>ü<EFBFBD><C3BC><EFBFBD>
|
||||
ManageServerManageClientListen = 12538, // <20><><EFBFBD><EFBFBD> Ŭ<><C5AC><EFBFBD>̾<EFBFBD>Ʈ -> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
||||
LogServerOtherServerListen = 12539 // <20>ٸ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> -> <20>α<EFBFBD> <20><><EFBFBD><EFBFBD>
|
||||
};
|
||||
|
||||
enum ServerType
|
||||
{
|
||||
LoginServer = 0,
|
||||
AuthServer = 1,
|
||||
GameServer = 2,
|
||||
AgentServer = 3,
|
||||
UIDServer = 4,
|
||||
AdminToolServer = 5,
|
||||
LogServer = 6,
|
||||
ChatServer = 7,
|
||||
MaxType = 8
|
||||
};
|
||||
|
||||
enum BillingType
|
||||
{
|
||||
ROWGlobalBilling = 0, // ROW<4F><57><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
GamaBilling = 1, // <20>ѱ<EFBFBD> <20>Ϲݰ<CFB9><DDB0><EFBFBD>(<28><><EFBFBD><EFBFBD> <20><><EFBFBD>ݹ<EFBFBD><DDB9><EFBFBD>)
|
||||
GamaUnitedBilling = 2, // <20>ѱ<EFBFBD> <20><><EFBFBD>հ<EFBFBD><D5B0><EFBFBD>
|
||||
YouxiLandBilling = 3, // <20>븸<EFBFBD><EBB8B8> <20><><EFBFBD><EFBFBD>
|
||||
JapanBilling = 4, // <20>Ϻ<EFBFBD><CFBA><EFBFBD> <20><><EFBFBD><EFBFBD>
|
||||
GammaniaBilling = 5, // <20><><EFBFBD><EFBFBD><EFBFBD>Ͼƿ<CFBE> <20><><EFBFBD><EFBFBD>
|
||||
MaxBillingType = 6
|
||||
};
|
||||
|
||||
enum AuthType
|
||||
{
|
||||
ROWGlobalAuth = 0, // ROW<4F><57><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
HangameAuth = 1, // <20>Ѱ<EFBFBD><D1B0>ӿ<EFBFBD> <20><><EFBFBD><EFBFBD>
|
||||
GamaAuth = 2, // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʈ<EFBFBD><C6AE> <20><><EFBFBD><EFBFBD>
|
||||
YouxiLandAuth = 3, // <20>븸<EFBFBD><EBB8B8> <20><><EFBFBD><EFBFBD>
|
||||
JapanAuth = 4, // <20>Ϻ<EFBFBD><CFBA><EFBFBD> <20><><EFBFBD><EFBFBD>
|
||||
GammaniaAuth = 5, // <20><><EFBFBD><EFBFBD><EFBFBD>Ͼ<EFBFBD> <20><><EFBFBD><EFBFBD>
|
||||
MaxAuthType = 6
|
||||
};
|
||||
|
||||
struct DBInfo
|
||||
{
|
||||
enum Const
|
||||
{
|
||||
MAX_BUFFER = 128
|
||||
};
|
||||
|
||||
OleDB::ConnType m_ConnType;
|
||||
|
||||
char m_szDBAddr[MAX_BUFFER];
|
||||
char m_szDBName[MAX_BUFFER];
|
||||
char m_szDBUser[MAX_BUFFER];
|
||||
char m_szDBPass[MAX_BUFFER];
|
||||
};
|
||||
|
||||
protected:
|
||||
|
||||
unsigned long m_ServerID; // <20><><EFBFBD><EFBFBD> <20><><EFBFBD>̵<EFBFBD>
|
||||
|
||||
unsigned long m_dwLimitVer; // <20>ּ<EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
||||
unsigned long m_dwClientVer; // Ŭ<><C5AC><EFBFBD>̾<EFBFBD>Ʈ <20><><EFBFBD><EFBFBD>
|
||||
char m_chPatchAddr[MAX_PATH]; // <20><>ġ <20><><EFBFBD><EFBFBD> <20>ּ<EFBFBD> <20><><EFBFBD>ڿ<EFBFBD>
|
||||
|
||||
unsigned long m_dwBillingType;
|
||||
unsigned long m_dwAuthType;
|
||||
|
||||
bool m_bPingCheck; // <20><> üũ
|
||||
bool m_bAlone; // ȥ<><C8A5> <20><><EFBFBD><EFBFBD>
|
||||
bool m_bHanCheck; // <20>ѱ<EFBFBD> üũ
|
||||
bool m_bHackCheck; // <20><> üũ
|
||||
bool m_bAdminIPCheck; // <20><><EFBFBD><EFBFBD> IP üũ
|
||||
bool m_bDuelModeCheck; // <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> üũ
|
||||
bool m_bLotteryEvent; // <20><><EFBFBD><EFBFBD> <20>̺<EFBFBD>Ʈ üũ
|
||||
bool m_bLevelUpEvent; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>̺<EFBFBD>Ʈ üũ
|
||||
bool m_bDeathPenaltyEvent; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>г<EFBFBD>Ƽ <20>̺<EFBFBD>Ʈ üũ
|
||||
|
||||
bool m_bFreeCheck; // <20><><EFBFBD><EFBFBD> üũ
|
||||
bool m_bIgnoreFlag; // <20>÷<EFBFBD><C3B7><EFBFBD> <20><><EFBFBD><EFBFBD>
|
||||
|
||||
bool m_bBattleAuth; // <20><>Ʋ<EFBFBD><EFBFBD><D7B6><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ΰ<EFBFBD>?
|
||||
bool m_bBattleGame; // <20><>Ʋ<EFBFBD><EFBFBD><D7B6><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ΰ<EFBFBD>?
|
||||
bool m_bBattleAgent; // <20><>Ʋ<EFBFBD><EFBFBD><D7B6><EFBFBD><EFBFBD><EFBFBD> <20>߰<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ΰ<EFBFBD>?
|
||||
|
||||
bool m_bSupressCharCreate; // ij<><C4B3><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ϴ°<CFB4>?
|
||||
bool m_bSupressCharDelete; // ij<><C4B3><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ϴ°<CFB4>?
|
||||
bool m_bTestGroupAuth; // <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><EFBFBD><D7BC><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
||||
bool m_bChatToolIPCheck; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> IP üũ <20><><EFBFBD><EFBFBD>
|
||||
|
||||
unsigned char m_cRestrictedPart1ToPart2Level; // Part1<74><31><EFBFBD><EFBFBD> Part2<74><32> ij<><C4B3><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ʿ<EFBFBD><CABF><EFBFBD> <20>ּ<EFBFBD> ij<><C4B3><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
||||
unsigned char m_cMaxTransferPart1ToPart2Count; // Part1<74><31><EFBFBD><EFBFBD> Part2<74><32> ij<><C4B3><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ȸ<><C8B8>
|
||||
|
||||
unsigned long m_dwUserLimit; // <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
||||
unsigned long m_dwCheckSum; // üũ<C3BC><C5A9>
|
||||
|
||||
unsigned long m_dwExp; // <20><><EFBFBD><EFBFBD>ġ(Percentage)
|
||||
unsigned long m_dwDrop; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>(Percentage)
|
||||
unsigned long m_dwFame; // <20><><EFBFBD><EFBFBD>ġ(Percentage)
|
||||
unsigned long m_dwRefine; // <20><><EFBFBD>ü<EFBFBD><C3BC><EFBFBD><EFBFBD><EFBFBD>(Percentage)
|
||||
unsigned long m_dwMileage; // <20><><EFBFBD>ϸ<EFBFBD><CFB8><EFBFBD>(Percentage)
|
||||
unsigned long m_dwEquipCorr;
|
||||
|
||||
unsigned short m_wBattleLimit; // <20><>Ʋ<EFBFBD><EFBFBD><D7B6><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20>ο<EFBFBD>
|
||||
unsigned short m_wBattleLimitPer; // <20><>Ʋ<EFBFBD><EFBFBD><D7B6><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20>ۼ<EFBFBD>Ʈ
|
||||
|
||||
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD>Ͼ<EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
||||
char m_szGammaniaCode[32];
|
||||
char m_szGammaniaRegin[32];
|
||||
char m_szGammaniaAddr[32]; // <20><><EFBFBD><EFBFBD><EFBFBD>Ͼ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ּ<EFBFBD>
|
||||
int m_GammaniaPort1;
|
||||
int m_GammaniaPort2;
|
||||
|
||||
|
||||
INET_Addr m_ServerAddress[MaxType]; // <20><><EFBFBD><EFBFBD> <20>ּҵ<D6BC>
|
||||
INET_Addr m_GameServerUDPAddr;
|
||||
INET_Addr m_HanUnitedBillingAddr; // <20>Ѱ<EFBFBD><D1B0><EFBFBD> <20><><EFBFBD>պ<EFBFBD><D5BA><EFBFBD> <20><><EFBFBD><EFBFBD> <20>ּ<EFBFBD>(UID<49><44><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)
|
||||
INET_Addr m_Part1UnifiedAgentAddr; // <20><>Ʈ1 <20><><EFBFBD>ձ<EFBFBD><D5B1><EFBFBD> <20>߰輭<DFB0><E8BCAD> <20>ּ<EFBFBD>
|
||||
INET_Addr m_P1GameServerUDPAddr; // <20><>Ʈ1 <20><><EFBFBD>Ӽ<EFBFBD><D3BC><EFBFBD><EFBFBD><EFBFBD> UDP<44>ּ<EFBFBD>
|
||||
|
||||
DBInfo m_stPart1UnifiedDBInfo; // <20><>Ʈ1 <20><><EFBFBD>ձ<EFBFBD><D5B1><EFBFBD> DB <20><><EFBFBD><EFBFBD>
|
||||
DBInfo m_stAdminToolDBInfo; // <20> DB <20><><EFBFBD><EFBFBD>
|
||||
DBInfo m_stKeeperDBInfo; // <20><><EFBFBD><EFBFBD> DB <20><><EFBFBD><EFBFBD>
|
||||
DBInfo m_stAuthDBInfo; // <20><><EFBFBD><EFBFBD> DB <20><><EFBFBD><EFBFBD>
|
||||
DBInfo m_stGameDBInfo; // <20><><EFBFBD><EFBFBD> DB <20><><EFBFBD><EFBFBD>
|
||||
DBInfo m_stLogDBInfo; // <20>α<EFBFBD> DB <20><><EFBFBD><EFBFBD>
|
||||
|
||||
unsigned long m_dwGameContentsFlag; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD> <20>÷<EFBFBD><C3B7><EFBFBD>
|
||||
GameRYL::ServiceNation m_eNationType; // <20><><EFBFBD><EFBFBD> Ÿ<><C5B8> (<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20>Ϻΰ<CFBA> <20>ٸ<EFBFBD><D9B8><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)
|
||||
|
||||
std::vector<unsigned long> m_vecAdminUID; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> UID <20><><EFBFBD><EFBFBD>Ʈ
|
||||
UnifiedConst::AgentServerType m_eAgentServerType; // <20>߰<EFBFBD> <20><><EFBFBD><EFBFBD> Ÿ<><C5B8> (<28><>Ʈ1, <20><>Ʈ2, <20><>Ʈ1<C6AE><31><EFBFBD><EFBFBD>...)
|
||||
unsigned long m_dwSelectableUnifiedServerNum; // <20><><EFBFBD><EFBFBD> <20><><EFBFBD>ս<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
||||
|
||||
public:
|
||||
|
||||
static const char* GetServerWindowName(ServerType eServerType);
|
||||
static const char* GetManageClientWindowName();
|
||||
|
||||
static unsigned short GetGameServerTCPPort(unsigned long dwServerID);
|
||||
static unsigned short GetP1GameServerUDPPort(unsigned long dwServerID);
|
||||
|
||||
static char GetZoneFromCmdLine();
|
||||
static char GetChannelFromCmdLine();
|
||||
|
||||
CServerSetup();
|
||||
virtual ~CServerSetup();
|
||||
|
||||
bool Initialize(ServerType eServerType);
|
||||
|
||||
bool InitLoginServer(void);
|
||||
bool InitAuthServer(void);
|
||||
bool InitGameServer(void);
|
||||
bool InitAgentServer(void);
|
||||
bool InitUIDServer(void);
|
||||
bool InitLogServer(void);
|
||||
bool InitChatServer(void);
|
||||
|
||||
unsigned long GetServerID(void);
|
||||
char GetServerGroup(void);
|
||||
char GetServerZone(void);
|
||||
char GetServerChannel(void);
|
||||
|
||||
unsigned long GetLimitVer(void) { return m_dwLimitVer; }
|
||||
unsigned long GetClientVer(void) { return m_dwClientVer; }
|
||||
|
||||
char* GetPatchAddress(void) { return m_chPatchAddr; }
|
||||
|
||||
unsigned long GetBillingType(void) { return m_dwBillingType; }
|
||||
unsigned long GetAuthType(void) { return m_dwAuthType; }
|
||||
|
||||
GameRYL::ServiceNation GetNationType(void) { return m_eNationType; }
|
||||
|
||||
UnifiedConst::AgentServerType GetAgentServerType() { return m_eAgentServerType; }
|
||||
unsigned long GetSelectableUnifiedServerNum(void) { return m_dwSelectableUnifiedServerNum; }
|
||||
|
||||
bool IsSupressCharCreate() { return m_bSupressCharCreate; }
|
||||
bool IsSupressCharDelete() { return m_bSupressCharDelete; }
|
||||
bool IsTestGroupAuth(void) { return m_bTestGroupAuth; }
|
||||
|
||||
unsigned char GetRestrictedPart1ToPart2Level() { return m_cRestrictedPart1ToPart2Level; }
|
||||
unsigned char GetMaxTransferPart1ToPart2Count() { return m_cMaxTransferPart1ToPart2Count; }
|
||||
|
||||
bool GetPingCheck(void) { return m_bPingCheck; }
|
||||
bool GetAlone(void) { return m_bAlone; }
|
||||
bool GetHanCheck(void) { return m_bHanCheck; }
|
||||
bool GetHackCheck(void) { return m_bHackCheck; }
|
||||
bool GetAdminIPCheck(void) { return m_bAdminIPCheck; }
|
||||
bool GetDuelModeCheck(void) { return m_bDuelModeCheck; }
|
||||
bool GetLotteryEvent(void) { return m_bLotteryEvent; }
|
||||
bool GetLevelUpEvent(void) { return m_bLevelUpEvent; }
|
||||
bool GetDeathPenaltyEvent(void) { return m_bDeathPenaltyEvent; }
|
||||
bool GetChatToolIPCheck(void) { return m_bChatToolIPCheck; }
|
||||
|
||||
bool GetFreeCheck(void) { return m_bFreeCheck; }
|
||||
bool GetIgnoreFlag(void) { return m_bIgnoreFlag; }
|
||||
|
||||
unsigned long GetUserLimit(void) { return m_dwUserLimit; }
|
||||
unsigned long GetCheckSum(void) { return m_dwCheckSum; }
|
||||
|
||||
unsigned long GetExpDefault(void) { return m_dwExp; }
|
||||
unsigned long GetDropDefault(void) { return m_dwDrop; }
|
||||
unsigned long GetFameDefault(void) { return m_dwFame; }
|
||||
unsigned long GetRefineDefault(void) { return m_dwRefine; }
|
||||
unsigned long GetMileageDefault(void) { return m_dwMileage; }
|
||||
unsigned long GetEquipCorrDefault(void) { return m_dwEquipCorr; }
|
||||
|
||||
unsigned short GetBattleLimit(void) { return m_wBattleLimit; }
|
||||
unsigned short GetBattleLimitPer(void) { return m_wBattleLimitPer; }
|
||||
|
||||
INET_Addr& GetServerAddress(ServerType eServerType) { return m_ServerAddress[eServerType]; }
|
||||
INET_Addr& GetP1GameServerUDPAddress() { return m_P1GameServerUDPAddr; }
|
||||
INET_Addr& GetHanUnitedBillingAddr() { return m_HanUnitedBillingAddr; }
|
||||
INET_Addr& GetPart1UnifiedAgentAddr() { return m_Part1UnifiedAgentAddr; }
|
||||
|
||||
unsigned long SetClientVer(unsigned long ClientVer_In) { return m_dwClientVer = ClientVer_In; }
|
||||
unsigned long SetCheckSum(unsigned long CheckSum_In) { return m_dwCheckSum = CheckSum_In; }
|
||||
|
||||
bool IsBattleAuthServer(void) const { return m_bBattleAuth; }
|
||||
bool IsBattleGameServer(void) const { return m_bBattleGame; }
|
||||
bool IsBattleAgentServer(void) const { return m_bBattleAgent; }
|
||||
|
||||
DBInfo& GetPart1UnifiedDBInfo() { return m_stPart1UnifiedDBInfo; }
|
||||
DBInfo& GetAdminToolDBInfo() { return m_stAdminToolDBInfo; }
|
||||
DBInfo& GetKeeperDBInfo() { return m_stKeeperDBInfo; }
|
||||
DBInfo& GetAuthDBInfo() { return m_stAuthDBInfo; }
|
||||
DBInfo& GetGameDBInfo() { return m_stGameDBInfo; }
|
||||
DBInfo& GetLogDBInfo() { return m_stLogDBInfo; }
|
||||
|
||||
char* GetGammaniaCode() { return m_szGammaniaCode; }
|
||||
char* GetGammaniaRegin() { return m_szGammaniaRegin; }
|
||||
char* GetGammaniaAddr() { return m_szGammaniaAddr; }
|
||||
int GammaniaPort1() { return m_GammaniaPort1; }
|
||||
int GammaniaPort2() { return m_GammaniaPort2; }
|
||||
|
||||
bool UseContents(unsigned long dwContents) { return (m_dwGameContentsFlag & dwContents) == dwContents; }
|
||||
};
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user