Spreading Resistance Profile with ChartJS,
Copy-On-Get and nuget bump (Serilog)
This commit is contained in:
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;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user