diff --git a/MapControl/Avalonia/TileImageLoader.Avalonia.cs b/MapControl/Avalonia/TileImageLoader.Avalonia.cs
index 225803b1..dae2df0a 100644
--- a/MapControl/Avalonia/TileImageLoader.Avalonia.cs
+++ b/MapControl/Avalonia/TileImageLoader.Avalonia.cs
@@ -9,12 +9,6 @@ namespace MapControl
{
public partial class TileImageLoader
{
- ///
- /// Default folder where the Cache instance may save data, i.e. "C:\ProgramData\MapControl\TileCache".
- ///
- public static string DefaultCacheFolder =>
- System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData), "MapControl", "TileCache");
-
private static async Task LoadTileAsync(Tile tile, Func> loadImageFunc)
{
var image = await loadImageFunc().ConfigureAwait(false);
diff --git a/MapControl/Shared/ImageFileCache.cs b/MapControl/Shared/ImageFileCache.cs
index 4c9aae2b..7b096c1d 100644
--- a/MapControl/Shared/ImageFileCache.cs
+++ b/MapControl/Shared/ImageFileCache.cs
@@ -24,18 +24,18 @@ namespace MapControl.Caching
private static readonly byte[] expirationTag = Encoding.ASCII.GetBytes("EXPIRES:");
private readonly MemoryDistributedCache memoryCache = new MemoryDistributedCache(Options.Create(new MemoryDistributedCacheOptions()));
- private readonly string rootDirectory;
+ private readonly string rootPath;
- public ImageFileCache(string directory)
+ public ImageFileCache(string path)
{
- if (string.IsNullOrEmpty(directory))
+ if (string.IsNullOrEmpty(path))
{
- throw new ArgumentException($"The {nameof(directory)} argument must not be null or empty.", nameof(directory));
+ throw new ArgumentException($"The {nameof(path)} argument must not be null or empty.", nameof(path));
}
- rootDirectory = directory;
+ rootPath = path;
- Debug.WriteLine($"ImageFileCache: {rootDirectory}");
+ Debug.WriteLine($"ImageFileCache: {rootPath}");
ThreadPool.QueueUserWorkItem(o => Clean());
}
@@ -210,7 +210,7 @@ namespace MapControl.Caching
public void Clean()
{
- var deletedFileCount = CleanDirectory(new DirectoryInfo(rootDirectory));
+ var deletedFileCount = CleanDirectory(new DirectoryInfo(rootPath));
if (deletedFileCount > 0)
{
@@ -227,7 +227,7 @@ namespace MapControl.Caching
{
try
{
- return Path.Combine(rootDirectory, Path.Combine(key.Split('/')));
+ return Path.Combine(rootPath, Path.Combine(key.Split('/')));
}
catch (Exception ex)
{
diff --git a/MapControl/Shared/TileImageLoader.cs b/MapControl/Shared/TileImageLoader.cs
index 99dba720..f8cf1c76 100644
--- a/MapControl/Shared/TileImageLoader.cs
+++ b/MapControl/Shared/TileImageLoader.cs
@@ -44,6 +44,12 @@ namespace MapControl
}
}
+ ///
+ /// Default folder path where a persistent cache implementation may save data, i.e. "C:\ProgramData\MapControl\TileCache".
+ ///
+ public static string DefaultCacheFolder =>
+ System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData), "MapControl", "TileCache");
+
///
/// An IDistributedCache implementation used to cache tile images.
/// The default value is a MemoryDistributedCache instance.
diff --git a/MapControl/UWP/TileImageLoader.UWP.cs b/MapControl/UWP/TileImageLoader.UWP.cs
index ee27b03d..7c6fdaa1 100644
--- a/MapControl/UWP/TileImageLoader.UWP.cs
+++ b/MapControl/UWP/TileImageLoader.UWP.cs
@@ -4,7 +4,6 @@
using System;
using System.Threading.Tasks;
-using Windows.Storage;
using Windows.UI.Core;
using Windows.UI.Xaml.Media;
@@ -12,11 +11,6 @@ namespace MapControl
{
public partial class TileImageLoader
{
- ///
- /// Default folder where the Cache instance may save data.
- ///
- public static StorageFolder DefaultCacheFolder => ApplicationData.Current.LocalCacheFolder;
-
private static async Task LoadTileAsync(Tile tile, Func> loadImageFunc)
{
var tcs = new TaskCompletionSource