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
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
readerUtf8JsonReaderThe reader.
typeToConvertTypeThe type to convert.
optionsJsonSerializerOptionsAn 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
configTypeType
Write(Utf8JsonWriter, ILoggerConfig, JsonSerializerOptions)
Writes a specified value as JSON.
public override void Write(Utf8JsonWriter writer, ILoggerConfig value, JsonSerializerOptions options)
Parameters
writerUtf8JsonWriterThe writer to write to.
valueILoggerConfigThe value to convert to JSON.
optionsJsonSerializerOptionsAn object that specifies serialization options to use.