159 lines
6.7 KiB
C++
159 lines
6.7 KiB
C++
#include "StdAfx.h"
|
|
#include ".\agentinfoparser.h"
|
|
#include <PublicDefine.h>
|
|
|
|
AgentInfoParser::AgentInfoParser(void)
|
|
{
|
|
}
|
|
|
|
AgentInfoParser::~AgentInfoParser(void)
|
|
{
|
|
}
|
|
|
|
BOOL AgentInfoParser::Load( const TCHAR* pszFileName )
|
|
{
|
|
if( !Init( pszFileName ) )
|
|
return FALSE;
|
|
|
|
// Common
|
|
GetPrivateProfileString( "COMMON", "AUTH_SYSTEM_LOG_VIEW_PATH", NULL, m_szAuthSystemLogViewPath, MAX_PATH, pszFileName);
|
|
GetPrivateProfileString( "COMMON", "LOG_VIEW_PATH", NULL, m_szLogViewPath, MAX_PATH, pszFileName);
|
|
GetPrivateProfileString( "COMMON", "NOTICE_PATH", NULL, m_szNoticePath, MAX_PATH, pszFileName);
|
|
m_dwCheckTime = GetPrivateProfileInt( "COMMON", "CHECK_INTERVAL_TIME", 3000, pszFileName );
|
|
|
|
// [CLIENT_IOHANDLER] 설정 시작
|
|
INI_IOHANDLER_DESC &cio = m_ServerEnv.ClientIoHandler;
|
|
GetPrivateProfileString( "CLIENT_IOHANDLER", "IP", NULL, m_ServerEnv.ClientIoHandler.szIP, MAX_IP_SIZE, pszFileName);
|
|
cio.wPort = GetPrivateProfileInt( "CLIENT_IOHANDLER", "PORT", NULL, pszFileName );
|
|
cio.dwMaxAcceptSession = GetPrivateProfileInt( "CLIENT_IOHANDLER", "MAX_ACCEPT_SESSION", NULL, pszFileName );
|
|
cio.dwMaxConnectSession = GetPrivateProfileInt( "CLIENT_IOHANDLER", "MAX_CONNECT_SESSION", NULL, pszFileName );
|
|
cio.dwSendBufferSize = GetPrivateProfileInt( "CLIENT_IOHANDLER", "SEND_BUFFER_SIZE", NULL, pszFileName );
|
|
cio.dwRecvBufferSize = GetPrivateProfileInt( "CLIENT_IOHANDLER", "RECV_BUFFER_SIZE", NULL, pszFileName );
|
|
cio.dwTimeOut = GetPrivateProfileInt( "CLIENT_IOHANDLER", "TIME_OUT", NULL, pszFileName );
|
|
cio.dwNumberOfAcceptThreads = GetPrivateProfileInt( "CLIENT_IOHANDLER", "NUMBER_OF_ACCEPT_THREADS", NULL, pszFileName );
|
|
cio.dwNumberOfIoThreads = GetPrivateProfileInt( "CLIENT_IOHANDLER", "NUMBER_OF_IO_THREADS", NULL, pszFileName );
|
|
cio.dwNumberOfConnectThreads = GetPrivateProfileInt( "CLIENT_IOHANDLER", "NUMBER_OF_CONNECT_THREADS", NULL, pszFileName );
|
|
cio.dwMaxPacketSize = GetPrivateProfileInt( "CLIENT_IOHANDLER", "MAX_PACKET_SIZE", NULL, pszFileName );
|
|
|
|
// [SERVER_IOHANDLER] 설정 시작
|
|
INI_IOHANDLER_DESC &sio = m_ServerEnv.ServerIoHandler;
|
|
GetPrivateProfileString( "SERVER_IOHANDLER", "IP", NULL, m_ServerEnv.ServerIoHandler.szIP, MAX_IP_SIZE, pszFileName);
|
|
sio.wPort = GetPrivateProfileInt( "SERVER_IOHANDLER", "PORT", NULL, pszFileName );
|
|
sio.dwMaxAcceptSession = GetPrivateProfileInt( "SERVER_IOHANDLER", "MAX_ACCEPT_SESSION", NULL, pszFileName );
|
|
sio.dwMaxConnectSession = GetPrivateProfileInt( "SERVER_IOHANDLER", "MAX_CONNECT_SESSION", NULL, pszFileName );
|
|
sio.dwSendBufferSize = GetPrivateProfileInt( "SERVER_IOHANDLER", "SEND_BUFFER_SIZE", NULL, pszFileName );
|
|
sio.dwRecvBufferSize = GetPrivateProfileInt( "SERVER_IOHANDLER", "RECV_BUFFER_SIZE", NULL, pszFileName );
|
|
sio.dwTimeOut = GetPrivateProfileInt( "SERVER_IOHANDLER", "TIME_OUT", NULL, pszFileName );
|
|
sio.dwNumberOfAcceptThreads = GetPrivateProfileInt( "SERVER_IOHANDLER", "NUMBER_OF_ACCEPT_THREADS", NULL, pszFileName );
|
|
sio.dwNumberOfIoThreads = GetPrivateProfileInt( "SERVER_IOHANDLER", "NUMBER_OF_IO_THREADS", NULL, pszFileName );
|
|
sio.dwNumberOfConnectThreads = GetPrivateProfileInt( "SERVER_IOHANDLER", "NUMBER_OF_CONNECT_THREADS", NULL, pszFileName );
|
|
sio.dwMaxPacketSize = GetPrivateProfileInt( "SERVER_IOHANDLER", "MAX_PACKET_SIZE", NULL, pszFileName );
|
|
|
|
// 서버정보
|
|
GetPrivateProfileString( "UPDATE_SERVER", "IP", NULL, m_UpdateServer.m_szServerIP, MAX_IP_SIZE, pszFileName );
|
|
m_UpdateServer.m_wServerPort = GetPrivateProfileInt( "UPDATE_SERVER", "PORT", 0, pszFileName );
|
|
GetPrivateProfileString( "UPDATE_SERVER", "BASIC_PATH", NULL, m_szBasicServerPath, MAX_PATH, pszFileName );
|
|
#ifdef __20080312__SOLARAUTH_SERVER_PATCH
|
|
GetPrivateProfileString( "UPDATE_SERVER", "BASIC_SOLAR_SCRIPTPATH", NULL, m_szSCFolderPath, MAX_PATH, pszFileName );
|
|
#endif
|
|
// 툴 경로
|
|
#ifdef _NA_006662_20130423_SVNPATCH
|
|
patch_style_ = GetPrivateProfileInt("UPDATE_TOOL", "PATCH_STYLE", 0, pszFileName);
|
|
#endif //_NA_006662_20130423_SVNPATCH
|
|
GetPrivateProfileString( "UPDATE_TOOL", "PATH", NULL, m_szToolPath, MAX_PATH, pszFileName );
|
|
|
|
TCHAR szPath[MAX_PATH];
|
|
TCHAR szServerType[MAX_PATH];
|
|
std::string strPath;
|
|
int nRetSize = 0;
|
|
|
|
// Game Server Path
|
|
for( int i = 0 ; i < MAX_SERVER; i++ )
|
|
{
|
|
_snprintf( szServerType, MAX_PATH, "%d", i );
|
|
nRetSize = GetPrivateProfileString( "GAME_SERVER", szServerType, NULL, szPath, MAX_PATH, pszFileName );
|
|
if( nRetSize > 0 )
|
|
{
|
|
strPath = szPath;
|
|
m_mapGameServer.insert( std::make_pair( i, strPath ) );
|
|
}
|
|
}
|
|
|
|
TCHAR szProcess[MAX_PATH];
|
|
int nRetSizeEx = 0;
|
|
|
|
// Game Process
|
|
for( int i = 0 ; i < MAX_SERVER; i++ )
|
|
{
|
|
_snprintf( szServerType, MAX_PATH, "%d", i );
|
|
nRetSizeEx = GetPrivateProfileString( "CHECK_PROCESS", szServerType, NULL, szProcess, MAX_PATH, pszFileName );
|
|
if( nRetSizeEx > 0 )
|
|
{
|
|
std::string strProcess;
|
|
strProcess = szProcess;
|
|
m_mapGameProcess.insert( std::make_pair( i, strProcess ) );
|
|
}
|
|
}
|
|
|
|
#ifdef __20101123__UPDATE_AGENT_AUTO_RESTART
|
|
// 주중에(on weekdays) 반복적으로 게임 서버 프로세스들을 자동으로 종료/실행하기 위한 설정
|
|
// [0,23] 범위의 숫자 값으로 24시간제 시간으로 인식되며, 주어진 시간의 정시(0분)에 동작한다.
|
|
UINT auto_stop_time = ::GetPrivateProfileInt("AUTO_RESTART", "AUTO_STOP_TIME", UINT_MAX, pszFileName);
|
|
UINT auto_start_time = ::GetPrivateProfileInt("AUTO_RESTART", "AUTO_START_TIME", UINT_MAX, pszFileName);
|
|
|
|
m_AutoStopSchedule.ResetAll();
|
|
if (auto_stop_time != UINT_MAX)
|
|
{
|
|
for (int i = Schedule::MONDAY; i <= Schedule::FRIDAY; ++i) {
|
|
m_AutoStopSchedule.SetDayOfWeek((Schedule::DayOfWeek)i);
|
|
}
|
|
auto_stop_time %= 24;
|
|
m_AutoStopSchedule.SetHour((int)auto_stop_time);
|
|
m_AutoStopSchedule.SetMinute(0);
|
|
MSGOUT("Scheduled Auto-stop on %02u:00 every weekdays", auto_stop_time);
|
|
}
|
|
|
|
m_AutoStartSchedule.ResetAll();
|
|
if (auto_start_time != UINT_MAX)
|
|
{
|
|
for (int i = Schedule::MONDAY; i <= Schedule::FRIDAY; ++i) {
|
|
m_AutoStartSchedule.SetDayOfWeek((Schedule::DayOfWeek)i);
|
|
}
|
|
auto_start_time %= 24;
|
|
m_AutoStartSchedule.SetHour((int)auto_start_time);
|
|
m_AutoStartSchedule.SetMinute(0);
|
|
MSGOUT("Scheduled Auto-start on %02u:00 every weekdays", auto_start_time);
|
|
}
|
|
#endif
|
|
|
|
return TRUE;
|
|
}
|
|
|
|
|
|
BOOL AgentInfoParser::GetGameServerPath( BYTE byServerType, OUT std::string& strPath )
|
|
{
|
|
GAMESERVER_MAP_ITER iter;
|
|
|
|
iter = m_mapGameServer.find( byServerType );
|
|
if( iter != m_mapGameServer.end() )
|
|
{
|
|
strPath = iter->second;
|
|
return TRUE;
|
|
}
|
|
|
|
return FALSE;
|
|
}
|
|
|
|
BOOL AgentInfoParser::GetGameProcessName( BYTE byServerType, OUT std::string& strName )
|
|
{
|
|
GAMESERVER_MAP_ITER iter;
|
|
|
|
iter = m_mapGameProcess.find( byServerType );
|
|
if( iter != m_mapGameProcess.end() )
|
|
{
|
|
strName = iter->second;
|
|
return TRUE;
|
|
}
|
|
|
|
return FALSE;
|
|
} |