Apply code formatting cleanup across the monitor projects

- Wrap using directives in `#region` blocks across the Battery, Boiler and NordPool sources and tests
- Expand single-statement guards and loops into braced blocks
- Realign wrapped method arguments, chained calls and continuations
- Replace target-typed `new()` with explicit generic construction and empty string literals with `string.Empty`
- Flatten the boiler config expression and reindent the remaining touched files
This commit is contained in:
2026-12-01 12:33:31 +02:00
parent 77458383d1
commit f919d6b25b
115 changed files with 3115 additions and 1959 deletions
+19 -11
View File
@@ -1,6 +1,10 @@
#region
using System.Text.Json;
using System.Text.Json.Serialization;
#endregion
namespace NordPool.Models;
[JsonConverter(typeof(CompactNordPoolDayPriceConverter))]
@@ -19,11 +23,11 @@ public readonly struct CompactNordPoolDayPrice
return new CompactNordPoolDayPrice
{
Start = dayPrice.Start.HasValue
? ToUnixSeconds(dayPrice.Start.Value)
: NullTimestampSentinel,
? ToUnixSeconds(dayPrice.Start.Value)
: NullTimestampSentinel,
End = dayPrice.End.HasValue
? ToUnixSeconds(dayPrice.End.Value)
: NullTimestampSentinel,
? ToUnixSeconds(dayPrice.End.Value)
: NullTimestampSentinel,
Price = dayPrice.Price
};
}
@@ -31,8 +35,8 @@ public readonly struct CompactNordPoolDayPrice
private static long ToUnixSeconds(DateTime dateTime)
{
var utc = dateTime.Kind == DateTimeKind.Utc
? dateTime
: dateTime.ToUniversalTime();
? dateTime
: dateTime.ToUniversalTime();
return new DateTimeOffset(utc, TimeSpan.Zero).ToUnixTimeSeconds();
}
@@ -40,10 +44,14 @@ 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)
{
@@ -69,8 +77,8 @@ internal sealed class CompactNordPoolDayPriceConverter : JsonConverter<CompactNo
reader.Read();
return reader.TokenType == JsonTokenType.EndArray
? new CompactNordPoolDayPrice { Start = start, End = end, Price = price }
: throw new JsonException("Expected end of array.");
? new CompactNordPoolDayPrice { Start = start, End = end, Price = price }
: throw new JsonException("Expected end of array.");
}
public override void Write(Utf8JsonWriter writer, CompactNordPoolDayPrice value, JsonSerializerOptions options)