first commit
This commit is contained in:
19
NitroxServer/Serialization/Json/NitroxIdConverter.cs
Normal file
19
NitroxServer/Serialization/Json/NitroxIdConverter.cs
Normal file
@@ -0,0 +1,19 @@
|
||||
using System;
|
||||
using Newtonsoft.Json;
|
||||
using NitroxModel.DataStructures;
|
||||
|
||||
namespace NitroxServer.Serialization.Json
|
||||
{
|
||||
public class NitroxIdConverter : JsonConverter<NitroxId>
|
||||
{
|
||||
public override void WriteJson(JsonWriter writer, NitroxId value, JsonSerializer serializer)
|
||||
{
|
||||
writer.WriteValue(value.ToString());
|
||||
}
|
||||
|
||||
public override NitroxId ReadJson(JsonReader reader, Type objectType, NitroxId existingValue, bool hasExistingValue, JsonSerializer serializer)
|
||||
{
|
||||
return reader.Value == null ? null : new NitroxId((string)reader.Value);
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user