#include "StdAfx.h" #include ".\sunserverinfo.h" SunServerInfo::SunServerInfo() { } SunServerInfo::~SunServerInfo(void) { } void SunServerInfo::LoadScript( CString strFilePath ) { LoadCommonInfo( strFilePath ); LoadLogfileInfo( strFilePath ); LoadServerInfo( strFilePath ); LoadClientInfo( strFilePath ); LoadAuthInfo( strFilePath ); } void SunServerInfo::LoadCommonInfo( CString strFilePath ) { m_Common.m_nCommonFile = GetPrivateProfileInt( "COMMON", "GET_SERVERINFO_FROM_FILE", 0, strFilePath ); m_Common.m_nCommonGM = GetPrivateProfileInt( "COMMON", "GMLIST_APPLY", 0, strFilePath ); m_Common.m_nCommonField = GetPrivateProfileInt( "COMMON", "FIELD_SERVER_TYPE ", 0, strFilePath ); m_Common.m_nCommonBattle = GetPrivateProfileInt( "COMMON", "BATTLE_SERVER_TYPE ", 0, strFilePath ); m_Common.m_nCommonVillage = GetPrivateProfileInt( "COMMON", "VILLAGE_RENDERINFO ", 0, strFilePath ); m_Common.m_nCommonService = GetPrivateProfileInt( "COMMON", "SERVICE_MODE ", 0, strFilePath ); m_Common.m_nCommonAgeGrade = GetPrivateProfileInt( "COMMON", "AGE_GRADE ", 0, strFilePath ); m_Common.m_nCommonCryptoGraphy = GetPrivateProfileInt( "COMMON", "CRYPTOGRAPHY_ENABLED ", 0, strFilePath ); m_Common.m_nCommonCryptoKeyChanged = GetPrivateProfileInt( "COMMON", "CRYPTO_KEY_CHANGED", 0, strFilePath ); m_Common.m_nCommonCryptoKeyChangeInterval = GetPrivateProfileInt( "COMMON", "CRYPTO_KEY_CHANGE_INTERVAL", 0, strFilePath ); m_Common.m_nCommonServerStatus = GetPrivateProfileInt( "COMMON", "SERVER_STATUS", 0, strFilePath ); } void SunServerInfo::LoadLogfileInfo( CString strFilePath ) { TCHAR szFilePath[MAX_PATH]; GetPrivateProfileString( "LOGFILE", "WOPS_LOGFILE_PATH", "", szFilePath, MAX_PATH, strFilePath ); m_LogFile.m_strWopsLogPath = szFilePath; m_LogFile.m_nWopsLogOption = GetPrivateProfileInt( "LOGFILE", "WOPS_LOGFILE_OPTION", 0, strFilePath ); m_LogFile.m_nSunLogOption = GetPrivateProfileInt( "LOGFILE", "SUN_LOGFILE_OPTION ", 0, strFilePath ); m_LogFile.m_nSunLogLevel = GetPrivateProfileInt( "LOGFILE", "SUN_LOGFILE_LEVEL ", 0, strFilePath ); GetPrivateProfileString( "LOGFILE", "SUN_LOGFILE_PATH", "", szFilePath, MAX_PATH, strFilePath ); m_LogFile.m_strSunLogPath = szFilePath; } void SunServerInfo::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 SunServerInfo::LoadClientInfo( CString strFilePath ) { m_ClientHandler.m_nAccept = GetPrivateProfileInt( "CLIENT_IOHANDLER", "MAX_ACCEPT_SESSION ", 0, strFilePath ); m_ClientHandler.m_nConnect = GetPrivateProfileInt( "CLIENT_IOHANDLER", "MAX_CONNECT_SESSION ", 0, strFilePath ); m_ClientHandler.m_nSendBuf = GetPrivateProfileInt( "CLIENT_IOHANDLER", "SEND_BUFFER_SIZE ", 0, strFilePath ); m_ClientHandler.m_nRecvBuf = GetPrivateProfileInt( "CLIENT_IOHANDLER", "RECV_BUFFER_SIZE ", 0, strFilePath ); m_ClientHandler.m_nTimeOut = GetPrivateProfileInt( "CLIENT_IOHANDLER", "TIME_OUT ", 0, strFilePath ); m_ClientHandler.m_nPacketSize = GetPrivateProfileInt( "CLIENT_IOHANDLER", "MAX_PACKET_SIZE ", 0, strFilePath ); m_ClientHandler.m_nAcceptThread = GetPrivateProfileInt( "CLIENT_IOHANDLER", "NUMBER_OF_ACCEPT_THREADs ", 0, strFilePath ); m_ClientHandler.m_nConnectThread = GetPrivateProfileInt( "CLIENT_IOHANDLER", "NUMBER_OF_CONNECT_THREADS ", 0, strFilePath ); m_ClientHandler.m_nIoThread = GetPrivateProfileInt( "CLIENT_IOHANDLER", "NUMBER_OF_IO_THREADS ", 0, strFilePath ); } void SunServerInfo::LoadAuthInfo( CString strFilePath ) { m_Auth.m_bEnable = GetPrivateProfileInt( "AUTH_AGENT", "ENABLE_AUTH_AGENT_SERVER ", 0, strFilePath ); m_Auth.m_wChannel = GetPrivateProfileInt( "AUTH_AGENT", "CHANNEL_FOR_WORLD ", 0, strFilePath ); } void SunServerInfo::SaveScript( CString strFilePath ) { SaveCommonInfo( strFilePath ); SaveLogfileInfo( strFilePath ); SaveServerInfo( strFilePath ); SaveClientInfo( strFilePath ); SaveAuthInfo( strFilePath ); } void SunServerInfo::SaveCommonInfo( CString strFilePath ) { CString strTemp; strTemp.Format("%d", m_Common.m_nCommonFile ); WritePrivateProfileString( "COMMON", "GET_SERVERINFO_FROM_FILE", strTemp, strFilePath ); strTemp.Format("%d", m_Common.m_nCommonGM ); WritePrivateProfileString( "COMMON", "GMLIST_APPLY", strTemp, strFilePath ); strTemp.Format("%d", m_Common.m_nCommonField ); WritePrivateProfileString( "COMMON", "FIELD_SERVER_TYPE ", strTemp, strFilePath ); strTemp.Format("%d", m_Common.m_nCommonBattle ); WritePrivateProfileString( "COMMON", "BATTLE_SERVER_TYPE ", strTemp, strFilePath ); strTemp.Format("%d", m_Common.m_nCommonVillage ); WritePrivateProfileString( "COMMON", "VILLAGE_RENDERINFO ", strTemp, strFilePath ); strTemp.Format("%d", m_Common.m_nCommonService ); WritePrivateProfileString( "COMMON", "SERVICE_MODE ", strTemp, strFilePath ); strTemp.Format("%d", m_Common.m_nCommonAgeGrade ); WritePrivateProfileString( "COMMON", "AGE_GRADE ", strTemp, strFilePath ); strTemp.Format("%d", m_Common.m_nCommonCryptoKeyChanged ); WritePrivateProfileString( "COMMON", "CRYPTO_KEY_CHANGED ", strTemp, strFilePath ); strTemp.Format("%d", m_Common.m_nCommonCryptoKeyChangeInterval ); WritePrivateProfileString( "COMMON", "CRYPTO_KEY_CHANGE_INTERVAL ", strTemp, strFilePath ); strTemp.Format("%d", m_Common.m_nCommonServerStatus ); WritePrivateProfileString( "COMMON", "SERVER_STATUS ", strTemp, strFilePath ); } void SunServerInfo::SaveLogfileInfo( CString strFilePath ) { CString strTemp; WritePrivateProfileString( "LOGFILE", "WOPS_LOGFILE_PATH", m_LogFile.m_strWopsLogPath, strFilePath ); strTemp.Format("%d", m_LogFile.m_nWopsLogOption ); WritePrivateProfileString( "LOGFILE", "WOPS_LOGFILE_OPTION", 0, strFilePath ); strTemp.Format("%d", m_LogFile.m_nSunLogOption ); WritePrivateProfileString( "LOGFILE", "SUN_LOGFILE_OPTION ", 0, strFilePath ); strTemp.Format("%d", m_LogFile.m_nSunLogLevel ); WritePrivateProfileString( "LOGFILE", "SUN_LOGFILE_LEVEL ", 0, strFilePath ); WritePrivateProfileString( "LOGFILE", "SUN_LOGFILE_PATH", m_LogFile.m_strSunLogPath, strFilePath ); } void SunServerInfo::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 SunServerInfo::SaveClientInfo( CString strFilePath ) { CString strTemp; strTemp.Format("%d", m_ClientHandler.m_nAccept ); WritePrivateProfileString( "CLIENT_IOHANDLER", "MAX_ACCEPT_SESSION ", strTemp, strFilePath ); strTemp.Format("%d", m_ClientHandler.m_nConnect ); WritePrivateProfileString( "CLIENT_IOHANDLER", "MAX_CONNECT_SESSION ", strTemp, strFilePath ); strTemp.Format("%d", m_ClientHandler.m_nSendBuf ); WritePrivateProfileString( "CLIENT_IOHANDLER", "SEND_BUFFER_SIZE ", strTemp, strFilePath ); strTemp.Format("%d", m_ClientHandler.m_nRecvBuf ); WritePrivateProfileString( "CLIENT_IOHANDLER", "RECV_BUFFER_SIZE ", strTemp, strFilePath ); strTemp.Format("%d", m_ClientHandler.m_nTimeOut ); WritePrivateProfileString( "CLIENT_IOHANDLER", "TIME_OUT", strTemp, strFilePath ); strTemp.Format("%d", m_ClientHandler.m_nPacketSize ); WritePrivateProfileString( "CLIENT_IOHANDLER", "MAX_PACKET_SIZE ", strTemp, strFilePath ); strTemp.Format("%d", m_ClientHandler.m_nAcceptThread ); WritePrivateProfileString( "CLIENT_IOHANDLER", "NUMBER_OF_ACCEPT_THREADs ", strTemp, strFilePath ); strTemp.Format("%d", m_ClientHandler.m_nConnectThread ); WritePrivateProfileString( "CLIENT_IOHANDLER", "NUMBER_OF_CONNECT_THREADS ", strTemp, strFilePath ); strTemp.Format("%d", m_ClientHandler.m_nIoThread ); WritePrivateProfileString( "CLIENT_IOHANDLER", "NUMBER_OF_IO_THREADS ", strTemp, strFilePath ); } void SunServerInfo::SaveAuthInfo( CString strFilePath ) { CString strTemp; strTemp.Format("%d", m_Auth.m_bEnable ); WritePrivateProfileString( "AUTH_AGENT", "ENABLE_AUTH_AGENT_SERVER ", 0, strFilePath ); strTemp.Format("%d", m_Auth.m_wChannel ); WritePrivateProfileString( "AUTH_AGENT", "CHANNEL_FOR_WORLD ", 0, strFilePath ); }