107 lines
4.4 KiB
C++
107 lines
4.4 KiB
C++
#include "StdAfx.h"
|
|
#include ".\guildserverinfo.h"
|
|
|
|
GuildServerInfo::GuildServerInfo(void)
|
|
{
|
|
m_nConnectionCount = 0;
|
|
}
|
|
|
|
GuildServerInfo::~GuildServerInfo(void)
|
|
{
|
|
}
|
|
|
|
|
|
void GuildServerInfo::LoadScript( CString strFilePath )
|
|
{
|
|
LoadCommonInfo( strFilePath );
|
|
LoadServerInfo( strFilePath );
|
|
LoadConnectInfo( strFilePath );
|
|
}
|
|
|
|
void GuildServerInfo::LoadCommonInfo( CString strFilePath )
|
|
{
|
|
m_Common.m_nCommonFile = GetPrivateProfileInt( "COMMON", "GET_SERVERINFO_FROM_FILE", 0, strFilePath );
|
|
m_nConnectionCount = GetPrivateProfileInt( "COMMON", "COUNT", 0, strFilePath );
|
|
}
|
|
|
|
void GuildServerInfo::LoadServerInfo( CString strFilePath )
|
|
{
|
|
m_ServerHandler.m_nAccept = GetPrivateProfileInt( "SERVER_IOHANDLER", "MAX_ACCEPT_SESSION ", 0, strFilePath );
|
|
m_ServerHandler.m_nConnect = GetPrivateProfileInt( "SERVER_IOHANDLER", "MAX_CONNECT_SESSION ", 0, strFilePath );
|
|
m_ServerHandler.m_nSendBuf = GetPrivateProfileInt( "SERVER_IOHANDLER", "SEND_BUFFER_SIZE ", 0, strFilePath );
|
|
m_ServerHandler.m_nRecvBuf = GetPrivateProfileInt( "SERVER_IOHANDLER", "RECV_BUFFER_SIZE ", 0, strFilePath );
|
|
m_ServerHandler.m_nTimeOut = GetPrivateProfileInt( "SERVER_IOHANDLER", "TIME_OUT ", 0, strFilePath );
|
|
m_ServerHandler.m_nPacketSize = GetPrivateProfileInt( "SERVER_IOHANDLER", "MAX_PACKET_SIZE ", 0, strFilePath );
|
|
m_ServerHandler.m_nAcceptThread = GetPrivateProfileInt( "SERVER_IOHANDLER", "NUMBER_OF_ACCEPT_THREADs ", 0, strFilePath );
|
|
m_ServerHandler.m_nConnectThread = GetPrivateProfileInt( "SERVER_IOHANDLER", "NUMBER_OF_CONNECT_THREADS ", 0, strFilePath );
|
|
m_ServerHandler.m_nIoThread = GetPrivateProfileInt( "SERVER_IOHANDLER", "NUMBER_OF_IO_THREADS ", 0, strFilePath );
|
|
}
|
|
|
|
void GuildServerInfo::LoadConnectInfo( CString strFilePath )
|
|
{
|
|
m_nConnectionType[0] = GetPrivateProfileInt( "CONNECT", "1", 0, strFilePath );
|
|
m_nConnectionType[1] = GetPrivateProfileInt( "CONNECT", "2", 0, strFilePath );
|
|
m_nConnectionType[2] = GetPrivateProfileInt( "CONNECT", "3", 0, strFilePath );
|
|
}
|
|
|
|
int GuildServerInfo::GetConnectionType( int nNum )
|
|
{
|
|
if( nNum < 0 || nNum >= MAX_GUILD_CONNECT )
|
|
return 0;
|
|
|
|
return m_nConnectionType[nNum];
|
|
}
|
|
|
|
void GuildServerInfo::SaveScript( CString strFilePath )
|
|
{
|
|
SaveCommonInfo( strFilePath );
|
|
SaveServerInfo( strFilePath );
|
|
SaveConnectInfo( strFilePath );
|
|
}
|
|
|
|
|
|
void GuildServerInfo::SaveCommonInfo( CString strFilePath )
|
|
{
|
|
CString strTemp;
|
|
strTemp.Format("%d", m_Common.m_nCommonFile );
|
|
WritePrivateProfileString( "COMMON", "GET_SERVERINFO_FROM_FILE", strTemp, strFilePath );
|
|
}
|
|
|
|
void GuildServerInfo::SaveServerInfo( CString strFilePath )
|
|
{
|
|
CString strTemp;
|
|
strTemp.Format("%d", m_ServerHandler.m_nAccept );
|
|
WritePrivateProfileString( "SERVER_IOHANDLER", "MAX_ACCEPT_SESSION ", strTemp, strFilePath );
|
|
strTemp.Format("%d", m_ServerHandler.m_nConnect );
|
|
WritePrivateProfileString( "SERVER_IOHANDLER", "MAX_CONNECT_SESSION ", strTemp, strFilePath );
|
|
strTemp.Format("%d", m_ServerHandler.m_nSendBuf );
|
|
WritePrivateProfileString( "SERVER_IOHANDLER", "SEND_BUFFER_SIZE ", strTemp, strFilePath );
|
|
strTemp.Format("%d", m_ServerHandler.m_nRecvBuf );
|
|
WritePrivateProfileString( "SERVER_IOHANDLER", "RECV_BUFFER_SIZE ", strTemp, strFilePath );
|
|
strTemp.Format("%d", m_ServerHandler.m_nTimeOut );
|
|
WritePrivateProfileString( "SERVER_IOHANDLER", "TIME_OUT", strTemp, strFilePath );
|
|
strTemp.Format("%d", m_ServerHandler.m_nPacketSize );
|
|
WritePrivateProfileString( "SERVER_IOHANDLER", "MAX_PACKET_SIZE ", strTemp, strFilePath );
|
|
strTemp.Format("%d", m_ServerHandler.m_nAcceptThread );
|
|
WritePrivateProfileString( "SERVER_IOHANDLER", "NUMBER_OF_ACCEPT_THREADs ", strTemp, strFilePath );
|
|
strTemp.Format("%d", m_ServerHandler.m_nConnectThread );
|
|
WritePrivateProfileString( "SERVER_IOHANDLER", "NUMBER_OF_CONNECT_THREADS ", strTemp, strFilePath );
|
|
strTemp.Format("%d", m_ServerHandler.m_nIoThread );
|
|
WritePrivateProfileString( "SERVER_IOHANDLER", "NUMBER_OF_IO_THREADS ", strTemp, strFilePath );
|
|
}
|
|
|
|
|
|
void GuildServerInfo::SaveConnectInfo( CString strFilePath )
|
|
{
|
|
CString strTemp;
|
|
strTemp.Format("%d", m_nConnectionCount );
|
|
WritePrivateProfileString( "CONNECT", "COUNT", strTemp, strFilePath );
|
|
strTemp.Format("%d", m_nConnectionType[0] );
|
|
WritePrivateProfileString( "CONNECT", "1", strTemp, strFilePath );
|
|
strTemp.Format("%d", m_nConnectionType[1] );
|
|
WritePrivateProfileString( "CONNECT", "2", strTemp, strFilePath );
|
|
strTemp.Format("%d", m_nConnectionType[2] );
|
|
WritePrivateProfileString( "CONNECT", "3", strTemp, strFilePath );
|
|
}
|
|
|