Restructure repository to include all source folders
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>
This commit is contained in:
141
Server/RylServerProject/RylChatServer/RylChatServerCommands.cpp
Normal file
141
Server/RylServerProject/RylChatServer/RylChatServerCommands.cpp
Normal file
@@ -0,0 +1,141 @@
|
||||
#include "stdafx.h"
|
||||
#include "RylChatServer.h"
|
||||
#include <BaseLibrary/Log/ServerLog.h>
|
||||
#include <BaseLibrary/Network/IOCP/IOCPNet.h>
|
||||
#include <RylServerLibrary/Utility/ServerAppFrameWork/ConsoleWindow/ConsoleCMDFactory.h>
|
||||
|
||||
#include <Network/Packet/PacketStatistics.h>
|
||||
|
||||
#include "ChatLog.h"
|
||||
|
||||
class CCMDStatClear : public CConsoleCMDSingleton<CCMDStatClear>
|
||||
{
|
||||
protected:
|
||||
virtual bool DoProcess()
|
||||
{
|
||||
CPacketStatistics::GetInstance().Clear();
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
class CCMDStatLog : public CConsoleCMDSingleton<CCMDStatLog>
|
||||
{
|
||||
protected:
|
||||
virtual bool DoProcess()
|
||||
{
|
||||
CPacketStatistics::GetInstance().Log();
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
class CCMDShowStatistics : public CConsoleCMDSingleton<CCMDShowStatistics>
|
||||
{
|
||||
protected:
|
||||
virtual bool DoProcess()
|
||||
{
|
||||
CRylChatServer::GetInstance().PrintStatistics();
|
||||
CRylChatServer::GetInstance().PrintServerInfo();
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
class CCMDPrintLog : public CConsoleCMDSingleton<CCMDPrintLog>
|
||||
{
|
||||
protected:
|
||||
virtual bool DoProcess()
|
||||
{
|
||||
const int MAX_BUFFER = 4096;
|
||||
char szBuffer[MAX_BUFFER];
|
||||
|
||||
if(CRylChatServer::GetInstance().MakeChatLog(szBuffer, MAX_BUFFER))
|
||||
{
|
||||
SERLOG1(g_Log, "ä<EFBFBD><EFBFBD> <20><><EFBFBD>踦 <20><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD> : \r\n%s", szBuffer);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
class CCMDFlush : public CConsoleCMDSingleton<CCMDFlush>
|
||||
{
|
||||
protected:
|
||||
virtual bool DoProcess()
|
||||
{
|
||||
SERLOG0(g_Log, "<EFBFBD>α<EFBFBD> Flush<73>մϴ<D5B4>");
|
||||
SERLOG0(g_SessionLog, "<EFBFBD>α<EFBFBD> Flush<73>մϴ<D5B4>.");
|
||||
CChatLog::GetInstance().Flush();
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
class CCMDConnect : public CConsoleCMDSingleton<CCMDConnect>
|
||||
{
|
||||
protected:
|
||||
virtual bool DoProcess()
|
||||
{
|
||||
CRylChatServer::GetInstance().ConnectToAgentServer();
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
class CCMDReloadSetup : public CConsoleCMDSingleton<CCMDReloadSetup>
|
||||
{
|
||||
protected:
|
||||
virtual bool DoProcess()
|
||||
{
|
||||
CRylChatServer::GetInstance().ReloadSetup();
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
class CCMDNewLog : public CConsoleCMDSingleton<CCMDNewLog>
|
||||
{
|
||||
protected:
|
||||
virtual bool DoProcess()
|
||||
{
|
||||
if (!g_ChattingLog.NewLog())
|
||||
{
|
||||
SERLOG1(g_Log, "this:0x%p/New chatlog make failed", this);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!g_Log.NewLog())
|
||||
{
|
||||
SERLOG1(g_Log, "this:0x%p/New serverlog make failed", this);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
bool CRylChatServer::InitializeCommand()
|
||||
{
|
||||
#define INIT_COMMAND_FAILED(detail) TEXT("Command create failed - "##detail)
|
||||
|
||||
#define ADD_COMMAND(cmdstring, cmdobject, errmsg_val) \
|
||||
if(0 == (errmsg_val) && !GetCommandFactory()->AddCommand(cmdstring, new cmdobject)) { \
|
||||
(errmsg_val) = INIT_COMMAND_FAILED(cmdstring); }
|
||||
|
||||
const TCHAR* szErrorMessage = 0;
|
||||
|
||||
ADD_COMMAND("pool", CCMDShowStatistics, szErrorMessage);
|
||||
ADD_COMMAND("log", CCMDPrintLog, szErrorMessage);
|
||||
ADD_COMMAND("flush", CCMDFlush, szErrorMessage);
|
||||
ADD_COMMAND("connect", CCMDConnect, szErrorMessage);
|
||||
ADD_COMMAND("reloadsetup", CCMDReloadSetup, szErrorMessage);
|
||||
|
||||
ADD_COMMAND("statclear", CCMDStatClear, szErrorMessage);
|
||||
ADD_COMMAND("statlog", CCMDStatLog, szErrorMessage);
|
||||
|
||||
ADD_COMMAND("newlog", CCMDNewLog, szErrorMessage);
|
||||
|
||||
if(0 != szErrorMessage)
|
||||
{
|
||||
ERRLOG0(g_Log, szErrorMessage);
|
||||
return false;
|
||||
};
|
||||
|
||||
return true;
|
||||
}
|
||||
Reference in New Issue
Block a user