diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index e00c9fa..ae6afbc 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -28,7 +28,7 @@ jobs: RUNNER_TEMP: ${{ runner.temp }} GITHUB_WORKSPACE: ${{ github.workspace }} - name: Publish binaries - run: gh release upload 'v1.0.1' "${{ env.RUNNER_TEMP }}\\build.zip" --clobber + run: gh release upload 'v1.0.2' "${{ env.RUNNER_TEMP }}\\build.zip" --clobber env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} RUNNER_TEMP: ${{ runner.temp }} \ No newline at end of file diff --git a/FolderSize/FolderInfo.cs b/FolderSize/FolderInfo.cs index 0714ac2..5cb26a4 100644 --- a/FolderSize/FolderInfo.cs +++ b/FolderSize/FolderInfo.cs @@ -87,9 +87,8 @@ await Task.WhenAll(SubFolders.Select(async f => OnPropertyChanged(nameof(DisplayTick)); }, token.Token); } - catch (Exception ex) + catch { - Debug.WriteLine(ex.Message); Task = Task.CompletedTask; } } diff --git a/FolderSize/MainWindow.xaml b/FolderSize/MainWindow.xaml index 013cda6..5337bce 100644 --- a/FolderSize/MainWindow.xaml +++ b/FolderSize/MainWindow.xaml @@ -58,6 +58,7 @@ + ✔️ diff --git a/FolderSize/MainWindow.xaml.cs b/FolderSize/MainWindow.xaml.cs index 425b56a..1a07bc7 100644 --- a/FolderSize/MainWindow.xaml.cs +++ b/FolderSize/MainWindow.xaml.cs @@ -17,7 +17,6 @@ namespace FolderSize { - public partial class MainWindow : Window, IDisposable { private FolderInfo _folderInfo; @@ -27,14 +26,17 @@ public partial class MainWindow : Window, IDisposable public MainWindow() { InitializeComponent(); - GatherData(); + DriveInfo + .GetDrives() + .Select(d => new ComboBoxItem{Content = $"{d.Name} ({FileSizeFormatter.FormatSize(d.TotalSize)})", Tag = d.Name, IsSelected = d.Name==@"C:\"}) + .ToList() + .ForEach(i => Drives.Items.Add(i)); } - private void GatherData() + private void GatherData(string path) { _cancellationTokenSource = new CancellationTokenSource(); - var path = @"C:\"; - + var rootFolderInfo = new FolderInfo(path, _dictionary, new TokenBox(_cancellationTokenSource.Token)); UpdateBinding(rootFolderInfo); @@ -68,16 +70,20 @@ private void FolderUp_OnClick(object sender, RoutedEventArgs e) } private void Refresh_OnClick(object sender, RoutedEventArgs e) + { + ClearAllData(); + GatherData((Drives.SelectedItem as ComboBoxItem)?.Tag?.ToString()??@"C:\"); + } + + private void ClearAllData() { _cancellationTokenSource?.Cancel(); _cancellationTokenSource?.Dispose(); - + UpdateBinding(null); - + _list.Clear(); _dictionary.Clear(); - - GatherData(); } public void Dispose() @@ -90,5 +96,11 @@ private void Explore_OnClick(object sender, RoutedEventArgs e) { Process.Start("explorer.exe", _folderInfo?.Name ?? @"C:\"); } + + private void Drives_OnSelected(object sender, RoutedEventArgs e) + { + ClearAllData(); + GatherData(((sender as ComboBox)?.SelectedItem as ComboBoxItem)?.Tag?.ToString()??@"C:\"); + } } } \ No newline at end of file