增加pingpong指令,并调整收到客户端信息的打印日志级别

master
nxiaoxiao 1 year ago
parent a214b95c82
commit c783fee21b

@ -52,6 +52,7 @@ namespace OMS.NET.Instructs
"get_presence" => JsonSerializer.Deserialize<GetPresenceInstruct>(root.GetRawText(), options), "get_presence" => JsonSerializer.Deserialize<GetPresenceInstruct>(root.GetRawText(), options),
"get_mapData" => JsonSerializer.Deserialize<GetMapDataInstruct>(root.GetRawText(), options), "get_mapData" => JsonSerializer.Deserialize<GetMapDataInstruct>(root.GetRawText(), options),
"get_mapLayer" => JsonSerializer.Deserialize<GetMapLayerInstruct>(root.GetRawText(), options), "get_mapLayer" => JsonSerializer.Deserialize<GetMapLayerInstruct>(root.GetRawText(), options),
"ping" => JsonSerializer.Deserialize<PingInstuct>(root.GetRawText(), options),
//广播指令 //广播指令
"broadcast" => classValue switch "broadcast" => classValue switch
@ -61,7 +62,7 @@ namespace OMS.NET.Instructs
_ => JsonSerializer.Deserialize<Instruct>(root.GetRawText(), options) _ => JsonSerializer.Deserialize<Instruct>(root.GetRawText(), options)
}, },
_ => null _ => null
} ?? throw new JsonException("反序列化失败"); } ?? throw new JsonException($"{typeValue} 反序列化失败");
return instruct; return instruct;
} }
else else

@ -12,7 +12,7 @@ namespace OMS.NET
private IPEndPoint iPEndPoint = new(IPAddress.Any, 0); private IPEndPoint iPEndPoint = new(IPAddress.Any, 0);
protected override async void OnMessage(MessageEventArgs e) protected override async void OnMessage(MessageEventArgs e)
{ {
GlobalArea.Log.Info(this.ID + " " + this.Context.UserEndPoint.ToString() + ":" + e.Data); GlobalArea.Log.Debug(this.ID + " " + this.Context.UserEndPoint.ToString() + ":" + e.Data);
Instruct? instruct = Instruct.JsonStringParse(e.Data); Instruct? instruct = Instruct.JsonStringParse(e.Data);
if (instruct != null) if (instruct != null)
{ {

Loading…
Cancel
Save