mirror of
https://github.com/JKorf/CryptoExchange.Net
synced 2025-06-07 16:06:15 +00:00
Made ReplaceConverter abstract as it needs to be implemented in client libs, removed unsupported JsonConverterCtor attribute
This commit is contained in:
parent
142cba5cca
commit
a0e2f78a6a
@ -1,31 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Text.Json.Serialization;
|
|
||||||
|
|
||||||
namespace CryptoExchange.Net.Converters.SystemTextJson
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Attribute for allowing specifying a JsonConverter with constructor parameters
|
|
||||||
/// </summary>
|
|
||||||
[AttributeUsage(AttributeTargets.Property)]
|
|
||||||
public class JsonConverterCtorAttribute : JsonConverterAttribute
|
|
||||||
{
|
|
||||||
private readonly object[] _parameters;
|
|
||||||
private readonly Type _type;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// ctor
|
|
||||||
/// </summary>
|
|
||||||
public JsonConverterCtorAttribute(Type type, params object[] parameters)
|
|
||||||
{
|
|
||||||
_type = type;
|
|
||||||
_parameters = parameters;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <inheritdoc />
|
|
||||||
public override JsonConverter CreateConverter(Type typeToConvert)
|
|
||||||
{
|
|
||||||
return (JsonConverter)Activator.CreateInstance(_type, _parameters)!;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -8,7 +8,7 @@ namespace CryptoExchange.Net.Converters.SystemTextJson
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Replace a value on a string property
|
/// Replace a value on a string property
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class ReplaceConverter : JsonConverter<string>
|
public abstract class ReplaceConverter : JsonConverter<string>
|
||||||
{
|
{
|
||||||
private readonly (string ValueToReplace, string ValueToReplaceWith)[] _replacementSets;
|
private readonly (string ValueToReplace, string ValueToReplaceWith)[] _replacementSets;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user