diff --git a/SPTInstaller/CustomControls/Dialogs/WhyCacheThoughDialog.axaml b/SPTInstaller/CustomControls/Dialogs/WhyCacheThoughDialog.axaml
index fa63d81..bf70a76 100644
--- a/SPTInstaller/CustomControls/Dialogs/WhyCacheThoughDialog.axaml
+++ b/SPTInstaller/CustomControls/Dialogs/WhyCacheThoughDialog.axaml
@@ -6,7 +6,7 @@
xmlns:dialogHost="clr-namespace:DialogHostAvalonia;assembly=DialogHost.Avalonia"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
x:Class="SPTInstaller.CustomControls.Dialogs.WhyCacheThoughDialog">
-
@@ -16,7 +16,6 @@ The installer cache is used to ensure you don't re-download large files that you
- You are low on space
or
- You are not planning on installing SPT again any time soon
-
If possible, you should leave the cache in place to avoid uneccessary, lengthy downloads.
It also helps us prevent extra traffic to our limited download mirrors. Every bit helps ♥️
@@ -25,7 +24,6 @@ It also helps us prevent extra traffic to our limited download mirrors. Every bi
+
+
+
+
+
-
-
-
+
+
\ No newline at end of file
diff --git a/SPTInstaller/CustomControls/Dialogs/WhyCacheThoughDialog.axaml.cs b/SPTInstaller/CustomControls/Dialogs/WhyCacheThoughDialog.axaml.cs
index 4440593..4bc4f94 100644
--- a/SPTInstaller/CustomControls/Dialogs/WhyCacheThoughDialog.axaml.cs
+++ b/SPTInstaller/CustomControls/Dialogs/WhyCacheThoughDialog.axaml.cs
@@ -3,7 +3,9 @@ using System.Diagnostics;
using System.Linq;
using Avalonia;
using Avalonia.Controls;
+using Avalonia.Media;
using Serilog;
+using Color = System.Drawing.Color;
namespace SPTInstaller.CustomControls.Dialogs;
@@ -54,6 +56,46 @@ public partial class WhyCacheThoughDialog : UserControl
});
}
+ public void ClearCachedMetaData()
+ {
+ var cachedMetadata =
+ new DirectoryInfo(DownloadCacheHelper.CachePath).GetFiles("*.json", SearchOption.TopDirectoryOnly);
+
+ var message = "no cached metadata to remove";
+
+ if (cachedMetadata.Length == 0)
+ {
+ AdditionalInfo = message;
+ AdditionalInfoColor = "dodgerblue";
+ Log.Information(message);
+ return;
+ }
+
+ var allDeleted = true;
+
+ foreach (var file in cachedMetadata)
+ {
+ try
+ {
+ file.Delete();
+ file.Refresh();
+ if (file.Exists)
+ {
+ allDeleted = false;
+ }
+ }
+ catch (Exception ex)
+ {
+ Log.Error(ex, $"Failed to delete cached metadata file: {file.Name}");
+ }
+ }
+
+ message = allDeleted ? "cached metadata removed" : "some files could not be removed. Check logs";
+ AdditionalInfo = message;
+ AdditionalInfoColor = allDeleted ? "green" : "red";
+ Log.Information(message);
+ }
+
public void MoveDownloadsPatcherToCache()
{
switch (_movePatcherState)
diff --git a/SPTInstaller/SPTInstaller.csproj b/SPTInstaller/SPTInstaller.csproj
index 40bd3d9..ca0fba1 100644
--- a/SPTInstaller/SPTInstaller.csproj
+++ b/SPTInstaller/SPTInstaller.csproj
@@ -9,8 +9,8 @@
icon.icoAssets\icon.icoDebug;Release;TEST
- 2.64
- 2.64
+ 2.66
+ 2.66SPT-AKI