[TUI] Add filesystem information display in image window

This commit is contained in:
2025-10-16 12:55:52 +01:00
parent 8f7ace0e36
commit bcb202fc75
3 changed files with 52 additions and 4 deletions

View File

@@ -14,8 +14,9 @@ public class FileSystemModelNode
SubNodes = subNodes;
}
public ObservableCollection<FileSystemModelNode>? SubNodes { get; set; }
public string Title { get; }
public Partition? Partition { get; set; }
public IFilesystem? Filesystem { get; set; }
public ObservableCollection<FileSystemModelNode>? SubNodes { get; set; }
public string Title { get; }
public Partition? Partition { get; set; }
public IFilesystem? Filesystem { get; set; }
public string? FilesystemInformation { get; set; }
}

View File

@@ -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);
}

View File

@@ -133,6 +133,25 @@
</Grid>
</StackPanel>
</Border>
<Border BorderThickness="1"
Grid.Column="1"
IsVisible="{Binding IsFilesystemInformationVisible, Mode=OneWay}">
<Border.BorderBrush>
<brushes:LineBrush LineStyle="DoubleLine"
Brush="Blue" />
</Border.BorderBrush>
<ScrollViewer>
<StackPanel>
<TextBlock Foreground="SlateBlue"
Text="Filesystem information"
HorizontalAlignment="Center" />
<TextBox Background="Transparent"
TextWrapping="Wrap"
Text="{Binding FilesystemInformation, Mode=OneWay}"
IsReadOnly="True" />
</StackPanel>
</ScrollViewer>
</Border>
</Grid>
<TextBlock Grid.Row="2"
Text="{Binding Status, Mode=OneWay}"