Refactor QS408M and PDSF File Handlers
- Updated Detail class to include JsonSourceGenerationOptions and JsonSerializable attributes for source generation. - Modified ProcessData class to utilize source generation context for Description deserialization. - Renamed RowSourceGenerationContext to QS408MRowSourceGenerationContext for clarity. - Updated Run class to use QS408MRunSourceGenerationContext for serialization. - Enhanced Description class with source generation attributes. - Refactored FileRead class to use source generation context for Description deserialization. - Added new methods in ProcessDataStandardFormat for JSON element array extraction. - Introduced new PDSF file handler classes: Body, Constant, FileRead, Footer, Header, Row, Run, and Site. - Implemented logic for parsing and handling PDSF data structures. - Added unit tests for PDSF processing to ensure functionality.
This commit is contained in:
36
Adaptation/FileHandlers/pdsf/Site.cs
Normal file
36
Adaptation/FileHandlers/pdsf/Site.cs
Normal file
@ -0,0 +1,36 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
|
||||
namespace Adaptation.FileHandlers.pdsf;
|
||||
|
||||
public class Site
|
||||
{
|
||||
|
||||
public Site(string position, string thickness)
|
||||
{
|
||||
Position = position;
|
||||
Thickness = thickness;
|
||||
}
|
||||
|
||||
public string Position { get; }
|
||||
public string Thickness { get; }
|
||||
|
||||
internal static ReadOnlyCollection<Site> Get(string text, int[] i)
|
||||
{
|
||||
List<Site> results = new();
|
||||
Site site;
|
||||
string thickness;
|
||||
string position = Body.GetToken(text, i);
|
||||
while (true)
|
||||
{
|
||||
if (string.IsNullOrEmpty(position) || !char.IsDigit(position[0]))
|
||||
break;
|
||||
thickness = Body.GetToken(text, i);
|
||||
site = new(position, thickness);
|
||||
results.Add(site);
|
||||
position = Body.GetToken(text, i);
|
||||
}
|
||||
return results.AsReadOnly();
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user