59 lines
1.5 KiB
C#
59 lines
1.5 KiB
C#
using System.Collections.ObjectModel;
|
|
using System.Linq;
|
|
using System.Text.Json.Serialization;
|
|
|
|
namespace Adaptation.FileHandlers.Stratus;
|
|
|
|
#nullable enable
|
|
|
|
internal class Complete
|
|
{
|
|
|
|
public Complete(Header header, Wafer[] wafers, Footer footer)
|
|
{
|
|
Header = header;
|
|
Wafers = wafers;
|
|
Footer = footer;
|
|
}
|
|
|
|
public Header Header { get; }
|
|
public Wafer[] Wafers { get; }
|
|
public Footer Footer { get; }
|
|
|
|
internal static Complete? Get(string text, Constant constant)
|
|
{
|
|
Complete? result;
|
|
int[] i = new int[] { 0 };
|
|
Header? header = Header.Get(text, constant, i);
|
|
if (header is null)
|
|
result = null;
|
|
else
|
|
{
|
|
ReadOnlyCollection<string> groups = Wafer.GetGroups(text, constant, i);
|
|
if (groups.Count == 0)
|
|
result = null;
|
|
else
|
|
{
|
|
ReadOnlyCollection<Wafer> wafers = Wafer.Get(constant, groups);
|
|
if (wafers.Count == 0)
|
|
result = null;
|
|
else
|
|
{
|
|
Footer? footer = Footer.Get(constant, groups);
|
|
if (footer is null)
|
|
result = null;
|
|
else
|
|
result = new(header, wafers.ToArray(), footer);
|
|
}
|
|
}
|
|
}
|
|
return result;
|
|
}
|
|
|
|
}
|
|
|
|
[JsonSourceGenerationOptions(WriteIndented = true)]
|
|
[JsonSerializable(typeof(Complete))]
|
|
internal partial class CompleteSourceGenerationContext : JsonSerializerContext
|
|
{
|
|
} |