mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
[TUI] Add filesystem information display in image window
This commit is contained in:
@@ -18,4 +18,5 @@ public class FileSystemModelNode
|
|||||||
public string Title { get; }
|
public string Title { get; }
|
||||||
public Partition? Partition { get; set; }
|
public Partition? Partition { get; set; }
|
||||||
public IFilesystem? Filesystem { get; set; }
|
public IFilesystem? Filesystem { get; set; }
|
||||||
|
public string? FilesystemInformation { get; set; }
|
||||||
}
|
}
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
using System.Collections.ObjectModel;
|
using System.Collections.ObjectModel;
|
||||||
|
using System.Text;
|
||||||
using System.Windows.Input;
|
using System.Windows.Input;
|
||||||
using Aaru.CommonTypes;
|
using Aaru.CommonTypes;
|
||||||
using Aaru.CommonTypes.Interfaces;
|
using Aaru.CommonTypes.Interfaces;
|
||||||
@@ -10,6 +11,7 @@ using CommunityToolkit.Mvvm.ComponentModel;
|
|||||||
using CommunityToolkit.Mvvm.Input;
|
using CommunityToolkit.Mvvm.Input;
|
||||||
using Humanizer;
|
using Humanizer;
|
||||||
using Humanizer.Bytes;
|
using Humanizer.Bytes;
|
||||||
|
using Partition = Aaru.CommonTypes.Partition;
|
||||||
|
|
||||||
namespace Aaru.Tui.ViewModels.Windows;
|
namespace Aaru.Tui.ViewModels.Windows;
|
||||||
|
|
||||||
@@ -21,6 +23,10 @@ public sealed partial class ImageWindowViewModel : ViewModelBase
|
|||||||
[ObservableProperty]
|
[ObservableProperty]
|
||||||
public string _filePath;
|
public string _filePath;
|
||||||
[ObservableProperty]
|
[ObservableProperty]
|
||||||
|
string _filesystemInformation;
|
||||||
|
[ObservableProperty]
|
||||||
|
bool _isFilesystemInformationVisible;
|
||||||
|
[ObservableProperty]
|
||||||
bool _isPartitionInformationVisible;
|
bool _isPartitionInformationVisible;
|
||||||
[ObservableProperty]
|
[ObservableProperty]
|
||||||
bool _isStatusVisible;
|
bool _isStatusVisible;
|
||||||
@@ -95,7 +101,18 @@ public sealed partial class ImageWindowViewModel : ViewModelBase
|
|||||||
else
|
else
|
||||||
IsPartitionInformationVisible = false;
|
IsPartitionInformationVisible = false;
|
||||||
|
|
||||||
|
if(_selectedNode.Filesystem is not null)
|
||||||
|
{
|
||||||
|
IsFilesystemInformationVisible = true;
|
||||||
|
FilesystemInformation = _selectedNode.FilesystemInformation ?? "";
|
||||||
|
|
||||||
|
OnPropertyChanged(nameof(FilesystemInformation));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
IsFilesystemInformationVisible = false;
|
||||||
|
|
||||||
OnPropertyChanged(nameof(IsPartitionInformationVisible));
|
OnPropertyChanged(nameof(IsPartitionInformationVisible));
|
||||||
|
OnPropertyChanged(nameof(IsFilesystemInformationVisible));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -167,6 +184,17 @@ public sealed partial class ImageWindowViewModel : ViewModelBase
|
|||||||
Filesystem = fs
|
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);
|
subNodes.Add(fsNode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -133,6 +133,25 @@
|
|||||||
</Grid>
|
</Grid>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</Border>
|
</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>
|
</Grid>
|
||||||
<TextBlock Grid.Row="2"
|
<TextBlock Grid.Row="2"
|
||||||
Text="{Binding Status, Mode=OneWay}"
|
Text="{Binding Status, Mode=OneWay}"
|
||||||
|
|||||||
Reference in New Issue
Block a user