.Data
.vscode
Archive
Server
.vscode
ApiControllers
Controllers
Data
Models
Properties
Repositories
Services
csv
CSV.cs
Calibration.cs
DataSet.cs
Info.cs
Layer.cs
LayerHeader.cs
Point.cs
Position.cs
Profile.cs
ProfileHeader.cs
ProfilePoint.cs
RawData.cs
Setup.cs
Step.cs
json
AttachmentsService.cs
InboundDataService.cs
SQLDbConnectionFactory.cs
SpreadingResistanceProfileService.cs
Views
wwwroot
ApiLoggingMiddleware.cs
OI.Metrology.Server.csproj
Program.cs
compilerconfig.json
compilerconfig.json.defaults
Shared
Tests
View
.editorconfig
.gitignore
OI-Metrology.sln
README.md
azure-pipelines-server-development.yml
azure-pipelines-server.yml
package.json
80 lines
2.5 KiB
C#
80 lines
2.5 KiB
C#
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;
|
|
}
|
|
|
|
} |