Free, open-source Windows optimization tool for performance, privacy, and simplicity.
C# csharpdebloatdotnetgamingopen-sourceoptimizationoptimizeroptimizerduckperformanceprivacytweakertweakswindowswinui
feat: Implement sorting functionality for Disk Cleanup items by size, name, and path, and add `.gitattributes` configuration.
fatDuck6d7f6905af7a
diff --git a/.gitattributes b/.gitattributesnew file mode 100644index 0000000..176a458--- /dev/null+++ b/.gitattributes@@ -0,0 +1 @@+* text=autodiff --git a/optimizerDuck/Resources/Languages/Translations.resx b/optimizerDuck/Resources/Languages/Translations.resxindex 0a49a7c..6878d14 100644--- a/optimizerDuck/Resources/Languages/Translations.resx+++ b/optimizerDuck/Resources/Languages/Translations.resx@@ -973,6 +973,12 @@ Update now to enjoy the latest features, improvements, and bug fixes.</value><data name="Common.SortBy.Publisher" xml:space="preserve"><value>Publisher</value></data>+ <data name="Common.SortBy.Size" xml:space="preserve">+ <value>Size</value>+ </data>+ <data name="Common.SortBy.Path" xml:space="preserve">+ <value>Path</value>+ </data><data name="Optimizer.Menu.ApplyAllSafe" xml:space="preserve"><value>Apply All Safe</value></data>diff --git a/optimizerDuck/Resources/Languages/Translations.ru-RU.resx b/optimizerDuck/Resources/Languages/Translations.ru-RU.resxindex f4b0681..90f3c55 100644--- a/optimizerDuck/Resources/Languages/Translations.ru-RU.resx+++ b/optimizerDuck/Resources/Languages/Translations.ru-RU.resx@@ -973,6 +973,12 @@<data name="Common.SortBy.Publisher" xml:space="preserve"><value>Издатель</value></data>+ <data name="Common.SortBy.Size" xml:space="preserve">+ <value>Размер</value>+ </data>+ <data name="Common.SortBy.Path" xml:space="preserve">+ <value>Путь</value>+ </data><data name="Optimizer.Menu.ApplyAllSafe" xml:space="preserve"><value>Применить все безопасные</value></data>diff --git a/optimizerDuck/Resources/Languages/Translations.vi-VN.resx b/optimizerDuck/Resources/Languages/Translations.vi-VN.resxindex f4d2fce..6d5ac09 100644--- a/optimizerDuck/Resources/Languages/Translations.vi-VN.resx+++ b/optimizerDuck/Resources/Languages/Translations.vi-VN.resx@@ -973,6 +973,12 @@ Cập nhật ngay để trải nghiệm các tính năng mới, cải tiến và<data name="Common.SortBy.Publisher" xml:space="preserve"><value>Nhà phát hành</value></data>+ <data name="Common.SortBy.Size" xml:space="preserve">+ <value>Kích thước</value>+ </data>+ <data name="Common.SortBy.Path" xml:space="preserve">+ <value>Đường dẫn</value>+ </data><data name="Optimizer.Menu.ApplyAllSafe" xml:space="preserve"><value>Áp dụng tất cả an toàn</value></data>diff --git a/optimizerDuck/Resources/Languages/Translations.zh-Hans.resx b/optimizerDuck/Resources/Languages/Translations.zh-Hans.resxindex 801086d..5dd58d3 100644--- a/optimizerDuck/Resources/Languages/Translations.zh-Hans.resx+++ b/optimizerDuck/Resources/Languages/Translations.zh-Hans.resx@@ -898,6 +898,12 @@<data name="Common.SortBy.Publisher" xml:space="preserve"><value>发行商</value></data>+ <data name="Common.SortBy.Size" xml:space="preserve">+ <value>大小</value>+ </data>+ <data name="Common.SortBy.Path" xml:space="preserve">+ <value>路径</value>+ </data><data name="Common.SortBy" xml:space="preserve"><value>排序</value></data>diff --git a/optimizerDuck/UI/ViewModels/Pages/DiskCleanupViewModel.cs b/optimizerDuck/UI/ViewModels/Pages/DiskCleanupViewModel.csindex 585521b..6c5d6cc 100644--- a/optimizerDuck/UI/ViewModels/Pages/DiskCleanupViewModel.cs+++ b/optimizerDuck/UI/ViewModels/Pages/DiskCleanupViewModel.cs@@ -20,6 +20,13 @@ public partial class DiskCleanupViewModel([ObservableProperty] private bool _isScanning;[ObservableProperty] private bool _isCleaning;+ // Sort+ [ObservableProperty] private int _selectedSortByIndex; // 0=Default, 1=Size, 2=Name, 3=Path++ private List<CleanupItem> _originalOrder = [];++ partial void OnSelectedSortByIndexChanged(int value) => ApplySort();+public bool HasData => CleanupItems.Count > 0 && !IsLoading;public bool IsAllScanned => CleanupItems.Count > 0 && CleanupItems.All(i => i.IsScanned);public int SelectedCount => CleanupItems.Count(i => i.IsSelected);@@ -44,6 +51,7 @@ public partial class DiskCleanupViewModel({var items = diskCleanupService.GetCleanupItems();CleanupItems = new ObservableCollection<CleanupItem>(items);+ _originalOrder = [.. items];foreach (var item in CleanupItems){@@ -139,6 +147,24 @@ public partial class DiskCleanupViewModel(UpdateProperties();}+ private void ApplySort()+ {+ var sorted = SelectedSortByIndex switch+ {+ 1 => CleanupItems.OrderByDescending(i => i.SizeBytes).ToList(),+ 2 => CleanupItems.OrderBy(i => i.Name).ToList(),+ 3 => CleanupItems.OrderBy(i => i.Path).ToList(),+ _ => _originalOrder.ToList()+ };++ for (var i = 0; i < sorted.Count; i++)+ {+ var currentIndex = CleanupItems.IndexOf(sorted[i]);+ if (currentIndex != i)+ CleanupItems.Move(currentIndex, i);+ }+ }+private void UpdateProperties(){OnPropertyChanged(nameof(HasData));diff --git a/optimizerDuck/UI/Views/Pages/DiskCleanupPage.xaml b/optimizerDuck/UI/Views/Pages/DiskCleanupPage.xamlindex eac3b16..e3dc65f 100644--- a/optimizerDuck/UI/Views/Pages/DiskCleanupPage.xaml+++ b/optimizerDuck/UI/Views/Pages/DiskCleanupPage.xaml@@ -75,7 +75,7 @@<!-- Main content --><GridGrid.Row="1"- RowDefinitions="Auto,Auto,*"+ RowDefinitions="Auto,Auto,Auto,*"Visibility="{Binding ViewModel.HasData, Converter={StaticResource BooleanToVisibilityConverter}}"><!-- Summary card -->@@ -132,9 +132,30 @@</Grid></Border>+ <!-- Sort toolbar -->+ <WrapPanel+ Grid.Row="1"+ Margin="0,0,0,8"+ Orientation="Horizontal">++ <!-- Sort By -->+ <ComboBox+ Margin="0,0,8,0"+ SelectedIndex="{Binding ViewModel.SelectedSortByIndex}"+ ToolTip="{ext:Loc Common.SortBy}"+ ToolTipService.BetweenShowDelay="160"+ ToolTipService.Placement="Top"+ VerticalAlignment="Center">+ <ComboBoxItem Content="{ext:Loc Common.SortBy.Default}" />+ <ComboBoxItem Content="{ext:Loc Common.SortBy.Size}" />+ <ComboBoxItem Content="{ext:Loc Common.SortBy.Name}" />+ <ComboBoxItem Content="{ext:Loc Common.SortBy.Path}" />+ </ComboBox>+ </WrapPanel>+<!-- Action buttons --><StackPanel- Grid.Row="1"+ Grid.Row="2"Margin="0,0,0,12"Orientation="Horizontal">@@ -195,7 +216,7 @@</StackPanel><!-- Items list (virtualized) -->- <ui:VirtualizingItemsControl Grid.Row="2" ItemsSource="{Binding ViewModel.CleanupItems}">+ <ui:VirtualizingItemsControl Grid.Row="3" ItemsSource="{Binding ViewModel.CleanupItems}"><ui:VirtualizingItemsControl.Template><ControlTemplate TargetType="ItemsControl"><ScrollViewer HorizontalScrollBarVisibility="Disabled">