17 lines
555 B
C#
17 lines
555 B
C#
|
using System.Text.Json;
|
||
|
using System.Text.Json.Serialization;
|
||
|
|
||
|
namespace MultiversalDiplomacy.Model;
|
||
|
|
||
|
/// <summary>
|
||
|
/// Serializes a <see cref="Season"/> as its combined designation.
|
||
|
/// </summary>
|
||
|
internal class SeasonJsonConverter : JsonConverter<Season>
|
||
|
{
|
||
|
public override Season Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
|
||
|
=> new(reader.GetString()!);
|
||
|
|
||
|
public override void Write(Utf8JsonWriter writer, Season value, JsonSerializerOptions options)
|
||
|
=> writer.WriteStringValue(value.Key);
|
||
|
}
|