first commit

This commit is contained in:
qornwh1
2026-02-28 14:16:07 +09:00
commit 30457819b1
28 changed files with 3006 additions and 0 deletions

View File

@@ -0,0 +1,46 @@
using MMOserver.Game;
using Serilog;
class Program
{
private static void Main()
{
string timestamp = DateTime.Now.ToString("yyyy-MM-dd_HH-mm-ss");
Log.Logger = new LoggerConfiguration()
.MinimumLevel.Debug()
.WriteTo.Console()
.WriteTo.File($"logs/log_{timestamp}.txt")
.CreateLogger();
Log.Information("Write Log Started");
int port = 9500;
string connectionString = "test";
GameServer gameServer = new GameServer(port, connectionString);
// Ctrl+C → Stop() 호출 → Run() 루프 탈출 → serverThread 종료
Console.CancelKeyPress += (_, e) =>
{
// 프로세스 즉시 종료 막기
e.Cancel = true;
gameServer.Stop();
};
// 게임 서버 스레드 생성
Thread serverThread = new Thread(() =>
{
gameServer.Init();
gameServer.Run();
});
// 게임 서버 스레드 시작
serverThread.Start();
// Run()이 끝날 때까지 대기
serverThread.Join();
// Log 종료
Log.CloseAndFlush();
}
}