Class ProtocolVersionJsonConverter
Namespace: Void.Minecraft.Serializers
Assembly: Void.Minecraft.dll
Converts protocol versions to and from their numeric Minecraft protocol identifiers in JSON.
public sealed class ProtocolVersionJsonConverter : JsonConverter<ProtocolVersion>Inheritance
object ← JsonConverter ← JsonConverter<ProtocolVersion> ← ProtocolVersionJsonConverter
Inherited Members
JsonConverter<ProtocolVersion>.CanConvert(Type), JsonConverter<ProtocolVersion>.Read(ref Utf8JsonReader, Type, JsonSerializerOptions), JsonConverter<ProtocolVersion>.ReadAsPropertyName(ref Utf8JsonReader, Type, JsonSerializerOptions), JsonConverter<ProtocolVersion>.Write(Utf8JsonWriter, ProtocolVersion, JsonSerializerOptions), JsonConverter<ProtocolVersion>.WriteAsPropertyName(Utf8JsonWriter, ProtocolVersion, JsonSerializerOptions), JsonConverter<ProtocolVersion>.HandleNull, JsonConverter<ProtocolVersion>.Type, JsonConverter.CanConvert(Type), JsonConverter.Type, object.Equals(object?), object.Equals(object?, object?), object.GetHashCode(), object.GetType(), object.ReferenceEquals(object?, object?), object.ToString()
Methods
Read(ref Utf8JsonReader, Type, JsonSerializerOptions)
Reads a protocol version from the current JSON number token.
public override ProtocolVersion Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)Parameters
reader Utf8JsonReader
The JSON reader positioned at a numeric protocol identifier.
typeToConvert Type
The target type requested by the serializer.
options JsonSerializerOptions
The active serializer options.
Returns
The known protocol version matching the identifier, or a dynamically created unknown version.
Write(Utf8JsonWriter, ProtocolVersion, JsonSerializerOptions)
Writes the numeric identifier of a protocol version as a JSON number.
public override void Write(Utf8JsonWriter writer, ProtocolVersion value, JsonSerializerOptions options)Parameters
writer Utf8JsonWriter
The destination JSON writer.
value ProtocolVersion
The protocol version to write.
options JsonSerializerOptions
The active serializer options.