Update TileImageLoader.cs

This commit is contained in:
ClemensFischer 2025-08-21 23:48:20 +02:00
parent 2cf8636f4c
commit fce05c2ed1

View file

@ -121,12 +121,12 @@ namespace MapControl
{ {
tile.IsPending = false; tile.IsPending = false;
var tilesLoaded = tileCount - tileStack.Count; var tileNumber = tileCount - tileStack.Count;
progress?.Report((double)tilesLoaded / tileCount); progress?.Report((double)tileNumber / tileCount);
Logger?.LogTrace("[{thread}] Loading tile {loaded} of {count}: {zoom}/{column}/{row}", Logger?.LogTrace("Loading tile {number} of {count} ({zoom}/{column}/{row}) in thread {thread}",
Environment.CurrentManagedThreadId, tilesLoaded, tileCount, tile.ZoomLevel, tile.Column, tile.Row); tileNumber, tileCount, tile.ZoomLevel, tile.Column, tile.Row, Environment.CurrentManagedThreadId);
try try
{ {
@ -170,8 +170,6 @@ namespace MapControl
private static async Task<byte[]> LoadCachedBuffer(Tile tile, Uri uri, string cacheName) private static async Task<byte[]> LoadCachedBuffer(Tile tile, Uri uri, string cacheName)
{ {
byte[] buffer = null;
var extension = Path.GetExtension(uri.LocalPath); var extension = Path.GetExtension(uri.LocalPath);
if (string.IsNullOrEmpty(extension) || extension.Equals(".jpeg", StringComparison.OrdinalIgnoreCase)) if (string.IsNullOrEmpty(extension) || extension.Equals(".jpeg", StringComparison.OrdinalIgnoreCase))
@ -180,6 +178,7 @@ namespace MapControl
} }
var cacheKey = $"{cacheName}/{tile.ZoomLevel}/{tile.Column}/{tile.Row}{extension}"; var cacheKey = $"{cacheName}/{tile.ZoomLevel}/{tile.Column}/{tile.Row}{extension}";
byte[] buffer = null;
try try
{ {