This commit is contained in:
2024-11-01 17:05:13 -07:00
parent c7dc1928f4
commit 2c4e45486c
24 changed files with 881 additions and 28 deletions

View File

@ -0,0 +1,47 @@
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
{
}