Table of Contents

Class ILoggerConfigConverter

Namespace
FishMMO.Logging
Assembly
FishMMO-Logger.dll

Custom JsonConverter for ILoggerConfig to handle polymorphic deserialization. It relies on external registration of concrete ILoggerConfig types, removing the need for internal reflection.

public class ILoggerConfigConverter : JsonConverter<ILoggerConfig>
Inheritance
ILoggerConfigConverter
Inherited Members

Methods

GetAllRegisteredConfigTypes()

Returns a read-only dictionary of all currently registered ILoggerConfig types.

public static IReadOnlyDictionary<string, Type> GetAllRegisteredConfigTypes()

Returns

IReadOnlyDictionary<string, Type>

Read(ref Utf8JsonReader, Type, JsonSerializerOptions)

Reads and converts the JSON to type ILoggerConfig.

public override ILoggerConfig Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)

Parameters

reader Utf8JsonReader

The reader.

typeToConvert Type

The type to convert.

options JsonSerializerOptions

An object that specifies serialization options to use.

Returns

ILoggerConfig

The converted value.

RegisterConfigType(Type)

Registers a concrete ILoggerConfig type with the converter.

public static void RegisterConfigType(Type configType)

Parameters

configType Type

Write(Utf8JsonWriter, ILoggerConfig, JsonSerializerOptions)

Writes a specified value as JSON.

public override void Write(Utf8JsonWriter writer, ILoggerConfig value, JsonSerializerOptions options)

Parameters

writer Utf8JsonWriter

The writer to write to.

value ILoggerConfig

The value to convert to JSON.

options JsonSerializerOptions

An object that specifies serialization options to use.