From 4f0d5d4f30ad26efc32dfdfa9f82966d5f4ea5c9 Mon Sep 17 00:00:00 2001 From: C9Glax <13404778+C9Glax@users.noreply.github.com> Date: Wed, 8 Feb 2023 19:05:29 +0100 Subject: [PATCH] RegionManager.cs: More extensive logging --- Pathfinding/RegionManager.cs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/Pathfinding/RegionManager.cs b/Pathfinding/RegionManager.cs index a7fbe29..b534ab0 100644 --- a/Pathfinding/RegionManager.cs +++ b/Pathfinding/RegionManager.cs @@ -45,18 +45,21 @@ namespace OSMImporter private Region LoadRegion(Coordinates coordinates) { string fullPath = Path.Combine(workingDirectory, coordinates.GetRegionHash().ToString()); - Console.WriteLine("Loading {0}", fullPath); + DateTime startTime = DateTime.Now; if (!File.Exists(fullPath)) { - throw new FileNotFoundException(string.Format("Region does not exist: {0}", fullPath)); + throw new FileNotFoundException(string.Format("[{0}] Region does not exist: {1}", startTime, fullPath)); } FileStream fileStream = new FileStream(fullPath, FileMode.Open); + long fileStreamLength = fileStream.Length; + Console.WriteLine("[{0}] Loading [{1}]bytes from {2}", startTime.ToLocalTime(), fileStreamLength, fullPath); byte[] regionBytes = new byte[fileStream.Length]; - int _ = fileStream.Read(regionBytes, 0, regionBytes.Length); + int loadedBytesLength = fileStream.Read(regionBytes, 0, regionBytes.Length); fileStream.Close(); - + + Console.WriteLine("\tLoaded [{0}]bytes ({1:P1}) in [{2}]ms", loadedBytesLength, fileStreamLength / loadedBytesLength,DateTime.Now.Subtract(startTime).TotalMilliseconds); return ByteConverter.ToRegion(regionBytes); }