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