This commit is contained in:
Kyle Belanger 2023-10-14 11:06:13 -04:00
commit 45d35fbef3
2 changed files with 13 additions and 2 deletions

View File

@ -1,5 +1,6 @@
using System.Buffers.Binary;
using System.Net.Sockets;
using AscNet.Common;
using AscNet.Common.Util;
using MessagePack;
using Newtonsoft.Json;
@ -80,11 +81,15 @@ namespace AscNet.GameServer
RequestPacketHandlerDelegate? requestPacketHandler = PacketFactory.GetRequestPacketHandler(request.Name);
if (requestPacketHandler is not null)
{
c.Log(request.Name);
if (Common.Common.config.VerboseLevel > VerboseLevel.Silent)
c.Log($"{request.Name}{(Common.Common.config.VerboseLevel >= VerboseLevel.Debug ? (", " + JsonConvert.SerializeObject(MessagePackSerializer.Typeless.Deserialize(request.Content))) : "")}");
requestPacketHandler.Invoke(this, request);
}
else
c.Warn($"{request.Name} handler not found!");
{
if (Common.Common.config.VerboseLevel > VerboseLevel.Silent)
c.Warn($"{request.Name} handler not found!{(Common.Common.config.VerboseLevel >= VerboseLevel.Debug ? (", " + JsonConvert.SerializeObject(MessagePackSerializer.Typeless.Deserialize(request.Content))) : "")}");
}
break;
case Packet.ContentType.Push:
Packet.Push push = MessagePackSerializer.Deserialize<Packet.Push>(packet.Content);

View File

@ -8,6 +8,12 @@ namespace AscNet
static void Main(string[] args)
{
Logger.c.Log("Starting...");
#if DEBUG
if (Common.Common.config.VerboseLevel < Common.VerboseLevel.Debug)
Common.Common.config.VerboseLevel = Common.VerboseLevel.Debug;
#endif
PacketFactory.LoadPacketHandlers();
Task.Run(GameServer.Server.Instance.Start);
SDKServer.SDKServer.Main(args);