102 lines
3.0 KiB
C++
102 lines
3.0 KiB
C++
#include "Stdafx.h"
|
|
#include "Config.h"
|
|
#include "ShopMain.h"
|
|
CConfig::CConfig(void)
|
|
{
|
|
}
|
|
|
|
CConfig::~CConfig(void)
|
|
{
|
|
}
|
|
|
|
|
|
BOOL CConfig::LoadFile()
|
|
{
|
|
char szModuleName[MAX_PATH];
|
|
::GetModuleFileName( NULL, szModuleName, MAX_PATH );
|
|
|
|
memset(m_strConfigFile, 0x00, MAX_PATH);
|
|
|
|
int nf = (int)(strrchr(szModuleName, '\\') - szModuleName);
|
|
szModuleName[nf] = '\0';
|
|
|
|
sprintf(m_strConfigFile, "%s\\%s", szModuleName, SHOP_CONFIG);
|
|
|
|
if(0xFFFFFFFF == GetFileAttributes(m_strConfigFile)) return FALSE;
|
|
|
|
return TRUE;
|
|
}
|
|
|
|
void CConfig::SetData()
|
|
{
|
|
char szbuf[MAX_PATH];
|
|
|
|
GetPrivateProfileString("SHOP", "ServiceName", "", szbuf, MAX_PATH, m_strConfigFile);
|
|
setServiceName(szbuf);
|
|
|
|
GetPrivateProfileString("SHOP", "LogType", "3", szbuf, MAX_PATH, m_strConfigFile);
|
|
setLogType(atoi(szbuf));
|
|
|
|
GetPrivateProfileString("SHOP", "DBThreadCount", "2", szbuf, MAX_PATH, m_strConfigFile);
|
|
setDBThreadCnt(atoi(szbuf));
|
|
|
|
GetPrivateProfileString("SHOP", "DBRetryCount", "1", szbuf, MAX_PATH, m_strConfigFile);
|
|
setDBRetryCnt(atoi(szbuf));
|
|
|
|
|
|
|
|
|
|
// network
|
|
GetPrivateProfileString("NETWORK", "MaxSessionCount", "512", szbuf, MAX_PATH, m_strConfigFile);
|
|
setMaxSessionCount(atoi(szbuf));
|
|
|
|
GetPrivateProfileString("NETWORK", "IOThreadCount", "4", szbuf, MAX_PATH, m_strConfigFile);
|
|
setIOThreadCount(atoi(szbuf));
|
|
|
|
GetPrivateProfileString("NETWORK", "IPAddress", "", szbuf, MAX_PATH, m_strConfigFile);
|
|
setIPAddress(szbuf);
|
|
|
|
GetPrivateProfileString("NETWORK", "PortNum", "45612", szbuf, MAX_PATH, m_strConfigFile);
|
|
setPortNum(atoi(szbuf));
|
|
|
|
|
|
GetPrivateProfileString("SHOP_DB", "IPAddress", "", szbuf, MAX_PATH, m_strConfigFile);
|
|
setShopDB_IPAddress(szbuf);
|
|
|
|
GetPrivateProfileString("SHOP_DB", "PortNum", "6279", szbuf, MAX_PATH, m_strConfigFile);
|
|
setShopDB_PortNum(atoi(szbuf));
|
|
|
|
GetPrivateProfileString("SHOP_DB", "DBName", "", szbuf, MAX_PATH, m_strConfigFile);
|
|
setShopDB_Name(szbuf);
|
|
|
|
GetPrivateProfileString("SHOP_DB", "UserName", "", szbuf, MAX_PATH, m_strConfigFile);
|
|
setShopDB_UserName(szbuf);
|
|
|
|
GetPrivateProfileString("SHOP_DB", "Password", "", szbuf, MAX_PATH, m_strConfigFile);
|
|
setShopDB_PassWord(szbuf);
|
|
|
|
GetPrivateProfileString("SHOP_DB", "DBTimeOut", "5", szbuf, MAX_PATH, m_strConfigFile);
|
|
setShopDB_TimeOut(atoi(szbuf));
|
|
|
|
GetPrivateProfileString("SHOP_SCRIPT", "CONNECT_IP", "http://127.0.0.1", szbuf, MAX_PATH, m_strConfigFile);
|
|
setScriptConnectIP(szbuf);
|
|
|
|
GetPrivateProfileString("SHOP_SCRIPT", "CONNECT_PORT", "8080", szbuf, MAX_PATH, m_strConfigFile);
|
|
setScriptPortNum(atoi(szbuf));
|
|
|
|
GetPrivateProfileString("SHOP_SCRIPT", "REMOTE_PATH", "/ibs/Game/ProductTransfer", szbuf, MAX_PATH, m_strConfigFile);
|
|
setScriptPath(szbuf);
|
|
|
|
GetPrivateProfileString("SHOP_VERSION", "Zone", "329", szbuf, MAX_PATH, m_strConfigFile);
|
|
setVersionZone(atoi(szbuf));
|
|
|
|
GetPrivateProfileString("SHOP_VERSION", "Year", "2011", szbuf, MAX_PATH, m_strConfigFile);
|
|
setVersionYear(atoi(szbuf));
|
|
|
|
GetPrivateProfileString("SHOP_VERSION", "YearID", "34", szbuf, MAX_PATH, m_strConfigFile);
|
|
setVersionYearId(atoi(szbuf));
|
|
|
|
_instance(CShopMain)->SetListVersionInfo(m_Zone,m_year,m_yearId);
|
|
|
|
}
|