Added deserialization of PathResult
This commit is contained in:
parent
914731c8a3
commit
a1d9ccad46
@ -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))!;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user