Skip to content

Free, open-source Windows optimization tool for performance, privacy, and simplicity.

feat: add duration calculation after freed space up in disk-cleanup

fatDuck5b260dfc6181
diff --git a/optimizerDuck/Resources/Languages/Translations.resx b/optimizerDuck/Resources/Languages/Translations.resx
index 1724aa1..dc5034b 100644
--- a/optimizerDuck/Resources/Languages/Translations.resx
+++ b/optimizerDuck/Resources/Languages/Translations.resx
@@ -1050,7 +1050,7 @@ Update now to enjoy the latest features, improvements, and bug fixes.</value>
<value>Cleanup Complete</value>
</data>
<data name="DiskCleanup.Complete.Message" xml:space="preserve">
- <value>Successfully freed {0} of disk space</value>
+ <value>Successfully freed {0} of disk space in {1}</value>
</data>
<data name="DiskCleanup.Error.Title" xml:space="preserve">
<value>Cleanup Error</value>
diff --git a/optimizerDuck/Resources/Languages/Translations.vi-VN.resx b/optimizerDuck/Resources/Languages/Translations.vi-VN.resx
index acc3324..4bd9b24 100644
--- a/optimizerDuck/Resources/Languages/Translations.vi-VN.resx
+++ b/optimizerDuck/Resources/Languages/Translations.vi-VN.resx
@@ -1050,7 +1050,7 @@ Cập nhật ngay để trải nghiệm các tính năng mới, cải tiến và
<value>Dọn dẹp hoàn tất</value>
</data>
<data name="DiskCleanup.Complete.Message" xml:space="preserve">
- <value>Đã giải phóng {0} dung lượng ổ đĩa</value>
+ <value>Đã giải phóng {0} dung lượng ổ đĩa trong {1}</value>
</data>
<data name="DiskCleanup.Error.Title" xml:space="preserve">
<value>Lỗi dọn dẹp</value>
diff --git a/optimizerDuck/UI/ViewModels/Pages/DiskCleanupViewModel.cs b/optimizerDuck/UI/ViewModels/Pages/DiskCleanupViewModel.cs
index d99c5b7..5b401fe 100644
--- a/optimizerDuck/UI/ViewModels/Pages/DiskCleanupViewModel.cs
+++ b/optimizerDuck/UI/ViewModels/Pages/DiskCleanupViewModel.cs
@@ -1,4 +1,5 @@
using System.Collections.ObjectModel;
+using System.Diagnostics;
using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
using Microsoft.Extensions.Logging;
@@ -110,7 +111,9 @@ public partial class DiskCleanupViewModel(
IsCleaning = true;
try
{
+ var sw = Stopwatch.StartNew();
var freedBytes = await diskCleanupService.CleanSelectedAsync(CleanupItems);
+ sw.Stop();
// Deselect all items after successful clean
foreach (var item in CleanupItems)
@@ -118,12 +121,12 @@ public partial class DiskCleanupViewModel(
snackbarService.Show(
Translations.DiskCleanup_Complete_Title,
- string.Format(Translations.DiskCleanup_Complete_Message, CleanupItem.FormatBytes(freedBytes)),
+ string.Format(Translations.DiskCleanup_Complete_Message, CleanupItem.FormatBytes(freedBytes), $"{sw.Elapsed.TotalSeconds:0.0}s"),
ControlAppearance.Success,
new SymbolIcon { Symbol = SymbolRegular.CheckmarkCircle24, Filled = true },
TimeSpan.FromSeconds(5));
- logger.LogInformation("Disk cleanup completed, freed {Size}", CleanupItem.FormatBytes(freedBytes));
+ logger.LogInformation("Disk cleanup completed, freed {Size} in {Duration}", CleanupItem.FormatBytes(freedBytes), sw.Elapsed);
}
catch (Exception ex)
{