Complete
This commit is contained in:
47
Adaptation/FileHandlers/RsM/Line4B.cs
Normal file
47
Adaptation/FileHandlers/RsM/Line4B.cs
Normal 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
|
||||
{
|
||||
}
|
Reference in New Issue
Block a user