From bcb202fc7501b46e5fbe9425d9db615bf9018325 Mon Sep 17 00:00:00 2001 From: Natalia Portillo Date: Thu, 16 Oct 2025 12:55:52 +0100 Subject: [PATCH] [TUI] Add filesystem information display in image window --- Aaru.Tui/Models/FileSystemModelNode.cs | 9 +++--- .../Windows/ImageWindowViewModel.cs | 28 +++++++++++++++++++ Aaru.Tui/Views/Windows/ImageWindow.axaml | 19 +++++++++++++ 3 files changed, 52 insertions(+), 4 deletions(-) diff --git a/Aaru.Tui/Models/FileSystemModelNode.cs b/Aaru.Tui/Models/FileSystemModelNode.cs index 8d5707469..595d78651 100644 --- a/Aaru.Tui/Models/FileSystemModelNode.cs +++ b/Aaru.Tui/Models/FileSystemModelNode.cs @@ -14,8 +14,9 @@ public class FileSystemModelNode SubNodes = subNodes; } - public ObservableCollection? SubNodes { get; set; } - public string Title { get; } - public Partition? Partition { get; set; } - public IFilesystem? Filesystem { get; set; } + public ObservableCollection? SubNodes { get; set; } + public string Title { get; } + public Partition? Partition { get; set; } + public IFilesystem? Filesystem { get; set; } + public string? FilesystemInformation { get; set; } } \ No newline at end of file diff --git a/Aaru.Tui/ViewModels/Windows/ImageWindowViewModel.cs b/Aaru.Tui/ViewModels/Windows/ImageWindowViewModel.cs index f18a7b09a..65b0655ff 100644 --- a/Aaru.Tui/ViewModels/Windows/ImageWindowViewModel.cs +++ b/Aaru.Tui/ViewModels/Windows/ImageWindowViewModel.cs @@ -1,4 +1,5 @@ using System.Collections.ObjectModel; +using System.Text; using System.Windows.Input; using Aaru.CommonTypes; using Aaru.CommonTypes.Interfaces; @@ -10,6 +11,7 @@ using CommunityToolkit.Mvvm.ComponentModel; using CommunityToolkit.Mvvm.Input; using Humanizer; using Humanizer.Bytes; +using Partition = Aaru.CommonTypes.Partition; namespace Aaru.Tui.ViewModels.Windows; @@ -21,6 +23,10 @@ public sealed partial class ImageWindowViewModel : ViewModelBase [ObservableProperty] public string _filePath; [ObservableProperty] + string _filesystemInformation; + [ObservableProperty] + bool _isFilesystemInformationVisible; + [ObservableProperty] bool _isPartitionInformationVisible; [ObservableProperty] bool _isStatusVisible; @@ -95,7 +101,18 @@ public sealed partial class ImageWindowViewModel : ViewModelBase else IsPartitionInformationVisible = false; + if(_selectedNode.Filesystem is not null) + { + IsFilesystemInformationVisible = true; + FilesystemInformation = _selectedNode.FilesystemInformation ?? ""; + + OnPropertyChanged(nameof(FilesystemInformation)); + } + else + IsFilesystemInformationVisible = false; + OnPropertyChanged(nameof(IsPartitionInformationVisible)); + OnPropertyChanged(nameof(IsFilesystemInformationVisible)); } } @@ -167,6 +184,17 @@ public sealed partial class ImageWindowViewModel : ViewModelBase Filesystem = fs }; + try + { + fs.GetInformation(_imageFormat, partition, Encoding.ASCII, out string? information, out _); + + fsNode.FilesystemInformation = information; + } + catch(Exception ex) + { + SentrySdk.CaptureException(ex); + } + subNodes.Add(fsNode); } diff --git a/Aaru.Tui/Views/Windows/ImageWindow.axaml b/Aaru.Tui/Views/Windows/ImageWindow.axaml index a3d928dc8..556ef9654 100644 --- a/Aaru.Tui/Views/Windows/ImageWindow.axaml +++ b/Aaru.Tui/Views/Windows/ImageWindow.axaml @@ -133,6 +133,25 @@ + + + + + + + + + + +