@@ -63,7 +63,9 @@ public class Telegram(string? identification, IEnumerable<(OBISId obisid, IEnume
6363 /// <summary>Number of long power failures in any phase.</summary>
6464 public int ? ElectricityLongFailures => ParseInt ( OBISRegistry . ElectricityLongFailures ) ;
6565 /// <summary>Power Failure Event Log.</summary>
66- public IEnumerable < TimeStampedValue < TimeSpan > > ElectricityFailureLog => ParseTimeStampedValues ( OBISRegistry . ElectricityFailureLog , ( d , v ) => TimeSpan . FromSeconds ( ParseLongUnit ( d , v ) ? . Value ?? 0 ) , 2 ) ;
66+ public IEnumerable < TimeStampedValue < TimeSpan > > ElectricityFailureLog
67+ => ParseTimeStampedValues ( OBISRegistry . ElectricityFailureLog , ( d , v ) => TimeSpan . FromSeconds ( ParseLongUnit ( d , v ) ? . Value ?? 0 ) , 2 ) ;
68+
6769 /// <summary>Number of voltage sags in phase L1.</summary>
6870 public int ? ElectricitySagsL1 => ParseInt ( OBISRegistry . ElectricitySagsL1 ) ;
6971 /// <summary>Number of voltage sags in phase L2.</summary>
@@ -213,7 +215,8 @@ protected static bool TryParseDateTimeOffsetCore(string? value, out DateTimeOffs
213215 /// <paramref name="result"/> contains a valid <see cref="byte"/> or null when the method returns false.
214216 /// </param>
215217 /// <returns>True if the parse operation was successful; otherwise, false.</returns>
216- protected static bool TryParseHexByteCore ( string ? value , out byte result ) => byte . TryParse ( value , NumberStyles . HexNumber , _culture , out result ) ;
218+ protected static bool TryParseHexByteCore ( string ? value , out byte result )
219+ => byte . TryParse ( value , NumberStyles . HexNumber , _culture , out result ) ;
217220
218221 /// <summary>
219222 /// Attempts to parse an integer value.
@@ -224,7 +227,8 @@ protected static bool TryParseDateTimeOffsetCore(string? value, out DateTimeOffs
224227 /// <paramref name="result"/> contains a valid <see cref="int"/> or null when the method returns false.
225228 /// </param>
226229 /// <returns>True if the parse operation was successful; otherwise, false.</returns>
227- protected static bool TryParseIntCore ( string ? value , out int result ) => int . TryParse ( value , NumberStyles . Integer , _culture , out result ) ;
230+ protected static bool TryParseIntCore ( string ? value , out int result )
231+ => int . TryParse ( value , NumberStyles . Integer , _culture , out result ) ;
228232
229233 /// <summary>
230234 /// Attempts to parse a long value.
@@ -235,7 +239,8 @@ protected static bool TryParseDateTimeOffsetCore(string? value, out DateTimeOffs
235239 /// <paramref name="result"/> contains a valid <see cref="long"/> or null when the method returns false.
236240 /// </param>
237241 /// <returns>True if the parse operation was successful; otherwise, false.</returns>
238- protected static bool TryParseLongCore ( string ? value , out long result ) => long . TryParse ( value , NumberStyles . Integer , _culture , out result ) ;
242+ protected static bool TryParseLongCore ( string ? value , out long result )
243+ => long . TryParse ( value , NumberStyles . Integer , _culture , out result ) ;
239244
240245 /// <summary>
241246 /// Attempts to parse a decimal value.
@@ -246,7 +251,8 @@ protected static bool TryParseDateTimeOffsetCore(string? value, out DateTimeOffs
246251 /// <paramref name="result"/> contains a valid <see cref="decimal"/> or null when the method returns false.
247252 /// </param>
248253 /// <returns>True if the parse operation was successful; otherwise, false.</returns>
249- protected static bool TryParseDecimalCore ( string ? value , out decimal result ) => decimal . TryParse ( value , NumberStyles . AllowDecimalPoint , _culture , out result ) ;
254+ protected static bool TryParseDecimalCore ( string ? value , out decimal result )
255+ => decimal . TryParse ( value , NumberStyles . AllowDecimalPoint , _culture , out result ) ;
250256
251257 /// <summary>
252258 /// Attempts to parse an enum value.
@@ -258,7 +264,8 @@ protected static bool TryParseDateTimeOffsetCore(string? value, out DateTimeOffs
258264 /// <paramref name="result"/> contains a valid enum value or null when the method returns false.
259265 /// </param>
260266 /// <returns>True if the parse operation was successful; otherwise, false.</returns>
261- protected static bool TryParseEnumCore < T > ( string ? value , out T result ) where T : struct => Enum . TryParse < T > ( value , out result ) ;
267+ protected static bool TryParseEnumCore < T > ( string ? value , out T result )
268+ where T : struct => Enum . TryParse < T > ( value , out result ) ;
262269
263270 /// <summary>
264271 /// Parses a timestamp in yyMMddHHmmss to a <see cref="DateTimeOffset"/>.
@@ -329,7 +336,8 @@ protected static bool TryParseDateTimeOffsetCore(string? value, out DateTimeOffs
329336 /// The <see cref="OBISDescriptor"/> specifying the value to find in the telegram and parse as <see cref="UnitValue{T}"/>
330337 /// </param>
331338 /// <returns>Returns a <see cref="UnitValue{T}"/> when parsing the given <paramref name="descriptor"/> succeeded, null otherwise.</returns>
332- protected UnitValue < int > ? ParseIntUnit ( OBISDescriptor descriptor ) => ParseIntUnit ( descriptor , GetByDescriptor ( descriptor ) ) ;
339+ protected UnitValue < int > ? ParseIntUnit ( OBISDescriptor descriptor )
340+ => ParseIntUnit ( descriptor , GetByDescriptor ( descriptor ) ) ;
333341 /// <summary>
334342 /// Attempts to parse a given value with unit from a given <see cref="OBISDescriptor"/>.
335343 /// </summary>
@@ -406,7 +414,8 @@ protected static bool TryParseDateTimeOffsetCore(string? value, out DateTimeOffs
406414 /// <param name="expected">The expected <see cref="OBISUnit"/> the value should represent.</param>
407415 /// <param name="actual">The actual unit the value represents.</param>
408416 /// <returns>True when the given string matches the given <see cref="OBISUnit"/>, false otherwise.</returns>
409- protected static bool IsCorrectUnit ( OBISUnit expected , string ? actual ) => TryParseEnumCore < OBISUnit > ( actual , out var result ) && expected == result ;
417+ protected static bool IsCorrectUnit ( OBISUnit expected , string ? actual )
418+ => TryParseEnumCore < OBISUnit > ( actual , out var result ) && expected == result ;
410419
411420 /// <summary>
412421 /// Parses values in (date)(value)(date)(value)... format to an <see cref="TimeStampedValue{T}"/> enumerable.
@@ -462,7 +471,9 @@ protected static (string? value, string? unit) SplitValues(string? value, char u
462471 /// </summary>
463472 /// <param name="value">The "hex byte format string".</param>
464473 /// <returns>The string the "hex byte string" represents.</returns>
465- protected static string ? DecodeString ( string ? value ) => ( ! string . IsNullOrEmpty ( value ) && value . Length % 2 == 0 ) ? Encoding . ASCII . GetString ( [ .. DecodeHexString ( value ) ] ) : value ;
474+ protected static string ? DecodeString ( string ? value )
475+ => ( ! string . IsNullOrEmpty ( value ) && value . Length % 2 == 0 ) ? Encoding . ASCII . GetString ( [ .. DecodeHexString ( value ) ] ) : value ;
476+
466477 /// <summary>
467478 /// Decodes a string in "hex byte format" to it's byte values.
468479 /// </summary>
0 commit comments