Spreading Resistance Profile with ChartJS,
Copy-On-Get and nuget bump (Serilog)
This commit is contained in:
300
Server/Services/SpreadingResistanceProfileService.cs
Normal file
300
Server/Services/SpreadingResistanceProfileService.cs
Normal file
@ -0,0 +1,300 @@
|
||||
using Adaptation.FileHandlers.json;
|
||||
using OI.Metrology.Shared.Models.Stateless;
|
||||
using System.Drawing;
|
||||
using System.Text;
|
||||
using System.Text.Json;
|
||||
|
||||
namespace OI.Metrology.Server.Services;
|
||||
|
||||
public class SpreadingResistanceProfileService : ISpreadingResistanceProfileService
|
||||
{
|
||||
|
||||
#pragma warning disable CA1416
|
||||
|
||||
private static RectangleF GetRectangleF(double left, double top, double width, double height) =>
|
||||
new((float)left, (float)top, (float)width, (float)height);
|
||||
|
||||
private static void DrawLine(Graphics graphics, Pen pen, double x1, double y1, double x2, double y2) =>
|
||||
graphics.DrawLine(pen, (float)x1, (float)y1, (float)x2, (float)y2);
|
||||
|
||||
private static void DrawString(Graphics graphics, string s, Font font, Brush brush, double x, double y) =>
|
||||
graphics.DrawString(s, font, brush, (float)x, (float)y);
|
||||
|
||||
private static void FillEllipse(Graphics graphics, Brush brush, double x, double y, double width, double height) =>
|
||||
graphics.FillEllipse(brush, (float)x, (float)y, (float)width, (float)height);
|
||||
|
||||
private static void DrawString(Graphics graphics, string s, Font font, Brush brush, double x, double y, StringFormat stringFormat) =>
|
||||
graphics.DrawString(s, font, brush, (float)x, (float)y, stringFormat);
|
||||
|
||||
private static void GetMinMax(List<ProfilePoint> profilePoints, out double decades, out double maxDepth, out double concentrationMin, out double resistanceEditedMin, out double resistivityMin)
|
||||
{
|
||||
double ceilingCD;
|
||||
double ceilingEdited;
|
||||
maxDepth = int.MinValue;
|
||||
double ceilingResistivity;
|
||||
resistivityMin = double.MaxValue;
|
||||
concentrationMin = double.MaxValue;
|
||||
resistanceEditedMin = double.MaxValue;
|
||||
double resistivityMax = double.MinValue;
|
||||
double concentrationMax = double.MinValue;
|
||||
double resistanceEditedMax = double.MinValue;
|
||||
foreach (ProfilePoint profilePoint in profilePoints)
|
||||
{
|
||||
if (profilePoint.Log10?.ResistanceEdited is null || profilePoint.Log10?.Resistivity is null || profilePoint.Log10?.Concentration is null)
|
||||
continue;
|
||||
if (profilePoint.Depth <= 0 || profilePoint.ResistanceRaw == 0)
|
||||
continue;
|
||||
maxDepth = profilePoint.Depth;
|
||||
if (profilePoint.Log10.Resistivity.Value < resistivityMin)
|
||||
resistivityMin = profilePoint.Log10.Resistivity.Value;
|
||||
ceilingResistivity = Math.Ceiling(profilePoint.Log10.Resistivity.Value);
|
||||
if (ceilingResistivity > resistivityMax)
|
||||
resistivityMax = ceilingResistivity;
|
||||
if (profilePoint.Log10.ResistanceEdited.Value < resistanceEditedMin)
|
||||
resistanceEditedMin = profilePoint.Log10.ResistanceEdited.Value;
|
||||
ceilingEdited = Math.Ceiling(profilePoint.Log10.ResistanceEdited.Value);
|
||||
if (ceilingEdited > resistanceEditedMax)
|
||||
resistanceEditedMax = ceilingEdited;
|
||||
if (profilePoint.Log10.Concentration.Value < concentrationMin)
|
||||
concentrationMin = profilePoint.Log10.Concentration.Value;
|
||||
ceilingCD = Math.Ceiling(profilePoint.Log10.Concentration.Value);
|
||||
if (ceilingCD > concentrationMax)
|
||||
concentrationMax = ceilingCD;
|
||||
}
|
||||
decades = resistivityMax - resistivityMin;
|
||||
if (resistanceEditedMax - resistanceEditedMin > decades)
|
||||
decades = resistanceEditedMax - resistanceEditedMin;
|
||||
if (concentrationMax - concentrationMin > decades)
|
||||
decades = concentrationMax - concentrationMin;
|
||||
}
|
||||
|
||||
private static RectangleF[] GetRectangles(double leftChartArea, double widthChartArea, double topChartArea, double sizeOfBlock, double widthOfBlacks)
|
||||
{
|
||||
List<RectangleF> rectangles = new()
|
||||
{
|
||||
GetRectangleF(leftChartArea, 10, widthChartArea, 65),
|
||||
// GetRectangleF(leftChartArea + widthChartArea, topChartArea, widthOfBlacks, sizeOfBlock * 5);
|
||||
GetRectangleF(leftChartArea + widthChartArea, topChartArea + sizeOfBlock * 0, widthOfBlacks, sizeOfBlock),
|
||||
GetRectangleF(leftChartArea + widthChartArea, topChartArea + sizeOfBlock * 1, widthOfBlacks, sizeOfBlock),
|
||||
GetRectangleF(leftChartArea + widthChartArea, topChartArea + sizeOfBlock * 2, widthOfBlacks, sizeOfBlock),
|
||||
GetRectangleF(leftChartArea + widthChartArea, topChartArea + sizeOfBlock * 3, widthOfBlacks, sizeOfBlock),
|
||||
GetRectangleF(leftChartArea + widthChartArea, topChartArea + sizeOfBlock * 4, widthOfBlacks, sizeOfBlock),
|
||||
GetRectangleF(leftChartArea + widthChartArea, topChartArea + sizeOfBlock * 5, widthOfBlacks, sizeOfBlock),
|
||||
GetRectangleF(leftChartArea + widthChartArea, topChartArea + sizeOfBlock * 6, widthOfBlacks, sizeOfBlock),
|
||||
GetRectangleF(leftChartArea + widthChartArea, topChartArea + sizeOfBlock * 7, widthOfBlacks, sizeOfBlock),
|
||||
GetRectangleF(leftChartArea + widthChartArea, topChartArea + sizeOfBlock * 8, widthOfBlacks, sizeOfBlock),
|
||||
GetRectangleF(leftChartArea + widthChartArea, topChartArea + sizeOfBlock * 9, widthOfBlacks, sizeOfBlock),
|
||||
GetRectangleF(leftChartArea + widthChartArea, topChartArea + sizeOfBlock * 10, widthOfBlacks, sizeOfBlock),
|
||||
GetRectangleF(leftChartArea + widthChartArea, topChartArea + sizeOfBlock * 11, widthOfBlacks, sizeOfBlock),
|
||||
GetRectangleF(leftChartArea + widthChartArea, topChartArea + sizeOfBlock * 12, widthOfBlacks, sizeOfBlock),
|
||||
GetRectangleF(leftChartArea + widthChartArea, topChartArea + sizeOfBlock * 13, widthOfBlacks, sizeOfBlock),
|
||||
GetRectangleF(leftChartArea + widthChartArea, topChartArea + sizeOfBlock * 14, widthOfBlacks, sizeOfBlock),
|
||||
GetRectangleF(leftChartArea + widthChartArea, topChartArea + sizeOfBlock * 15, widthOfBlacks, sizeOfBlock),
|
||||
GetRectangleF(leftChartArea + widthChartArea, topChartArea + sizeOfBlock * 16, widthOfBlacks, sizeOfBlock * 2)
|
||||
};
|
||||
return rectangles.ToArray();
|
||||
}
|
||||
|
||||
private static string[] GetRectanglesDescriptions(Info info, Setup setup, List<Layer> layers)
|
||||
{
|
||||
List<string> results = new()
|
||||
{
|
||||
string.Empty, // 0
|
||||
string.Empty, // 1
|
||||
string.Empty, // 2
|
||||
string.Empty, // 3
|
||||
string.Empty, // 4
|
||||
string.Empty, // 5
|
||||
string.Empty, // 6
|
||||
string.Empty, // 7
|
||||
string.Empty, // 8
|
||||
string.Concat(info.SystemId, Environment.NewLine, info.SoftwareVersion), // 9
|
||||
string.Concat("SURFACE FINISH", Environment.NewLine, setup.Finish), // 10
|
||||
string.Concat("ORIENTATION", Environment.NewLine, setup.Orientation), // 11
|
||||
string.Concat("BEVEL ANGLE", Environment.NewLine, setup.SineBevelAngle), // 12
|
||||
string.Concat("X-STEP (um)", Environment.NewLine, setup.Steps.First().X), // 13
|
||||
string.Concat("PROBE LOAD (gm)", Environment.NewLine, setup.ProbeLoad), // 14
|
||||
string.Concat("SPACING (um)", Environment.NewLine, setup.ProbeSpacing), // 15
|
||||
string.Concat("OPERATOR", Environment.NewLine, info.Operator), // 16
|
||||
string.Concat("DATE", Environment.NewLine, info.DateTime.ToString("dd MMM yy"), Environment.NewLine, "TIME", Environment.NewLine, info.DateTime.ToString("HH:mm:ss tt")), // 17
|
||||
};
|
||||
StringBuilder stringBuilder = new();
|
||||
foreach (Layer layer in layers)
|
||||
_ = stringBuilder.AppendLine(string.Concat("First Pt. ", layer.FirstPoint, " Last Pt. ", layer.LastPoint, " Type ", layer.Type, " Smoothing ", layer.Smoothing, " Correction ", layer.Correction));
|
||||
_ = stringBuilder.AppendLine(string.Join(" ", info.Comments));
|
||||
results[0] = stringBuilder.ToString();
|
||||
return results.ToArray();
|
||||
}
|
||||
|
||||
internal static byte[] GetImageBytes(CSV csv)
|
||||
{
|
||||
if (csv.Info is null)
|
||||
throw new NullReferenceException(nameof(csv.Info));
|
||||
if (csv.Setup is null)
|
||||
throw new NullReferenceException(nameof(csv.Setup));
|
||||
if (csv.LayerHeader is null)
|
||||
throw new NullReferenceException(nameof(csv.LayerHeader));
|
||||
if (csv.ProfileHeader is null)
|
||||
throw new NullReferenceException(nameof(csv.ProfileHeader));
|
||||
|
||||
double decades, maxDepth, concentrationMin, resistanceEditedMin, resistivityMin;
|
||||
GetMinMax(csv.ProfileHeader.ProfilePoints, out decades, out maxDepth, out concentrationMin, out resistanceEditedMin, out resistivityMin);
|
||||
|
||||
byte[] bytes;
|
||||
int penSize = 1;
|
||||
int width = 694;
|
||||
int height = 714;
|
||||
int ellipseSize = 3;
|
||||
Pen pen = Pens.Black;
|
||||
int blocksOfDepth = 6;
|
||||
RectangleF[] rectangles;
|
||||
double topChartArea = 90;
|
||||
double leftChartArea = 60;
|
||||
double widthOfBlacks = 120;
|
||||
Brush brush = Brushes.Black;
|
||||
double widthChartArea = 500;
|
||||
double heightChartArea = 600;
|
||||
Font consolas = new("Consolas", 9);
|
||||
Color backgroundColor = Color.White;
|
||||
Brush resistivityBrush = Brushes.Green;
|
||||
Font consolasBold = new("Consolas", 9);
|
||||
Brush concentrationBrush = Brushes.Blue;
|
||||
Brush resistanceRawBrush = Brushes.Black;
|
||||
Brush resistanceEditedBrush = Brushes.Red;
|
||||
double sizeOfBlock = heightChartArea / 18;
|
||||
Brush backgroundBrush = Brushes.WhiteSmoke;
|
||||
Pen resistivityPen = new(Color.Green, penSize);
|
||||
Pen concentrationPen = new(Color.Blue, penSize);
|
||||
Pen resistanceRawPen = new(Color.Black, penSize);
|
||||
Pen resistanceEditedPen = new(Color.Red, penSize);
|
||||
double widthOfDepthBlock = Math.Ceiling(maxDepth / 3) * 3 / 6;
|
||||
StringFormat stringFormat = new() { Alignment = StringAlignment.Far };
|
||||
|
||||
Bitmap bitmap = new(width, height, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
|
||||
Graphics graphics = Graphics.FromImage(bitmap);
|
||||
graphics.Clear(backgroundColor);
|
||||
|
||||
rectangles = new RectangleF[1];
|
||||
rectangles[0] = GetRectangleF(leftChartArea, topChartArea, widthChartArea, heightChartArea);
|
||||
graphics.FillRectangles(backgroundBrush, rectangles);
|
||||
|
||||
rectangles = GetRectangles(leftChartArea, widthChartArea, topChartArea, sizeOfBlock, widthOfBlacks);
|
||||
graphics.FillRectangles(Brushes.White, rectangles);
|
||||
graphics.DrawRectangles(pen, rectangles);
|
||||
|
||||
string[] descriptions = GetRectanglesDescriptions(csv.Info, csv.Setup, csv.LayerHeader.Layers);
|
||||
for (int i = 0; i < descriptions.Length; i++)
|
||||
graphics.DrawString(descriptions[i], consolas, brush, rectangles[i]);
|
||||
|
||||
DrawLine(graphics, concentrationPen, 13, 6, 13, 40);
|
||||
graphics.DrawString("C", consolasBold, concentrationBrush, 8, 41);
|
||||
graphics.DrawString("D", consolasBold, concentrationBrush, 8, 53);
|
||||
DrawLine(graphics, resistivityPen, 28, 6, 28, 40);
|
||||
graphics.DrawString("ρ", consolasBold, resistivityBrush, 21, 41);
|
||||
graphics.DrawString("c", consolasBold, resistivityBrush, 21, 53);
|
||||
graphics.DrawString("m", consolasBold, resistivityBrush, 21, 62);
|
||||
DrawLine(graphics, resistanceRawPen, 39, 7, 39, 41);
|
||||
graphics.DrawString("Ω", consolasBold, resistanceRawBrush, 34, 41);
|
||||
DrawLine(graphics, resistanceEditedPen, 51, 7, 51, 41);
|
||||
graphics.DrawString("Ω", consolasBold, resistanceEditedBrush, 46, 41);
|
||||
graphics.DrawString("E", consolasBold, resistanceEditedBrush, 46, 53);
|
||||
|
||||
for (double i = decades; i >= 0; i += -1)
|
||||
{
|
||||
for (int j = 1; j <= 10; j++)
|
||||
DrawLine(graphics, Pens.LightGray, leftChartArea, topChartArea + heightChartArea - (i * heightChartArea / decades) + heightChartArea / decades * Math.Log10(j), leftChartArea + widthChartArea, topChartArea + heightChartArea - (i * heightChartArea / decades) + heightChartArea / decades * Math.Log10(j));
|
||||
}
|
||||
|
||||
DrawString(graphics, "0", consolas, brush, leftChartArea - 6, topChartArea + heightChartArea + 5);
|
||||
|
||||
double x, x1, x2;
|
||||
for (int i = 0; i <= blocksOfDepth - 1; i++)
|
||||
{
|
||||
for (int j = 1; j <= 10; j++)
|
||||
{
|
||||
x = leftChartArea + 13 + (i + 1) * widthChartArea / blocksOfDepth;
|
||||
x1 = leftChartArea + (i * widthChartArea / blocksOfDepth) + j * widthChartArea / blocksOfDepth / 10;
|
||||
x2 = leftChartArea + (i * widthChartArea / blocksOfDepth) + (j * widthChartArea / blocksOfDepth / 10);
|
||||
DrawLine(graphics, Pens.LightGray, x1, topChartArea, x2, topChartArea + heightChartArea);
|
||||
DrawString(graphics, ((i + 1) * widthOfDepthBlock).ToString("0.0"), consolas, brush, x, topChartArea + heightChartArea + 5, stringFormat);
|
||||
}
|
||||
}
|
||||
DrawString(graphics, "(um)", consolas, brush, leftChartArea + widthChartArea + 12, topChartArea + heightChartArea + 5);
|
||||
|
||||
for (int i = 0; i <= decades; i++)
|
||||
{
|
||||
DrawLine(graphics, pen, leftChartArea, topChartArea + (i * heightChartArea / decades), leftChartArea + widthChartArea, topChartArea + (i * heightChartArea / decades));
|
||||
DrawString(graphics, (decades - i + resistivityMin).ToString("0"), consolasBold, resistivityBrush, 33, topChartArea - 10 + (i * heightChartArea / decades), stringFormat);
|
||||
DrawString(graphics, (decades - i + concentrationMin).ToString("0"), consolasBold, concentrationBrush, 20, topChartArea - 10 + (i * heightChartArea / decades), stringFormat);
|
||||
DrawString(graphics, (decades - i + resistanceEditedMin).ToString("0"), consolasBold, resistanceRawBrush, 45, topChartArea - 10 + (i * heightChartArea / decades), stringFormat);
|
||||
DrawString(graphics, (decades - i + resistanceEditedMin).ToString("0"), consolasBold, resistanceEditedBrush, 58, topChartArea - 10 + (i * heightChartArea / decades), stringFormat);
|
||||
}
|
||||
for (int i = 0; i <= blocksOfDepth; i++)
|
||||
DrawLine(graphics, pen, leftChartArea + (i * widthChartArea / blocksOfDepth), topChartArea, leftChartArea + (i * widthChartArea / blocksOfDepth), topChartArea + heightChartArea);
|
||||
double y, y2;
|
||||
foreach (ProfilePoint profilePoint in csv.ProfileHeader.ProfilePoints)
|
||||
{
|
||||
if (profilePoint.Log10?.ResistanceEdited is null || profilePoint.Log10?.Resistivity is null || profilePoint.Log10?.Concentration is null)
|
||||
continue;
|
||||
if (profilePoint.Depth <= 0 || profilePoint.ResistanceRaw == 0)
|
||||
continue;
|
||||
graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
|
||||
x = leftChartArea + profilePoint.Depth / maxDepth * widthChartArea - ellipseSize;
|
||||
FillEllipse(graphics, concentrationBrush, x, topChartArea + heightChartArea - ((profilePoint.Log10.Concentration.Value - concentrationMin) / decades * heightChartArea) - ellipseSize - ellipseSize, ellipseSize, ellipseSize);
|
||||
FillEllipse(graphics, resistanceRawBrush, x, topChartArea + heightChartArea - ((profilePoint.Log10.ResistanceRaw - resistanceEditedMin) / decades * heightChartArea) - ellipseSize - ellipseSize, ellipseSize, ellipseSize);
|
||||
FillEllipse(graphics, resistivityBrush, x, topChartArea + heightChartArea - ((profilePoint.Log10.Resistivity.Value - resistivityMin) / decades * heightChartArea) - ellipseSize - ellipseSize, ellipseSize, ellipseSize);
|
||||
FillEllipse(graphics, resistanceEditedBrush, x, topChartArea + heightChartArea - ((profilePoint.Log10.ResistanceEdited.Value - resistanceEditedMin) / decades * heightChartArea) - ellipseSize - ellipseSize, ellipseSize, ellipseSize);
|
||||
if (profilePoint.LastProfilePoint?.ResistanceEdited is not null && profilePoint.LastProfilePoint?.Resistivity is not null && profilePoint.LastProfilePoint?.Concentration is not null && profilePoint.LastProfilePoint?.Log10?.ResistanceEdited is not null && profilePoint.LastProfilePoint?.Log10?.Resistivity is not null && profilePoint.LastProfilePoint?.Log10?.Concentration is not null && profilePoint.DeltaPercent is not null && profilePoint.DeltaPercent is >= .2 or <= -.2)
|
||||
{
|
||||
x = leftChartArea + profilePoint.Depth / maxDepth * widthChartArea - penSize;
|
||||
x2 = leftChartArea + profilePoint.LastProfilePoint.Depth / maxDepth * widthChartArea - penSize;
|
||||
y = topChartArea + heightChartArea - ((profilePoint.Log10.Concentration.Value - concentrationMin) / decades * heightChartArea) - penSize;
|
||||
y2 = topChartArea + heightChartArea - ((profilePoint.LastProfilePoint.Log10.Concentration.Value - concentrationMin) / decades * heightChartArea) - penSize;
|
||||
DrawLine(graphics, concentrationPen, x, y, x2, y2);
|
||||
y = topChartArea + heightChartArea - ((profilePoint.Log10.ResistanceRaw - resistanceEditedMin) / decades * heightChartArea) - penSize;
|
||||
y2 = topChartArea + heightChartArea - ((profilePoint.LastProfilePoint.Log10.ResistanceRaw - resistanceEditedMin) / decades * heightChartArea) - penSize;
|
||||
DrawLine(graphics, resistanceRawPen, x, y, x2, y2);
|
||||
y = topChartArea + heightChartArea - ((profilePoint.Log10.Resistivity.Value - resistivityMin) / decades * heightChartArea) - penSize;
|
||||
y2 = topChartArea + heightChartArea - ((profilePoint.LastProfilePoint.Log10.Resistivity.Value - resistivityMin) / decades * heightChartArea) - penSize;
|
||||
DrawLine(graphics, resistivityPen, x, y, x2, y2);
|
||||
y = topChartArea + heightChartArea - ((profilePoint.Log10.ResistanceEdited.Value - resistanceEditedMin) / decades * heightChartArea) - penSize;
|
||||
y2 = topChartArea + heightChartArea - ((profilePoint.LastProfilePoint.Log10.ResistanceEdited.Value - resistanceEditedMin) / decades * heightChartArea) - penSize;
|
||||
DrawLine(graphics, resistanceEditedPen, x, y, x2, y2);
|
||||
}
|
||||
}
|
||||
|
||||
using MemoryStream msMemoryStream = new();
|
||||
bitmap.Save(msMemoryStream, System.Drawing.Imaging.ImageFormat.Png);
|
||||
bytes = new byte[Convert.ToInt32(msMemoryStream.Length) + 1];
|
||||
_ = msMemoryStream.Read(bytes, 0, bytes.Length);
|
||||
bytes = msMemoryStream.ToArray();
|
||||
return bytes;
|
||||
}
|
||||
|
||||
private static byte[] GetImageBytes(string json)
|
||||
{
|
||||
byte[] results;
|
||||
Adaptation.FileHandlers.csv.CSV? csv = JsonSerializer.Deserialize<Adaptation.FileHandlers.csv.CSV>(json);
|
||||
if (csv is null)
|
||||
throw new NullReferenceException(nameof(csv));
|
||||
CSV result = new(csv);
|
||||
results = GetImageBytes(result);
|
||||
return results;
|
||||
}
|
||||
|
||||
byte[] ISpreadingResistanceProfileService.GetImageBytes(string json)
|
||||
{
|
||||
byte[] results = GetImageBytes(json);
|
||||
return results;
|
||||
}
|
||||
|
||||
byte[] ISpreadingResistanceProfileService.GetImageBytes(Stream stream)
|
||||
{
|
||||
byte[] results;
|
||||
using StreamReader streamReader = new(stream, Encoding.UTF8);
|
||||
string json = streamReader.ReadToEnd();
|
||||
results = GetImageBytes(json);
|
||||
return results;
|
||||
}
|
||||
|
||||
}
|
85
Server/Services/csv/CSV.cs
Normal file
85
Server/Services/csv/CSV.cs
Normal file
@ -0,0 +1,85 @@
|
||||
namespace Adaptation.FileHandlers.csv;
|
||||
|
||||
public class CSV
|
||||
{
|
||||
|
||||
#nullable disable
|
||||
|
||||
#nullable enable
|
||||
#pragma warning disable CA1834
|
||||
|
||||
public string? FileVersion { get; set; }
|
||||
public Info? Info { get; set; }
|
||||
public Setup? Setup { get; set; }
|
||||
public LayerHeader? LayerHeader { get; set; }
|
||||
public ProfileHeader? ProfileHeader { get; set; }
|
||||
public Calibration? Calibration { get; set; }
|
||||
public RawData? RawData { get; set; }
|
||||
|
||||
internal static CSV GetCSV(string path)
|
||||
{
|
||||
CSV result;
|
||||
int? endInfo = null;
|
||||
int? endSetup = null;
|
||||
int? endLayers = null;
|
||||
int? startInfo = null;
|
||||
int? startSetup = null;
|
||||
int? endProfiles = null;
|
||||
int? startLayers = null;
|
||||
int? startRawData = null;
|
||||
int? startProfiles = null;
|
||||
int? endCalibration = null;
|
||||
int? startCalibration = null;
|
||||
#if NET
|
||||
string[] lines = File.ReadAllLines(path, System.Text.Encoding.Latin1); // µ³®
|
||||
# else
|
||||
string[] lines = File.ReadAllLines(path, System.Text.Encoding.GetEncoding("ISO-8859-1")); // µ³®
|
||||
# endif
|
||||
string? fileVersion = !lines.Any() ? null : GetFileVersion(lines.First());
|
||||
for (int i = 1; i < lines.Length; i++)
|
||||
{
|
||||
if (lines[i].StartsWith("--INFO--"))
|
||||
startInfo = i + 1;
|
||||
else if (lines[i].StartsWith("--SETUP--"))
|
||||
(endInfo, startSetup) = (i, i + 1);
|
||||
else if (lines[i].StartsWith("--LAYERS--"))
|
||||
(endSetup, startLayers) = (i, i + 1);
|
||||
else if (lines[i].StartsWith("--PROFILES--"))
|
||||
(endLayers, startProfiles) = (i, i + 1);
|
||||
else if (lines[i].StartsWith("--CALIBRATION--"))
|
||||
(endProfiles, startCalibration) = (i, i + 1);
|
||||
else if (lines[i].StartsWith("--RAWDATA--"))
|
||||
(endCalibration, startRawData) = (i, i + 1);
|
||||
}
|
||||
RawData? rawData = startRawData is null ? null : RawData.GetRawData(lines, startRawData.Value, lines.Length);
|
||||
Info? info = startInfo is null || endInfo is null ? null : Info.GetInfo(lines, startInfo.Value, endInfo.Value);
|
||||
Setup? setup = startSetup is null || endSetup is null ? null : Setup.GetSetup(lines, startSetup.Value, endSetup.Value);
|
||||
LayerHeader? layerHeader = startLayers is null || endLayers is null ? null : LayerHeader.GetLayerHeader(lines, startLayers.Value, endLayers.Value);
|
||||
ProfileHeader? profileHeader = startProfiles is null || endProfiles is null ? null : ProfileHeader.GetProfileHeader(lines, startProfiles.Value, endProfiles.Value);
|
||||
Calibration? calibration = startCalibration is null || endCalibration is null ? null : Calibration.GetCalibration(lines, startCalibration.Value, endCalibration.Value);
|
||||
result = new()
|
||||
{
|
||||
FileVersion = fileVersion,
|
||||
Info = info,
|
||||
Setup = setup,
|
||||
LayerHeader = layerHeader,
|
||||
ProfileHeader = profileHeader,
|
||||
Calibration = calibration,
|
||||
RawData = rawData,
|
||||
|
||||
};
|
||||
return result;
|
||||
}
|
||||
|
||||
private static string GetFileVersion(string line)
|
||||
{
|
||||
string result;
|
||||
string[] segments = line.Split(',');
|
||||
if (segments.Length < 2)
|
||||
result = string.Empty;
|
||||
else
|
||||
result = segments.Last();
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
132
Server/Services/csv/Calibration.cs
Normal file
132
Server/Services/csv/Calibration.cs
Normal file
@ -0,0 +1,132 @@
|
||||
using System.Text;
|
||||
|
||||
namespace Adaptation.FileHandlers.csv;
|
||||
|
||||
public class Calibration
|
||||
{
|
||||
|
||||
#nullable disable
|
||||
|
||||
public string NumberOfCalibrationSets { get; set; }
|
||||
public List<DataSet> DataSets { get; set; }
|
||||
|
||||
#nullable enable
|
||||
#pragma warning disable CA1834
|
||||
|
||||
internal static Calibration? GetCalibration(string[] lines, int start, int stop)
|
||||
{
|
||||
Calibration? result;
|
||||
string first;
|
||||
DataSet dataSet;
|
||||
Position position;
|
||||
string[] segments;
|
||||
int? thirdStart = null;
|
||||
int? secondStart = null;
|
||||
List<Position> positions;
|
||||
List<string> values = new();
|
||||
List<DataSet> dataSets = new();
|
||||
StringBuilder stringBuilder = new();
|
||||
for (int i = start; i < stop; i++)
|
||||
{
|
||||
segments = lines[i].Split(new string[] { "," }, StringSplitOptions.None);
|
||||
first = segments.First();
|
||||
if (first == "DataSet:")
|
||||
{
|
||||
secondStart = i + 1;
|
||||
break;
|
||||
}
|
||||
_ = stringBuilder.Append(first).Append(",");
|
||||
if (segments.Length > 1)
|
||||
values.Add(segments[1]);
|
||||
else
|
||||
values.Add(string.Empty);
|
||||
}
|
||||
string header = "Number of Calibration Sets,";
|
||||
if (secondStart is null || stringBuilder.Length != header.Length || stringBuilder.ToString() != header)
|
||||
result = null;
|
||||
else
|
||||
{
|
||||
result = new()
|
||||
{
|
||||
NumberOfCalibrationSets = values[0],
|
||||
DataSets = dataSets,
|
||||
};
|
||||
for (int x = 0; x < int.MaxValue; x++)
|
||||
{
|
||||
values.Clear();
|
||||
_ = stringBuilder.Clear();
|
||||
if (secondStart is null)
|
||||
break;
|
||||
for (int i = secondStart.Value; i < stop; i++)
|
||||
{
|
||||
segments = lines[i].Split(new string[] { "," }, StringSplitOptions.None);
|
||||
first = segments.First();
|
||||
if (first == "Resistivity(ohm-cm)")
|
||||
{
|
||||
thirdStart = i + 1;
|
||||
break;
|
||||
}
|
||||
if (first == " Sample Set:")
|
||||
continue;
|
||||
_ = stringBuilder.Append(first).Append(",");
|
||||
if (segments.Length > 1)
|
||||
values.Add(segments[1]);
|
||||
else
|
||||
values.Add(string.Empty);
|
||||
}
|
||||
secondStart = null;
|
||||
header = "Operator,Date & Time,Finish,Orientation,North Probe ID,South Probe ID,Polarity,Contact Radius (µm),Probe Spacing (µm),Load (gm),X Step (µm),Name,Plate ID,Type,Points per Sample,Number of Pairs,";
|
||||
if (thirdStart is null || stringBuilder.Length != header.Length || stringBuilder.ToString() != header)
|
||||
result = null;
|
||||
else
|
||||
{
|
||||
positions = new();
|
||||
dataSet = new()
|
||||
{
|
||||
Operator = values[0],
|
||||
DateTime = values[1],
|
||||
Finish = values[2],
|
||||
Orientation = values[3],
|
||||
NorthProbeID = values[4],
|
||||
SouthProbeID = values[5],
|
||||
Polarity = values[6],
|
||||
ContactRadius = values[7],
|
||||
ProbeSpacing = values[8],
|
||||
Load = values[9],
|
||||
XStep = values[10],
|
||||
Name = values[11],
|
||||
PlateId = values[12],
|
||||
Type = values[13],
|
||||
PointsPerSample = values[14],
|
||||
NumberOfPairs = values[15],
|
||||
Positions = positions,
|
||||
};
|
||||
dataSets.Add(dataSet);
|
||||
for (int i = thirdStart.Value; i < stop; i++)
|
||||
{
|
||||
segments = lines[i].Split(new string[] { "," }, StringSplitOptions.None);
|
||||
first = segments.First();
|
||||
if (first == "DataSet:")
|
||||
{
|
||||
secondStart = i + 1;
|
||||
break;
|
||||
}
|
||||
if (segments.Length < 5)
|
||||
continue;
|
||||
position = new()
|
||||
{
|
||||
Resistivity = segments[0],
|
||||
Resistance = segments[1],
|
||||
PercentStandardDeviation = segments[2],
|
||||
Number = segments[3],
|
||||
Name = segments[4],
|
||||
};
|
||||
positions.Add(position);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
27
Server/Services/csv/DataSet.cs
Normal file
27
Server/Services/csv/DataSet.cs
Normal file
@ -0,0 +1,27 @@
|
||||
namespace Adaptation.FileHandlers.csv;
|
||||
|
||||
public class DataSet
|
||||
{
|
||||
|
||||
#nullable disable
|
||||
|
||||
public string Operator { get; set; }
|
||||
public string DateTime { get; set; }
|
||||
public string Finish { get; set; }
|
||||
public string Orientation { get; set; }
|
||||
public string NorthProbeID { get; set; }
|
||||
public string SouthProbeID { get; set; }
|
||||
public string Polarity { get; set; }
|
||||
public string ContactRadius { get; set; }
|
||||
public string ProbeSpacing { get; set; }
|
||||
public string Load { get; set; }
|
||||
public string XStep { get; set; }
|
||||
// public string SampleSet { get; set; }
|
||||
public string Name { get; set; }
|
||||
public string PlateId { get; set; }
|
||||
public string Type { get; set; }
|
||||
public string PointsPerSample { get; set; }
|
||||
public string NumberOfPairs { get; set; }
|
||||
public List<Position> Positions { get; set; }
|
||||
|
||||
}
|
72
Server/Services/csv/Info.cs
Normal file
72
Server/Services/csv/Info.cs
Normal file
@ -0,0 +1,72 @@
|
||||
using System.Text;
|
||||
|
||||
namespace Adaptation.FileHandlers.csv;
|
||||
|
||||
public class Info
|
||||
{
|
||||
|
||||
#nullable disable
|
||||
|
||||
public string Operator { get; set; }
|
||||
public string SampleName { get; set; }
|
||||
public string SoftwareVersion { get; set; }
|
||||
public string DateTime { get; set; }
|
||||
public string SystemId { get; set; }
|
||||
public string SystemSite { get; set; }
|
||||
public string SamplePosition { get; set; }
|
||||
public string Units { get; set; }
|
||||
public string CommentLength { get; set; }
|
||||
public List<string> Comments { get; set; }
|
||||
|
||||
#nullable enable
|
||||
#pragma warning disable CA1834
|
||||
|
||||
internal static Info? GetInfo(string[] lines, int start, int stop)
|
||||
{
|
||||
Info? result;
|
||||
string first;
|
||||
string[] segments;
|
||||
int? secondStart = null;
|
||||
List<string> values = new();
|
||||
List<string> comments = new();
|
||||
StringBuilder stringBuilder = new();
|
||||
for (int i = start; i < stop; i++)
|
||||
{
|
||||
segments = lines[i].Split(new string[] { "," }, StringSplitOptions.None);
|
||||
first = segments.First();
|
||||
if (first == "Comment:")
|
||||
{
|
||||
secondStart = i + 1;
|
||||
break;
|
||||
}
|
||||
_ = stringBuilder.Append(first).Append(",");
|
||||
if (segments.Length > 1)
|
||||
values.Add(segments[1]);
|
||||
else
|
||||
values.Add(string.Empty);
|
||||
}
|
||||
string header = "Operator,Sample Name,Software Version,Date & Time,System ID,System Site,Sample Position,Units,Comment Length,";
|
||||
if (secondStart is null || stringBuilder.Length != header.Length || stringBuilder.ToString() != header)
|
||||
result = null;
|
||||
else
|
||||
{
|
||||
result = new()
|
||||
{
|
||||
Operator = values[0],
|
||||
SampleName = values[1],
|
||||
SoftwareVersion = values[2],
|
||||
DateTime = values[3],
|
||||
SystemId = values[4],
|
||||
SystemSite = values[5],
|
||||
SamplePosition = values[6],
|
||||
Units = values[7],
|
||||
CommentLength = values[8],
|
||||
Comments = comments,
|
||||
};
|
||||
for (int i = secondStart.Value; i < stop; i++)
|
||||
comments.Add(lines[i]);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
24
Server/Services/csv/Layer.cs
Normal file
24
Server/Services/csv/Layer.cs
Normal file
@ -0,0 +1,24 @@
|
||||
namespace Adaptation.FileHandlers.csv;
|
||||
|
||||
public class Layer
|
||||
{
|
||||
|
||||
#nullable disable
|
||||
|
||||
public string FirstPoint { get; set; }
|
||||
public string LastPoint { get; set; }
|
||||
public string Type { get; set; }
|
||||
public string Smoothing { get; set; }
|
||||
public string Apply { get; set; }
|
||||
public string SOrder { get; set; }
|
||||
public string GOrder { get; set; }
|
||||
public string Correction { get; set; }
|
||||
public string Conversion { get; set; }
|
||||
public string JunctionOption { get; set; }
|
||||
public string JunctionConstant { get; set; }
|
||||
public string CurrentDensity { get; set; }
|
||||
public string M1M2Tolerance { get; set; }
|
||||
public string Sheet { get; set; }
|
||||
public string Dose { get; set; }
|
||||
|
||||
}
|
80
Server/Services/csv/LayerHeader.cs
Normal file
80
Server/Services/csv/LayerHeader.cs
Normal file
@ -0,0 +1,80 @@
|
||||
using System.Text;
|
||||
|
||||
namespace Adaptation.FileHandlers.csv;
|
||||
|
||||
public class LayerHeader
|
||||
{
|
||||
|
||||
#nullable disable
|
||||
|
||||
public string NumberOfLayers { get; set; }
|
||||
public List<Layer> Layers { get; set; }
|
||||
|
||||
#nullable enable
|
||||
#pragma warning disable CA1834
|
||||
|
||||
internal static LayerHeader? GetLayerHeader(string[] lines, int start, int stop)
|
||||
{
|
||||
LayerHeader? result;
|
||||
Layer layer;
|
||||
string first;
|
||||
string[] segments;
|
||||
int? secondStart = null;
|
||||
List<Layer> layerCollection = new();
|
||||
List<string> values = new();
|
||||
StringBuilder stringBuilder = new();
|
||||
for (int i = start; i < stop; i++)
|
||||
{
|
||||
segments = lines[i].Split(new string[] { "," }, StringSplitOptions.None);
|
||||
first = segments.First();
|
||||
if (first == "Layer")
|
||||
{
|
||||
secondStart = i + 1;
|
||||
break;
|
||||
}
|
||||
_ = stringBuilder.Append(first).Append(",");
|
||||
if (segments.Length > 1)
|
||||
values.Add(segments[1]);
|
||||
else
|
||||
values.Add(string.Empty);
|
||||
}
|
||||
string header = "Number of Layers,";
|
||||
if (secondStart is null || stringBuilder.Length != header.Length || stringBuilder.ToString() != header)
|
||||
result = null;
|
||||
else
|
||||
{
|
||||
result = new()
|
||||
{
|
||||
NumberOfLayers = values[0],
|
||||
Layers = layerCollection,
|
||||
};
|
||||
for (int i = secondStart.Value; i < stop; i++)
|
||||
{
|
||||
segments = lines[i].Split(new string[] { "," }, StringSplitOptions.None);
|
||||
if (segments.Length < 15)
|
||||
continue;
|
||||
layer = new()
|
||||
{
|
||||
FirstPoint = segments[0],
|
||||
LastPoint = segments[1],
|
||||
Type = segments[2],
|
||||
Smoothing = segments[3],
|
||||
Apply = segments[4],
|
||||
SOrder = segments[5],
|
||||
GOrder = segments[6],
|
||||
Correction = segments[7],
|
||||
Conversion = segments[8],
|
||||
JunctionOption = segments[9],
|
||||
JunctionConstant = segments[10],
|
||||
CurrentDensity = segments[11],
|
||||
M1M2Tolerance = segments[12],
|
||||
Sheet = segments[13],
|
||||
Dose = segments[14],
|
||||
};
|
||||
layerCollection.Add(layer);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
16
Server/Services/csv/Point.cs
Normal file
16
Server/Services/csv/Point.cs
Normal file
@ -0,0 +1,16 @@
|
||||
namespace Adaptation.FileHandlers.csv;
|
||||
|
||||
public class Point
|
||||
{
|
||||
|
||||
#nullable disable
|
||||
|
||||
public string Number { get; set; }
|
||||
public string Depth { get; set; }
|
||||
public string Resistance { get; set; }
|
||||
public string StageX { get; set; }
|
||||
public string StageY { get; set; }
|
||||
public string StageZ { get; set; }
|
||||
public string StageT { get; set; }
|
||||
|
||||
}
|
14
Server/Services/csv/Position.cs
Normal file
14
Server/Services/csv/Position.cs
Normal file
@ -0,0 +1,14 @@
|
||||
namespace Adaptation.FileHandlers.csv;
|
||||
|
||||
public class Position
|
||||
{
|
||||
|
||||
#nullable disable
|
||||
|
||||
public string Resistivity { get; set; }
|
||||
public string Resistance { get; set; }
|
||||
public string PercentStandardDeviation { get; set; }
|
||||
public string Number { get; set; }
|
||||
public string Name { get; set; }
|
||||
|
||||
}
|
15
Server/Services/csv/Profile.cs
Normal file
15
Server/Services/csv/Profile.cs
Normal file
@ -0,0 +1,15 @@
|
||||
namespace Adaptation.FileHandlers.csv;
|
||||
|
||||
public class Profile
|
||||
{
|
||||
|
||||
#nullable disable
|
||||
|
||||
public string Id { get; set; }
|
||||
public string Name { get; set; }
|
||||
public string Label { get; set; }
|
||||
public string Allocated { get; set; }
|
||||
public string Used { get; set; }
|
||||
public string List { get; set; }
|
||||
|
||||
}
|
101
Server/Services/csv/ProfileHeader.cs
Normal file
101
Server/Services/csv/ProfileHeader.cs
Normal file
@ -0,0 +1,101 @@
|
||||
using System.Text;
|
||||
|
||||
namespace Adaptation.FileHandlers.csv;
|
||||
|
||||
public class ProfileHeader
|
||||
{
|
||||
|
||||
#nullable disable
|
||||
|
||||
public string NumberOfProfiles { get; set; }
|
||||
public List<Profile> Profiles { get; set; }
|
||||
public List<ProfilePoint> ProfilePoints { get; set; }
|
||||
|
||||
#nullable enable
|
||||
#pragma warning disable CA1834
|
||||
|
||||
internal static ProfileHeader? GetProfileHeader(string[] lines, int start, int stop)
|
||||
{
|
||||
ProfileHeader? result;
|
||||
string first;
|
||||
string[] segments;
|
||||
Profile profileInfo;
|
||||
ProfilePoint profile;
|
||||
int? thirdStart = null;
|
||||
int? secondStart = null;
|
||||
List<string> values = new();
|
||||
List<Profile> profiles = new();
|
||||
StringBuilder stringBuilder = new();
|
||||
List<ProfilePoint> profilePoints = new();
|
||||
for (int i = start; i < stop; i++)
|
||||
{
|
||||
segments = lines[i].Split(new string[] { "," }, StringSplitOptions.None);
|
||||
first = segments.First();
|
||||
if (first == "ID")
|
||||
{
|
||||
secondStart = i + 1;
|
||||
break;
|
||||
}
|
||||
_ = stringBuilder.Append(first).Append(",");
|
||||
if (segments.Length > 1)
|
||||
values.Add(segments[1]);
|
||||
else
|
||||
values.Add(string.Empty);
|
||||
}
|
||||
string header = "Number of Profiles,";
|
||||
if (secondStart is null || stringBuilder.Length != header.Length || stringBuilder.ToString() != header)
|
||||
result = null;
|
||||
else
|
||||
{
|
||||
result = new()
|
||||
{
|
||||
NumberOfProfiles = values[0],
|
||||
Profiles = profiles,
|
||||
ProfilePoints = profilePoints,
|
||||
};
|
||||
for (int i = secondStart.Value; i < stop; i++)
|
||||
{
|
||||
segments = lines[i].Split(new string[] { "," }, StringSplitOptions.None);
|
||||
first = segments.First();
|
||||
if (first == "Point")
|
||||
{
|
||||
thirdStart = i + 1;
|
||||
break;
|
||||
}
|
||||
if (segments.Length < 6)
|
||||
continue;
|
||||
profileInfo = new()
|
||||
{
|
||||
Id = segments[0],
|
||||
Name = segments[1],
|
||||
Label = segments[2],
|
||||
Allocated = segments[3],
|
||||
Used = segments[4],
|
||||
List = segments[5],
|
||||
};
|
||||
profiles.Add(profileInfo);
|
||||
}
|
||||
if (thirdStart is not null)
|
||||
{
|
||||
for (int i = thirdStart.Value; i < stop; i++)
|
||||
{
|
||||
segments = lines[i].Split(new string[] { "," }, StringSplitOptions.None);
|
||||
if (segments.Length < 6)
|
||||
continue;
|
||||
profile = new()
|
||||
{
|
||||
Number = segments[0],
|
||||
Depth = segments[1],
|
||||
Raw = segments[2],
|
||||
Edited = segments[3],
|
||||
Resistivity = segments[4],
|
||||
CD = segments[5],
|
||||
};
|
||||
profilePoints.Add(profile);
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
15
Server/Services/csv/ProfilePoint.cs
Normal file
15
Server/Services/csv/ProfilePoint.cs
Normal file
@ -0,0 +1,15 @@
|
||||
namespace Adaptation.FileHandlers.csv;
|
||||
|
||||
public class ProfilePoint
|
||||
{
|
||||
|
||||
#nullable disable
|
||||
|
||||
public string Number { get; set; }
|
||||
public string Depth { get; set; }
|
||||
public string Raw { get; set; }
|
||||
public string Edited { get; set; }
|
||||
public string Resistivity { get; set; }
|
||||
public string CD { get; set; }
|
||||
|
||||
}
|
72
Server/Services/csv/RawData.cs
Normal file
72
Server/Services/csv/RawData.cs
Normal file
@ -0,0 +1,72 @@
|
||||
using System.Text;
|
||||
|
||||
namespace Adaptation.FileHandlers.csv;
|
||||
|
||||
public class RawData
|
||||
{
|
||||
|
||||
#nullable disable
|
||||
|
||||
public string TotalPoints { get; set; }
|
||||
public List<Point> Points { get; set; }
|
||||
|
||||
#nullable enable
|
||||
#pragma warning disable CA1834
|
||||
|
||||
internal static RawData? GetRawData(string[] lines, int start, int stop)
|
||||
{
|
||||
RawData? result;
|
||||
Point point;
|
||||
string first;
|
||||
string[] segments;
|
||||
int? secondStart = null;
|
||||
List<Point> points = new();
|
||||
List<string> values = new();
|
||||
StringBuilder stringBuilder = new();
|
||||
for (int i = start; i < stop; i++)
|
||||
{
|
||||
segments = lines[i].Split(new string[] { "," }, StringSplitOptions.None);
|
||||
first = segments.First();
|
||||
if (first == "Point")
|
||||
{
|
||||
secondStart = i + 1;
|
||||
break;
|
||||
}
|
||||
_ = stringBuilder.Append(first).Append(",");
|
||||
if (segments.Length > 1)
|
||||
values.Add(segments[1]);
|
||||
else
|
||||
values.Add(string.Empty);
|
||||
}
|
||||
string header = "Total Points,";
|
||||
if (secondStart is null || stringBuilder.Length != header.Length || stringBuilder.ToString() != header)
|
||||
result = null;
|
||||
else
|
||||
{
|
||||
result = new()
|
||||
{
|
||||
TotalPoints = values[0],
|
||||
Points = points,
|
||||
};
|
||||
for (int i = secondStart.Value; i < stop; i++)
|
||||
{
|
||||
segments = lines[i].Split(new string[] { "," }, StringSplitOptions.None);
|
||||
if (segments.Length < 4)
|
||||
continue;
|
||||
point = new()
|
||||
{
|
||||
Number = segments[0],
|
||||
Depth = segments[1],
|
||||
Resistance = segments[2],
|
||||
StageX = segments[3],
|
||||
StageY = segments[4],
|
||||
StageZ = segments[5],
|
||||
StageT = segments[6],
|
||||
};
|
||||
points.Add(point);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
87
Server/Services/csv/Setup.cs
Normal file
87
Server/Services/csv/Setup.cs
Normal file
@ -0,0 +1,87 @@
|
||||
using System.Text;
|
||||
|
||||
namespace Adaptation.FileHandlers.csv;
|
||||
|
||||
public class Setup
|
||||
{
|
||||
|
||||
#nullable disable
|
||||
|
||||
public string Finish { get; set; }
|
||||
public string NorthProbeID { get; set; }
|
||||
public string SouthProbeID { get; set; }
|
||||
public string MeasurementPolarity { get; set; }
|
||||
public string SineBevelAngle { get; set; }
|
||||
public string ContactRadius { get; set; }
|
||||
public string ProbeSpacing { get; set; }
|
||||
public string ProbeLoad { get; set; }
|
||||
public string Orientation { get; set; }
|
||||
public string NumberOfStepSizes { get; set; }
|
||||
public List<Step> Steps { get; set; }
|
||||
|
||||
#nullable enable
|
||||
#pragma warning disable CA1834
|
||||
|
||||
internal static Setup? GetSetup(string[] lines, int start, int stop)
|
||||
{
|
||||
Setup? result;
|
||||
Step step;
|
||||
string first;
|
||||
string[] segments;
|
||||
int? secondStart = null;
|
||||
List<Step> steps = new();
|
||||
List<string> values = new();
|
||||
StringBuilder stringBuilder = new();
|
||||
for (int i = start; i < stop; i++)
|
||||
{
|
||||
segments = lines[i].Split(new string[] { "," }, StringSplitOptions.None);
|
||||
first = segments.First();
|
||||
if (first == "Step")
|
||||
{
|
||||
secondStart = i + 1;
|
||||
break;
|
||||
}
|
||||
_ = stringBuilder.Append(first).Append(",");
|
||||
if (segments.Length > 1)
|
||||
values.Add(segments[1]);
|
||||
else
|
||||
values.Add(string.Empty);
|
||||
}
|
||||
string header = "Finish,North Probe ID,South Probe ID,Measurement Polarity,Sine Bevel Angle,Contact Radius (µm),Probe Spacing (µm),Probe Load (gm),Orientation,Number of Step Sizes,";
|
||||
if (secondStart is null || stringBuilder.Length != header.Length || stringBuilder.ToString() != header)
|
||||
result = null;
|
||||
else
|
||||
{
|
||||
result = new()
|
||||
{
|
||||
Finish = values[0],
|
||||
NorthProbeID = values[1],
|
||||
SouthProbeID = values[2],
|
||||
MeasurementPolarity = values[3],
|
||||
SineBevelAngle = values[4],
|
||||
ContactRadius = values[5],
|
||||
ProbeSpacing = values[6],
|
||||
ProbeLoad = values[7],
|
||||
Orientation = values[8],
|
||||
NumberOfStepSizes = values[9],
|
||||
Steps = steps,
|
||||
};
|
||||
for (int i = secondStart.Value; i < stop; i++)
|
||||
{
|
||||
segments = lines[i].Split(new string[] { "," }, StringSplitOptions.None);
|
||||
if (segments.Length < 4)
|
||||
continue;
|
||||
step = new()
|
||||
{
|
||||
Number = segments[0],
|
||||
Points = segments[1],
|
||||
X = segments[2],
|
||||
Y = segments[3],
|
||||
};
|
||||
steps.Add(step);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
13
Server/Services/csv/Step.cs
Normal file
13
Server/Services/csv/Step.cs
Normal file
@ -0,0 +1,13 @@
|
||||
namespace Adaptation.FileHandlers.csv;
|
||||
|
||||
public class Step
|
||||
{
|
||||
|
||||
#nullable disable
|
||||
|
||||
public string Number { get; set; }
|
||||
public string Points { get; set; }
|
||||
public string X { get; set; }
|
||||
public string Y { get; set; }
|
||||
|
||||
}
|
27
Server/Services/json/CSV.cs
Normal file
27
Server/Services/json/CSV.cs
Normal file
@ -0,0 +1,27 @@
|
||||
namespace Adaptation.FileHandlers.json;
|
||||
|
||||
public class CSV
|
||||
{
|
||||
|
||||
#nullable enable
|
||||
|
||||
public string? FileVersion { get; }
|
||||
public Info? Info { get; }
|
||||
public Setup? Setup { get; }
|
||||
public LayerHeader? LayerHeader { get; }
|
||||
public ProfileHeader? ProfileHeader { get; }
|
||||
public Calibration? Calibration { get; }
|
||||
public RawData? RawData { get; }
|
||||
|
||||
internal CSV(csv.CSV csv)
|
||||
{
|
||||
FileVersion = csv.FileVersion;
|
||||
Info = csv.Info is null ? null : new(csv.Info);
|
||||
Setup = csv.Setup is null ? null : new(csv.Setup);
|
||||
RawData = csv.RawData is null ? null : new(csv.RawData);
|
||||
Calibration = csv.Calibration is null ? null : new(csv.Calibration);
|
||||
LayerHeader = csv.LayerHeader is null ? null : new(csv.LayerHeader);
|
||||
ProfileHeader = csv.ProfileHeader is null ? null : new(csv.ProfileHeader);
|
||||
}
|
||||
|
||||
}
|
56
Server/Services/json/Calibration.cs
Normal file
56
Server/Services/json/Calibration.cs
Normal file
@ -0,0 +1,56 @@
|
||||
namespace Adaptation.FileHandlers.json;
|
||||
|
||||
public class Calibration
|
||||
{
|
||||
|
||||
public int NumberOfCalibrationSets { get; }
|
||||
public List<DataSet> DataSets { get; }
|
||||
|
||||
internal Calibration(csv.Calibration calibration)
|
||||
{
|
||||
DataSet dataSet;
|
||||
Position position;
|
||||
List<Position> positions;
|
||||
List<DataSet> dataSets = new();
|
||||
NumberOfCalibrationSets = int.Parse(calibration.NumberOfCalibrationSets);
|
||||
DataSets = dataSets;
|
||||
foreach (csv.DataSet csvDataSet in calibration.DataSets)
|
||||
{
|
||||
positions = new();
|
||||
foreach (csv.Position csvPosition in csvDataSet.Positions)
|
||||
{
|
||||
position = new
|
||||
(
|
||||
resistivity: double.Parse(csvPosition.Resistivity),
|
||||
resistance: double.Parse(csvPosition.Resistance),
|
||||
percentStandardDeviation: double.Parse(csvPosition.PercentStandardDeviation),
|
||||
number: int.Parse(csvPosition.Number),
|
||||
name: csvPosition.Name
|
||||
);
|
||||
positions.Add(position);
|
||||
}
|
||||
dataSet = new
|
||||
(
|
||||
@operator: csvDataSet.Operator,
|
||||
dateTime: DateTime.Parse(csvDataSet.DateTime),
|
||||
finish: csvDataSet.Finish,
|
||||
orientation: csvDataSet.Orientation,
|
||||
northProbeID: csvDataSet.NorthProbeID,
|
||||
southProbeID: csvDataSet.SouthProbeID,
|
||||
polarity: csvDataSet.Polarity,
|
||||
contactRadius: double.Parse(csvDataSet.ContactRadius),
|
||||
probeSpacing: double.Parse(csvDataSet.ProbeSpacing),
|
||||
load: double.Parse(csvDataSet.Load),
|
||||
xStep: double.Parse(csvDataSet.XStep),
|
||||
name: csvDataSet.Name,
|
||||
plateId: csvDataSet.PlateId,
|
||||
type: csvDataSet.Type,
|
||||
pointsPerSample: int.Parse(csvDataSet.PointsPerSample),
|
||||
numberOfPairs: int.Parse(csvDataSet.NumberOfPairs),
|
||||
positions: positions
|
||||
);
|
||||
dataSets.Add(dataSet);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
62
Server/Services/json/DataSet.cs
Normal file
62
Server/Services/json/DataSet.cs
Normal file
@ -0,0 +1,62 @@
|
||||
namespace Adaptation.FileHandlers.json;
|
||||
|
||||
public class DataSet
|
||||
{
|
||||
|
||||
public string Operator { get; }
|
||||
public DateTime DateTime { get; }
|
||||
public string Finish { get; }
|
||||
public string Orientation { get; }
|
||||
public string NorthProbeID { get; }
|
||||
public string SouthProbeID { get; }
|
||||
public string Polarity { get; }
|
||||
public double ContactRadius { get; }
|
||||
public double ProbeSpacing { get; }
|
||||
public double Load { get; }
|
||||
public double XStep { get; }
|
||||
// public string SampleSet { get; }
|
||||
public string Name { get; }
|
||||
public string PlateId { get; }
|
||||
public string Type { get; }
|
||||
public int PointsPerSample { get; }
|
||||
public int NumberOfPairs { get; }
|
||||
public List<Position> Positions { get; }
|
||||
|
||||
public DataSet(string @operator,
|
||||
DateTime dateTime,
|
||||
string finish,
|
||||
string orientation,
|
||||
string northProbeID,
|
||||
string southProbeID,
|
||||
string polarity,
|
||||
double contactRadius,
|
||||
double probeSpacing,
|
||||
double load,
|
||||
double xStep,
|
||||
string name,
|
||||
string plateId,
|
||||
string type,
|
||||
int pointsPerSample,
|
||||
int numberOfPairs,
|
||||
List<Position> positions)
|
||||
{
|
||||
Operator = @operator;
|
||||
DateTime = dateTime;
|
||||
Finish = finish;
|
||||
Orientation = orientation;
|
||||
NorthProbeID = northProbeID;
|
||||
SouthProbeID = southProbeID;
|
||||
Polarity = polarity;
|
||||
ContactRadius = contactRadius;
|
||||
ProbeSpacing = probeSpacing;
|
||||
Load = load;
|
||||
XStep = xStep;
|
||||
Name = name;
|
||||
PlateId = plateId;
|
||||
Type = type;
|
||||
PointsPerSample = pointsPerSample;
|
||||
NumberOfPairs = numberOfPairs;
|
||||
Positions = positions;
|
||||
}
|
||||
|
||||
}
|
31
Server/Services/json/Info.cs
Normal file
31
Server/Services/json/Info.cs
Normal file
@ -0,0 +1,31 @@
|
||||
namespace Adaptation.FileHandlers.json;
|
||||
|
||||
public class Info
|
||||
{
|
||||
|
||||
public string Operator { get; }
|
||||
public string SampleName { get; }
|
||||
public string SoftwareVersion { get; }
|
||||
public DateTime DateTime { get; }
|
||||
public string SystemId { get; }
|
||||
public string SystemSite { get; }
|
||||
public int SamplePosition { get; }
|
||||
public int Units { get; }
|
||||
public int CommentLength { get; }
|
||||
public List<string> Comments { get; }
|
||||
|
||||
internal Info(csv.Info info)
|
||||
{
|
||||
Operator = info.Operator;
|
||||
SampleName = info.SampleName;
|
||||
SoftwareVersion = info.SoftwareVersion;
|
||||
DateTime = DateTime.Parse(info.DateTime);
|
||||
SystemId = info.SystemId;
|
||||
SystemSite = info.SystemSite;
|
||||
SamplePosition = int.Parse(info.SamplePosition);
|
||||
Units = int.Parse(info.Units);
|
||||
CommentLength = int.Parse(info.CommentLength);
|
||||
Comments = info.Comments;
|
||||
}
|
||||
|
||||
}
|
55
Server/Services/json/Layer.cs
Normal file
55
Server/Services/json/Layer.cs
Normal file
@ -0,0 +1,55 @@
|
||||
namespace Adaptation.FileHandlers.json;
|
||||
|
||||
public class Layer
|
||||
{
|
||||
|
||||
public int FirstPoint { get; }
|
||||
public int? LastPoint { get; }
|
||||
public string Type { get; }
|
||||
public string Smoothing { get; }
|
||||
public string Apply { get; }
|
||||
public int SOrder { get; }
|
||||
public int GOrder { get; }
|
||||
public string Correction { get; }
|
||||
public string Conversion { get; }
|
||||
public string JunctionOption { get; }
|
||||
public int JunctionConstant { get; }
|
||||
public double CurrentDensity { get; }
|
||||
public string M1M2Tolerance { get; }
|
||||
public string Sheet { get; }
|
||||
public string Dose { get; }
|
||||
|
||||
public Layer(int firstPoint,
|
||||
int? lastPoint,
|
||||
string type,
|
||||
string smoothing,
|
||||
string apply,
|
||||
int sOrder,
|
||||
int gOrder,
|
||||
string correction,
|
||||
string conversion,
|
||||
string junctionOption,
|
||||
int junctionConstant,
|
||||
double currentDensity,
|
||||
string m1M2Tolerance,
|
||||
string sheet,
|
||||
string dose)
|
||||
{
|
||||
FirstPoint = firstPoint;
|
||||
LastPoint = lastPoint;
|
||||
Type = type;
|
||||
Smoothing = smoothing;
|
||||
Apply = apply;
|
||||
SOrder = sOrder;
|
||||
GOrder = gOrder;
|
||||
Correction = correction;
|
||||
Conversion = conversion;
|
||||
JunctionOption = junctionOption;
|
||||
JunctionConstant = junctionConstant;
|
||||
CurrentDensity = currentDensity;
|
||||
M1M2Tolerance = m1M2Tolerance;
|
||||
Sheet = sheet;
|
||||
Dose = dose;
|
||||
}
|
||||
|
||||
}
|
39
Server/Services/json/LayerHeader.cs
Normal file
39
Server/Services/json/LayerHeader.cs
Normal file
@ -0,0 +1,39 @@
|
||||
namespace Adaptation.FileHandlers.json;
|
||||
|
||||
public class LayerHeader
|
||||
{
|
||||
|
||||
public int NumberOfLayers { get; }
|
||||
public List<Layer> Layers { get; }
|
||||
|
||||
internal LayerHeader(csv.LayerHeader layerHeader)
|
||||
{
|
||||
Layer layer;
|
||||
List<Layer> layers = new();
|
||||
NumberOfLayers = int.Parse(layerHeader.NumberOfLayers);
|
||||
Layers = layers;
|
||||
foreach (csv.Layer csvLayer in layerHeader.Layers)
|
||||
{
|
||||
layer = new
|
||||
(
|
||||
firstPoint: int.Parse(csvLayer.FirstPoint),
|
||||
lastPoint: string.IsNullOrEmpty(csvLayer.LastPoint) ? null : int.Parse(csvLayer.LastPoint),
|
||||
type: csvLayer.Type,
|
||||
smoothing: csvLayer.Smoothing,
|
||||
apply: csvLayer.Apply,
|
||||
sOrder: int.Parse(csvLayer.SOrder),
|
||||
gOrder: int.Parse(csvLayer.GOrder),
|
||||
correction: csvLayer.Correction,
|
||||
conversion: csvLayer.Conversion,
|
||||
junctionOption: csvLayer.JunctionOption,
|
||||
junctionConstant: int.Parse(csvLayer.JunctionConstant),
|
||||
currentDensity: double.Parse(csvLayer.CurrentDensity),
|
||||
m1M2Tolerance: csvLayer.M1M2Tolerance,
|
||||
sheet: csvLayer.Sheet,
|
||||
dose: csvLayer.Dose
|
||||
);
|
||||
layers.Add(layer);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
27
Server/Services/json/Log10.cs
Normal file
27
Server/Services/json/Log10.cs
Normal file
@ -0,0 +1,27 @@
|
||||
namespace Adaptation.FileHandlers.json;
|
||||
|
||||
public class Log10
|
||||
{
|
||||
|
||||
#nullable enable
|
||||
|
||||
public double Depth { get; }
|
||||
public double ResistanceRaw { get; }
|
||||
public double? ResistanceEdited { get; }
|
||||
public double? Resistivity { get; }
|
||||
public double? Concentration { get; }
|
||||
|
||||
public Log10(double depth,
|
||||
double raw,
|
||||
double? edited,
|
||||
double? resistivity,
|
||||
double? cd)
|
||||
{
|
||||
Depth = Math.Log10(depth);
|
||||
ResistanceRaw = Math.Log10(raw);
|
||||
ResistanceEdited = edited is null ? null : Math.Log10(edited.Value);
|
||||
Resistivity = resistivity is null ? null : Math.Log10(resistivity.Value);
|
||||
Concentration = cd is null ? null : Math.Log10(cd.Value);
|
||||
}
|
||||
|
||||
}
|
31
Server/Services/json/Point.cs
Normal file
31
Server/Services/json/Point.cs
Normal file
@ -0,0 +1,31 @@
|
||||
namespace Adaptation.FileHandlers.json;
|
||||
|
||||
public class Point
|
||||
{
|
||||
|
||||
public double Number { get; }
|
||||
public double Depth { get; }
|
||||
public double Resistance { get; }
|
||||
public double StageX { get; }
|
||||
public double StageY { get; }
|
||||
public double StageZ { get; }
|
||||
public double StageT { get; }
|
||||
|
||||
public Point(double number,
|
||||
double depth,
|
||||
double resistance,
|
||||
double stageX,
|
||||
double stageY,
|
||||
double stageZ,
|
||||
double stageT)
|
||||
{
|
||||
Number = number;
|
||||
Depth = depth;
|
||||
Resistance = resistance;
|
||||
StageX = stageX;
|
||||
StageY = stageY;
|
||||
StageZ = stageZ;
|
||||
StageT = stageT;
|
||||
}
|
||||
|
||||
}
|
25
Server/Services/json/Position.cs
Normal file
25
Server/Services/json/Position.cs
Normal file
@ -0,0 +1,25 @@
|
||||
namespace Adaptation.FileHandlers.json;
|
||||
|
||||
public class Position
|
||||
{
|
||||
|
||||
public double Resistivity { get; }
|
||||
public double Resistance { get; }
|
||||
public double PercentStandardDeviation { get; }
|
||||
public int Number { get; }
|
||||
public string Name { get; }
|
||||
|
||||
public Position(double resistivity,
|
||||
double resistance,
|
||||
double percentStandardDeviation,
|
||||
int number,
|
||||
string name)
|
||||
{
|
||||
Resistivity = resistivity;
|
||||
Resistance = resistance;
|
||||
PercentStandardDeviation = percentStandardDeviation;
|
||||
Number = number;
|
||||
Name = name;
|
||||
}
|
||||
|
||||
}
|
28
Server/Services/json/Profile.cs
Normal file
28
Server/Services/json/Profile.cs
Normal file
@ -0,0 +1,28 @@
|
||||
namespace Adaptation.FileHandlers.json;
|
||||
|
||||
public class Profile
|
||||
{
|
||||
|
||||
public string Id { get; }
|
||||
public string Name { get; }
|
||||
public string Label { get; }
|
||||
public int Allocated { get; }
|
||||
public int Used { get; }
|
||||
public string List { get; }
|
||||
|
||||
public Profile(string id,
|
||||
string name,
|
||||
string label,
|
||||
int allocated,
|
||||
int used,
|
||||
string list)
|
||||
{
|
||||
Id = id;
|
||||
Name = name;
|
||||
Label = label;
|
||||
Allocated = allocated;
|
||||
Used = used;
|
||||
List = list;
|
||||
}
|
||||
|
||||
}
|
52
Server/Services/json/ProfileHeader.cs
Normal file
52
Server/Services/json/ProfileHeader.cs
Normal file
@ -0,0 +1,52 @@
|
||||
namespace Adaptation.FileHandlers.json;
|
||||
|
||||
public class ProfileHeader
|
||||
{
|
||||
|
||||
public int NumberOfProfiles { get; }
|
||||
public List<Profile> Profiles { get; }
|
||||
public List<ProfilePoint> ProfilePoints { get; }
|
||||
|
||||
internal ProfileHeader(csv.ProfileHeader profileHeader)
|
||||
{
|
||||
Profile profile;
|
||||
ProfilePoint profilePoint;
|
||||
List<Profile> profiles = new();
|
||||
csv.ProfilePoint csvProfilePoint;
|
||||
ProfilePoint? lastProfilePoint = null;
|
||||
List<ProfilePoint> profilePoints = new();
|
||||
NumberOfProfiles = int.Parse(profileHeader.NumberOfProfiles);
|
||||
Profiles = profiles;
|
||||
ProfilePoints = profilePoints;
|
||||
foreach (csv.Profile csvProfile in profileHeader.Profiles)
|
||||
{
|
||||
profile = new
|
||||
(
|
||||
id: csvProfile.Id,
|
||||
name: csvProfile.Name,
|
||||
label: csvProfile.Label,
|
||||
allocated: int.Parse(csvProfile.Allocated),
|
||||
used: int.Parse(csvProfile.Used),
|
||||
list: csvProfile.List
|
||||
);
|
||||
profiles.Add(profile);
|
||||
}
|
||||
for (int i = 0; i < profileHeader.ProfilePoints.Count; i++)
|
||||
{
|
||||
csvProfilePoint = profileHeader.ProfilePoints[i];
|
||||
profilePoint = new
|
||||
(
|
||||
number: int.Parse(csvProfilePoint.Number),
|
||||
depth: double.Parse(csvProfilePoint.Depth),
|
||||
raw: double.Parse(csvProfilePoint.Raw),
|
||||
edited: double.Parse(csvProfilePoint.Edited),
|
||||
resistivity: double.Parse(csvProfilePoint.Resistivity),
|
||||
cd: double.Parse(csvProfilePoint.CD),
|
||||
lastProfilePoint: lastProfilePoint
|
||||
);
|
||||
profilePoints.Add(profilePoint);
|
||||
lastProfilePoint = profilePoint;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
44
Server/Services/json/ProfilePoint.cs
Normal file
44
Server/Services/json/ProfilePoint.cs
Normal file
@ -0,0 +1,44 @@
|
||||
namespace Adaptation.FileHandlers.json;
|
||||
|
||||
public class ProfilePoint
|
||||
{
|
||||
|
||||
#nullable enable
|
||||
|
||||
public int Number { get; }
|
||||
public double Depth { get; }
|
||||
public double ResistanceRaw { get; }
|
||||
public double? ResistanceEdited { get; }
|
||||
public double? Resistivity { get; }
|
||||
public double? Concentration { get; }
|
||||
public double? DeltaPercent { get; }
|
||||
public ProfilePoint? LastProfilePoint { get; }
|
||||
public Log10? Log10 { get; }
|
||||
|
||||
public ProfilePoint(int number,
|
||||
double depth,
|
||||
double raw,
|
||||
double? edited,
|
||||
double? resistivity,
|
||||
double? cd,
|
||||
ProfilePoint? lastProfilePoint)
|
||||
{
|
||||
Number = number;
|
||||
Depth = depth;
|
||||
ResistanceRaw = raw;
|
||||
ResistanceEdited = edited;
|
||||
Resistivity = resistivity;
|
||||
Concentration = cd;
|
||||
DeltaPercent = lastProfilePoint is null ? null : (lastProfilePoint.ResistanceRaw - raw) / raw;
|
||||
LastProfilePoint = lastProfilePoint;
|
||||
Log10 = new
|
||||
(
|
||||
depth: depth,
|
||||
raw: raw,
|
||||
edited: edited,
|
||||
resistivity: resistivity,
|
||||
cd: cd
|
||||
);
|
||||
}
|
||||
|
||||
}
|
31
Server/Services/json/RawData.cs
Normal file
31
Server/Services/json/RawData.cs
Normal file
@ -0,0 +1,31 @@
|
||||
namespace Adaptation.FileHandlers.json;
|
||||
|
||||
public class RawData
|
||||
{
|
||||
|
||||
public int TotalPoints { get; }
|
||||
public List<Point> Points { get; }
|
||||
|
||||
internal RawData(csv.RawData rawData)
|
||||
{
|
||||
Point point;
|
||||
List<Point> points = new();
|
||||
TotalPoints = int.Parse(rawData.TotalPoints);
|
||||
Points = points;
|
||||
foreach (csv.Point csvPoint in rawData.Points)
|
||||
{
|
||||
point = new
|
||||
(
|
||||
number: double.Parse(csvPoint.Number),
|
||||
depth: double.Parse(csvPoint.Depth),
|
||||
resistance: double.Parse(csvPoint.Resistance),
|
||||
stageX: double.Parse(csvPoint.StageX),
|
||||
stageY: double.Parse(csvPoint.StageY),
|
||||
stageZ: double.Parse(csvPoint.StageZ),
|
||||
stageT: double.Parse(csvPoint.StageT)
|
||||
);
|
||||
points.Add(point);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
47
Server/Services/json/Setup.cs
Normal file
47
Server/Services/json/Setup.cs
Normal file
@ -0,0 +1,47 @@
|
||||
namespace Adaptation.FileHandlers.json;
|
||||
|
||||
public class Setup
|
||||
{
|
||||
|
||||
public string Finish { get; }
|
||||
public string NorthProbeID { get; }
|
||||
public string SouthProbeID { get; }
|
||||
public string MeasurementPolarity { get; }
|
||||
public double SineBevelAngle { get; }
|
||||
public double ContactRadius { get; }
|
||||
public double ProbeSpacing { get; }
|
||||
public double ProbeLoad { get; }
|
||||
public string Orientation { get; }
|
||||
public int NumberOfStepSizes { get; }
|
||||
public List<Step> Steps { get; }
|
||||
|
||||
internal Setup(csv.Setup setup)
|
||||
{
|
||||
Step step;
|
||||
List<Step> steps = new();
|
||||
Finish = setup.Finish;
|
||||
NorthProbeID = setup.NorthProbeID;
|
||||
SouthProbeID = setup.SouthProbeID;
|
||||
MeasurementPolarity = setup.MeasurementPolarity;
|
||||
SineBevelAngle = double.Parse(setup.SineBevelAngle);
|
||||
ContactRadius = double.Parse(setup.ContactRadius);
|
||||
ProbeSpacing = double.Parse(setup.ProbeSpacing);
|
||||
ProbeLoad = double.Parse(setup.ProbeLoad);
|
||||
Orientation = setup.Orientation;
|
||||
NumberOfStepSizes = int.Parse(setup.NumberOfStepSizes);
|
||||
Steps = steps;
|
||||
foreach (csv.Step csvStep in setup.Steps)
|
||||
{
|
||||
Step step1 = new
|
||||
(
|
||||
number: int.Parse(csvStep.Number),
|
||||
points: int.Parse(csvStep.Points),
|
||||
x: double.Parse(csvStep.X),
|
||||
y: double.Parse(csvStep.Y)
|
||||
);
|
||||
step = step1;
|
||||
steps.Add(step);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
22
Server/Services/json/Step.cs
Normal file
22
Server/Services/json/Step.cs
Normal file
@ -0,0 +1,22 @@
|
||||
namespace Adaptation.FileHandlers.json;
|
||||
|
||||
public class Step
|
||||
{
|
||||
|
||||
public int Number { get; }
|
||||
public int Points { get; }
|
||||
public double X { get; }
|
||||
public double Y { get; }
|
||||
|
||||
public Step(int number,
|
||||
int points,
|
||||
double x,
|
||||
double y)
|
||||
{
|
||||
Number = number;
|
||||
Points = points;
|
||||
X = x;
|
||||
Y = y;
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user