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>
94 lines
2.0 KiB
C++
94 lines
2.0 KiB
C++
// AlphaServer.cpp : 콘솔 응용 프로그램에 대한 진입점을 정의합니다.
|
|
//
|
|
#include "Global.h"
|
|
#include <Nave/NFLog.h>
|
|
#include <Nave/NFTokenizer.h>
|
|
#include <Nave/NFStringUtil.h>
|
|
#include "ServerCtrl.h"
|
|
#include "resource.h"
|
|
|
|
#include <Nave/NFIni.h>
|
|
|
|
|
|
int APIENTRY WinMain(HINSTANCE hInstance,
|
|
HINSTANCE hPrevInstance,
|
|
LPSTR lpCmdLine,
|
|
int nCmdShow)
|
|
{
|
|
Nave::NFLog::SetLogLimit(Nave::NFLog::Warning);
|
|
// Nave::NFLog::SetLogDetail(true);
|
|
|
|
WCHAR strCmd[512];
|
|
_tcscpy(strCmd, Nave::ToString(lpCmdLine).c_str());
|
|
|
|
g_Server = new ServerCtrl();
|
|
|
|
if(!g_Server)
|
|
{
|
|
return 0;
|
|
}
|
|
|
|
Nave::NFIni ini;
|
|
ini.Open(L"./Config.ini");
|
|
|
|
DWORD width, height;
|
|
WCHAR szTitle[128];
|
|
DWORD len = 128;
|
|
|
|
ini.GetValue(L"WINDOWS", L"TITLE", szTitle, len);
|
|
ini.GetValue(L"WINDOWS", L"WIDTH", &width);
|
|
ini.GetValue(L"WINDOWS", L"HEIGHT", &height);
|
|
|
|
WCHAR szAllowIP[128];
|
|
WCHAR szBlockIP[128];
|
|
WCHAR szenableIPSec[128];
|
|
BOOL enableIPSec;
|
|
ini.GetValue(L"IPSEC", L"ALLOWIP", szAllowIP, len);
|
|
ini.GetValue(L"IPSEC", L"BLOCKIP", szBlockIP, len);
|
|
ini.GetValue(L"IPSEC", L"ENABLE", szenableIPSec, len);
|
|
if(wcscmp(szenableIPSec, L"TRUE") == 0)
|
|
enableIPSec = TRUE;
|
|
else
|
|
enableIPSec = FALSE;
|
|
|
|
ini.Close();
|
|
|
|
|
|
// 테스트
|
|
IPBAND ipInfo[10];
|
|
g_IPSec.LoadAllowIP(szAllowIP);
|
|
g_IPSec.LoadBlockIP(szBlockIP);
|
|
g_IPSec.SerializeOut(0, 0, 10, (char*)ipInfo);
|
|
|
|
// g_IPSec.ClearAllowIP();
|
|
// g_IPSec.SerializeIn((char*)ipInfo, 10);
|
|
|
|
if(!g_Server->Init(hInstance, nCmdShow, width, height, szTitle, MIS(IDI_ICON1)))
|
|
return 0;
|
|
|
|
// IP체크 테스트
|
|
char szIP[32];
|
|
GetLocalIP(szIP, FALSE);
|
|
if( g_IPSec.IsAliveIP(szIP) )
|
|
{
|
|
LOG_IMPORTANT((L"Alive IP : %s", Nave::ToString(szIP).c_str() ));
|
|
}
|
|
else
|
|
{
|
|
LOG_IMPORTANT((L"Non Alive IP : %s", Nave::ToString(szIP).c_str() ));
|
|
}
|
|
|
|
if( g_IPSec.CheckBlockIP(szIP) )
|
|
{
|
|
LOG_IMPORTANT((L"Block IP : %s", Nave::ToString(szIP).c_str() ));
|
|
}
|
|
|
|
g_Server->StartCommand();
|
|
|
|
_DELETE(g_Server);
|
|
|
|
// 로그파일을 종료한다.
|
|
Nave::NFLog::CloseLog();
|
|
return 0;
|
|
}
|