using System.Collections.Generic; namespace Adaptation.FileHandlers.json; public class ProfileHeader { #nullable enable public int NumberOfProfiles { get; } public List Profiles { get; } public List ProfilePoints { get; } internal ProfileHeader(csv.ProfileHeader profileHeader) { Profile profile; ProfilePoint profilePoint; List profiles = new(); csv.ProfilePoint csvProfilePoint; ProfilePoint? lastProfilePoint = null; List 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; } } }