47 lines
1.3 KiB
C#
47 lines
1.3 KiB
C#
using System;
|
|
using System.Text.Json.Serialization;
|
|
|
|
namespace Adaptation.FileHandlers.RsM;
|
|
|
|
#nullable enable
|
|
|
|
internal record Line4B
|
|
{
|
|
|
|
[JsonConstructor]
|
|
public Line4B(string avg, string dev, string min, string max)
|
|
{
|
|
Avg = avg;
|
|
Dev = dev;
|
|
Min = min;
|
|
Max = max;
|
|
}
|
|
|
|
[JsonPropertyName("Avg")] public string Avg { get; }
|
|
[JsonPropertyName("Dev")] public string Dev { get; }
|
|
[JsonPropertyName("Min")] public string Min { get; }
|
|
[JsonPropertyName("Max")] public string Max { get; }
|
|
|
|
internal static Line4B? Get(string[] segments)
|
|
{
|
|
Line4B? result;
|
|
if (segments.Length < 2)
|
|
result = null;
|
|
else
|
|
{
|
|
string[] segmentsB = segments[1].Split(new string[] { " " }, StringSplitOptions.RemoveEmptyEntries);
|
|
result = new(segmentsB.Length < 2 ? string.Empty : segmentsB[1],
|
|
segmentsB.Length < 4 ? string.Empty : segmentsB[3],
|
|
segmentsB.Length < 6 ? string.Empty : segmentsB[5],
|
|
segmentsB.Length < 8 ? string.Empty : segmentsB[7]);
|
|
}
|
|
return result;
|
|
}
|
|
|
|
}
|
|
|
|
[JsonSourceGenerationOptions(WriteIndented = true)]
|
|
[JsonSerializable(typeof(Line4B))]
|
|
internal partial class Line4BSourceGenerationContext : JsonSerializerContext
|
|
{
|
|
} |