use the premade json for TaskData

This commit is contained in:
Master 2023-10-11 22:44:58 +02:00
parent 1930b527db
commit c09b6daadc
2 changed files with 12 additions and 16 deletions

View File

@ -199,11 +199,11 @@ namespace AscNet.GameServer.Handlers
}; };
session.SendPush(notifySocialData); session.SendPush(notifySocialData);
// NotifyTaskData notifyTaskData = JsonConvert.DeserializeObject<NotifyTaskData>(File.ReadAllText("Data/NotifyTaskData.json"))!; NotifyTaskData notifyTaskData = JsonConvert.DeserializeObject<NotifyTaskData>(File.ReadAllText("Data/NotifyTaskData.json"))!;
NotifyTaskData notifyTaskData = new() //NotifyTaskData notifyTaskData = new()
{ //{
TaskData = { } // TaskData = { }
}; //};
session.SendPush(notifyTaskData); session.SendPush(notifyTaskData);
NotifyActivenessStatus notifyActivenessStatus = new() NotifyActivenessStatus notifyActivenessStatus = new()

View File

@ -1,10 +1,6 @@
using AscNet.Common.MsgPack; using AscNet.Common.MsgPack;
using System.Text.Json;
using Newtonsoft.Json; using Newtonsoft.Json;
using System.Reflection; using System.Reflection;
using AscNet.GameServer;
using MessagePack;
using static AscNet.GameServer.Packet;
namespace AscNet.Test namespace AscNet.Test
{ {
@ -12,14 +8,14 @@ namespace AscNet.Test
{ {
static void Main(string[] args) static void Main(string[] args)
{ {
string lines = File.ReadAllText("Data/NotifyLogin.json"); try
NotifyLogin notifyLogin = System.Text.Json.JsonSerializer.Deserialize<NotifyLogin>(lines)!;
NotifyLogin notifyLoginNew = JsonConvert.DeserializeObject<NotifyLogin>(lines)!;
foreach (PropertyCompareResult resultItem in Compare(notifyLogin, notifyLoginNew))
{ {
Console.WriteLine(" Property name: {0} -- old: {1}, new: {2}", NotifyLogin notifyLoginNew = JsonConvert.DeserializeObject<NotifyLogin>(File.ReadAllText("Data/NotifyLogin.json"))!;
resultItem.Name, resultItem.OldValue ?? "<null>", resultItem.NewValue ?? "<null>"); NotifyTaskData notifyTaskData = JsonConvert.DeserializeObject<NotifyTaskData>(File.ReadAllText("Data/NotifyTaskData.json"))!;
}
catch (Exception ex)
{
Console.WriteLine(ex.ToString());
} }
} }