Apply code formatting cleanup across monitor projects
- Reindent appsettings.json and the MSBuild project files - Collapse single-statement guard blocks and tidy using and member order - Normalize XML doc indentation and file endings - Reorder BatteryMonitor test-data helpers and move the exclusion tests into their own region - Carry the same formatting through the boiler config, control, entity and test files
This commit is contained in:
@@ -40,31 +40,23 @@ public readonly struct CompactNordPoolDayPrice
|
||||
|
||||
internal sealed class CompactNordPoolDayPriceConverter : JsonConverter<CompactNordPoolDayPrice>
|
||||
{
|
||||
public override CompactNordPoolDayPrice Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
|
||||
public override CompactNordPoolDayPrice Read(ref Utf8JsonReader reader, Type typeToConvert,
|
||||
JsonSerializerOptions options)
|
||||
{
|
||||
if (reader.TokenType != JsonTokenType.StartArray)
|
||||
{
|
||||
throw new JsonException("Expected start of array.");
|
||||
}
|
||||
if (reader.TokenType != JsonTokenType.StartArray) throw new JsonException("Expected start of array.");
|
||||
|
||||
if (!reader.Read() || reader.TokenType != JsonTokenType.Number)
|
||||
{
|
||||
throw new JsonException("Expected number for Start at position 0.");
|
||||
}
|
||||
|
||||
var start = reader.GetInt64();
|
||||
|
||||
if (!reader.Read() || reader.TokenType != JsonTokenType.Number)
|
||||
{
|
||||
throw new JsonException("Expected number for End at position 1.");
|
||||
}
|
||||
|
||||
var end = reader.GetInt64();
|
||||
|
||||
if (!reader.Read() || (reader.TokenType != JsonTokenType.Number && reader.TokenType != JsonTokenType.Null))
|
||||
{
|
||||
throw new JsonException("Expected number or null for Price at position 2.");
|
||||
}
|
||||
|
||||
double? price = reader.TokenType == JsonTokenType.Null ? null : reader.GetDouble();
|
||||
|
||||
@@ -82,14 +74,10 @@ internal sealed class CompactNordPoolDayPriceConverter : JsonConverter<CompactNo
|
||||
writer.WriteNumberValue(value.End);
|
||||
|
||||
if (value.Price.HasValue)
|
||||
{
|
||||
writer.WriteNumberValue(value.Price.Value);
|
||||
}
|
||||
else
|
||||
{
|
||||
writer.WriteNullValue();
|
||||
}
|
||||
|
||||
writer.WriteEndArray();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user