using System.Text.Json; using System.Text.Json.Serialization; namespace Pathfinding; public class PathResult { [JsonInclude]public double distance; [JsonInclude]public double weight; [JsonInclude]public TimeSpan calcTime; [JsonInclude]public List pathNodes; [JsonConstructor] public PathResult(TimeSpan calcTime, List pathNodes, double distance, double weight) { this.calcTime = calcTime; this.pathNodes = pathNodes; this.distance = distance; this.weight = weight; } public static PathResult PathresultFromFile(string filePath) { return JsonSerializer.Deserialize(new FileStream(filePath, FileMode.Open, FileAccess.Read, FileShare.Read))!; } }