Complete
This commit is contained in:
82
Adaptation/FileHandlers/RsM/Point.cs
Normal file
82
Adaptation/FileHandlers/RsM/Point.cs
Normal file
@ -0,0 +1,82 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace Adaptation.FileHandlers.RsM;
|
||||
|
||||
internal record Point
|
||||
{
|
||||
|
||||
[JsonConstructor]
|
||||
public Point(string r, string th, string data, string rs, string rsA, string rsB, string numberSample, string x, string y, string irng, string vrng, string chiSq, string meritGOF, string dataIntegrity)
|
||||
{
|
||||
R = r;
|
||||
Th = th;
|
||||
Data = data;
|
||||
Rs = rs;
|
||||
RsA = rsA;
|
||||
RsB = rsB;
|
||||
NumberSample = numberSample;
|
||||
X = x;
|
||||
Y = y;
|
||||
Irng = irng;
|
||||
Vrng = vrng;
|
||||
ChiSq = chiSq;
|
||||
MeritGOF = meritGOF;
|
||||
DataIntegrity = dataIntegrity;
|
||||
}
|
||||
|
||||
[JsonPropertyName("R")] public string R { get; }
|
||||
[JsonPropertyName("Th")] public string Th { get; }
|
||||
[JsonPropertyName("Data")] public string Data { get; }
|
||||
[JsonPropertyName("Rs")] public string Rs { get; }
|
||||
[JsonPropertyName("RsA")] public string RsA { get; }
|
||||
[JsonPropertyName("RsB")] public string RsB { get; }
|
||||
[JsonPropertyName("#Smpl")] public string NumberSample { get; }
|
||||
[JsonPropertyName("x")] public string X { get; }
|
||||
[JsonPropertyName("y")] public string Y { get; }
|
||||
[JsonPropertyName("Irng")] public string Irng { get; }
|
||||
[JsonPropertyName("Vrng")] public string Vrng { get; }
|
||||
[JsonPropertyName("ChiSq")] public string ChiSq { get; }
|
||||
[JsonPropertyName("merit/GOF")] public string MeritGOF { get; }
|
||||
[JsonPropertyName("DataIntegrity")] public string DataIntegrity { get; }
|
||||
|
||||
internal static ReadOnlyCollection<Point> Get(int take, ReadOnlyCollection<string> lines, string[] separator)
|
||||
{
|
||||
List<Point> results = new();
|
||||
Point point;
|
||||
string[] segments;
|
||||
ReadOnlyCollection<string> collection;
|
||||
for (int i = take - 1; i < lines.Count; i++)
|
||||
{
|
||||
if (string.IsNullOrEmpty(lines[i]))
|
||||
break;
|
||||
segments = lines[i].Split(separator, StringSplitOptions.RemoveEmptyEntries);
|
||||
collection = Complete.GetCollection(segments);
|
||||
point = new(collection.Count < 1 ? string.Empty : collection[0],
|
||||
collection.Count < 2 ? string.Empty : collection[1],
|
||||
collection.Count < 3 ? string.Empty : collection[2],
|
||||
collection.Count < 4 ? string.Empty : collection[3],
|
||||
collection.Count < 5 ? string.Empty : collection[4],
|
||||
collection.Count < 6 ? string.Empty : collection[5],
|
||||
collection.Count < 7 ? string.Empty : collection[6],
|
||||
collection.Count < 8 ? string.Empty : collection[7],
|
||||
collection.Count < 9 ? string.Empty : collection[8],
|
||||
collection.Count < 10 ? string.Empty : collection[9],
|
||||
collection.Count < 11 ? string.Empty : collection[10],
|
||||
collection.Count < 12 ? string.Empty : collection[11],
|
||||
collection.Count < 13 ? string.Empty : collection[12],
|
||||
collection.Count < 14 ? string.Empty : collection[13]);
|
||||
results.Add(point);
|
||||
}
|
||||
return new(results);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
[JsonSourceGenerationOptions(WriteIndented = true)]
|
||||
[JsonSerializable(typeof(Point))]
|
||||
internal partial class PointSourceGenerationContext : JsonSerializerContext
|
||||
{
|
||||
}
|
Reference in New Issue
Block a user