Added deserialization of PathResult

This commit is contained in:
glax 2023-04-21 18:35:02 +02:00
parent 914731c8a3
commit a1d9ccad46

View File

@ -1,3 +1,4 @@
using System.Text.Json;
using System.Text.Json.Serialization;
namespace Pathfinding;
@ -17,4 +18,10 @@ public class PathResult
this.distance = distance;
this.weight = weight;
}
public static PathResult PathresultFromFile(string filePath)
{
return JsonSerializer.Deserialize<PathResult>(new FileStream(filePath, FileMode.Open, FileAccess.Read,
FileShare.Read))!;
}
}