create, read, playercount

This commit is contained in:
2022-11-09 16:08:04 -06:00
parent a1f996e508
commit da76917490
37 changed files with 999 additions and 814 deletions

View File

@@ -1,12 +1,11 @@
using FluentValidation;
using Newtonsoft.Json;
using Shogi.Contracts.Socket;
using Shogi.Contracts.Types;
using Shogi.Api.Extensions;
using Shogi.Api.Managers;
using Shogi.Api.Repositories;
using System.Net;
using System.Net.WebSockets;
using System.Text.Json;
namespace Shogi.Api.Services
{
@@ -59,7 +58,7 @@ namespace Shogi.Api.Services
var message = await socket.ReceiveTextAsync();
if (string.IsNullOrWhiteSpace(message)) continue;
logger.LogInformation("Request \n{0}\n", message);
var request = JsonConvert.DeserializeObject<ISocketRequest>(message);
var request = JsonSerializer.Deserialize<ISocketRequest>(message);
if (request == null || !Enum.IsDefined(typeof(SocketAction), request.Action))
{
await socket.SendTextAsync("Error: Action not recognized.");