// 大名科技(天津)有限公司版权所有 电话:18020030720 QQ:515096995
//
// 此源代码遵循位于源代码树根目录中的 LICENSE 文件的许可证
using System.Text.Json;
using System.Text.Json.Serialization;
namespace Admin.NET.Core;
///
/// 字符串掩码
///
[SuppressSniffer]
public class MaskSystemTextJsonConverter : JsonConverter
{
public override string Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
return reader.GetString();
}
public override void Write(Utf8JsonWriter writer, string value, JsonSerializerOptions options)
{
writer.WriteStringValue(value?.ToString().Mask());
}
}
///
/// 身份证掩码
///
[SuppressSniffer]
public class MaskIdCardSystemTextJsonConverter : JsonConverter
{
public override string Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
return reader.GetString();
}
public override void Write(Utf8JsonWriter writer, string value, JsonSerializerOptions options)
{
writer.WriteStringValue(value?.ToString().MaskIdCard());
}
}
///
/// 邮箱掩码
///
[SuppressSniffer]
public class MaskEmailSystemTextJsonConverter : JsonConverter
{
public override string Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
return reader.GetString();
}
public override void Write(Utf8JsonWriter writer, string value, JsonSerializerOptions options)
{
writer.WriteStringValue(value?.ToString().MaskEmail());
}
}
///
/// 银行卡号掩码
///
[SuppressSniffer]
public class MaskBankCardSystemTextJsonConverter : JsonConverter
{
public override string Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
return reader.GetString();
}
public override void Write(Utf8JsonWriter writer, string value, JsonSerializerOptions options)
{
writer.WriteStringValue(value?.ToString().MaskBankCard());
}
}