Parallel reading of regionfiles.
This commit is contained in:
parent
93a448e189
commit
7d769a064f
@ -40,20 +40,10 @@ namespace Pathfinding
|
||||
if (!File.Exists(filePath))
|
||||
return null;
|
||||
|
||||
while (true)
|
||||
{
|
||||
|
||||
try
|
||||
{
|
||||
FileStream regionFile = new (filePath, FileMode.Open);
|
||||
Region retRegion = JsonSerializer.Deserialize<Region>(regionFile, Region.serializerOptions)!;
|
||||
regionFile.Dispose();
|
||||
return retRegion;
|
||||
}catch(IOException)
|
||||
{
|
||||
Thread.Sleep(10);
|
||||
}
|
||||
}
|
||||
FileStream regionFile = new (filePath, FileMode.Open, FileAccess.Read, FileShare.Read);
|
||||
Region retRegion = JsonSerializer.Deserialize<Region>(regionFile, Region.serializerOptions)!;
|
||||
regionFile.Dispose();
|
||||
return retRegion;
|
||||
}
|
||||
|
||||
private Region? RegionFromId(ulong regionId)
|
||||
|
Loading…
Reference in New Issue
Block a user