forked from ddrilling/AsbCloudServer
fix JsonValue
This commit is contained in:
parent
1202bf024e
commit
33ebaf39c1
@ -30,37 +30,37 @@ namespace AsbCloudWebApi.Converters
|
||||
|
||||
public override void Write(Utf8JsonWriter writer, JsonValue value, JsonSerializerOptions options)
|
||||
{
|
||||
if (value.Value is string strValue)
|
||||
if (value.value is string strValue)
|
||||
{
|
||||
writer.WriteStringValue(FormatString(strValue));
|
||||
return;
|
||||
}
|
||||
|
||||
if (value.Value is int intValue)
|
||||
if (value.value is int intValue)
|
||||
{
|
||||
writer.WriteNumberValue(intValue);
|
||||
return;
|
||||
}
|
||||
|
||||
if (value.Value is short shortValue)
|
||||
if (value.value is short shortValue)
|
||||
{
|
||||
writer.WriteNumberValue(shortValue);
|
||||
return;
|
||||
}
|
||||
|
||||
if (value.Value is float floatValue)
|
||||
if (value.value is float floatValue)
|
||||
{
|
||||
writer.WriteRawValue(floatValue.ToString("#0.0##", CultureInfo.InvariantCulture), true);
|
||||
return;
|
||||
}
|
||||
|
||||
if (value.Value is double doubleValue)
|
||||
if (value.value is double doubleValue)
|
||||
{
|
||||
writer.WriteRawValue(doubleValue.ToString("#0.0##", CultureInfo.InvariantCulture), true);
|
||||
return;
|
||||
}
|
||||
|
||||
var typeName = value.Value.GetType().Name;
|
||||
var typeName = value.value.GetType().Name;
|
||||
throw new NotImplementedException($"{typeName} is not supported type for WITS value");
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user