Skip to content

Commit

Permalink
Implement CacheDirectoryService in WPF
Browse files Browse the repository at this point in the history
  • Loading branch information
ScrubN committed Dec 27, 2024
1 parent bc5ab2c commit 173e56b
Showing 1 changed file with 3 additions and 18 deletions.
21 changes: 3 additions & 18 deletions TwitchDownloaderWPF/WindowSettings.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
using System.Windows.Documents;
using System.Windows.Input;
using HandyControl.Data;
using TwitchDownloaderCore.Services;
using TwitchDownloaderWPF.Extensions;
using TwitchDownloaderWPF.Models;
using TwitchDownloaderWPF.Properties;
Expand Down Expand Up @@ -112,24 +113,8 @@ private void BtnClearCache_Click(object sender, RoutedEventArgs e)
if (messageBoxResult == MessageBoxResult.Yes)
{
//Let's clear the user selected temp folder and the default one
string defaultDir = Path.Combine(Path.GetTempPath(), "TwitchDownloader");
string tempDir = Path.Combine(Settings.Default.TempPath, "TwitchDownloader");
if (Directory.Exists(defaultDir))
{
try
{
Directory.Delete(defaultDir, true);
}
catch { }
}
if (Directory.Exists(tempDir))
{
try
{
Directory.Delete(tempDir, true);
}
catch { }
}
CacheDirectoryService.ClearCacheDirectory(Settings.Default.TempPath, out _);
CacheDirectoryService.ClearCacheDirectory(Path.GetTempPath(), out _);
}
}

Expand Down

0 comments on commit 173e56b

Please sign in to comment.