mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
[TUI] Detect filesystems.
This commit is contained in:
@@ -15,6 +15,7 @@ public sealed partial class ImageWindowViewModel : ViewModelBase
|
||||
{
|
||||
readonly string _filename;
|
||||
readonly IMediaImage _imageFormat;
|
||||
readonly Window _parent;
|
||||
readonly Window _view;
|
||||
[ObservableProperty]
|
||||
bool _isStatusVisible;
|
||||
@@ -23,11 +24,12 @@ public sealed partial class ImageWindowViewModel : ViewModelBase
|
||||
[ObservableProperty]
|
||||
string? _status;
|
||||
|
||||
public ImageWindowViewModel(Window view, IMediaImage imageFormat, string filename)
|
||||
public ImageWindowViewModel(Window parent, Window view, IMediaImage imageFormat, string filename)
|
||||
{
|
||||
_imageFormat = imageFormat;
|
||||
_filename = filename;
|
||||
_view = view;
|
||||
_parent = parent;
|
||||
|
||||
ExitCommand = new RelayCommand(Exit);
|
||||
BackCommand = new RelayCommand(Back);
|
||||
@@ -38,6 +40,7 @@ public sealed partial class ImageWindowViewModel : ViewModelBase
|
||||
|
||||
void Back()
|
||||
{
|
||||
_parent.Show();
|
||||
_view.Close();
|
||||
}
|
||||
|
||||
@@ -73,6 +76,10 @@ public sealed partial class ImageWindowViewModel : ViewModelBase
|
||||
|
||||
var sequence = 0;
|
||||
|
||||
Status = "Loading filesystems...";
|
||||
|
||||
PluginRegister plugins = PluginRegister.Singleton;
|
||||
|
||||
foreach(Partition partition in partitionsList)
|
||||
{
|
||||
var node = new FileSystemModelNode(partition.Name ?? $"Partition {sequence}")
|
||||
@@ -80,6 +87,25 @@ public sealed partial class ImageWindowViewModel : ViewModelBase
|
||||
Partition = partition
|
||||
};
|
||||
|
||||
Core.Filesystems.Identify(_imageFormat, out List<string>? idPlugins, partition);
|
||||
|
||||
if(idPlugins.Count > 0)
|
||||
{
|
||||
var subNodes = new ObservableCollection<FileSystemModelNode>();
|
||||
|
||||
foreach(string pluginName in idPlugins)
|
||||
{
|
||||
if(!plugins.Filesystems.TryGetValue(pluginName, out IFilesystem? fs)) continue;
|
||||
if(fs is null) continue;
|
||||
|
||||
var fsNode = new FileSystemModelNode(fs.Name);
|
||||
fsNode.Filesystem = fs;
|
||||
subNodes.Add(fsNode);
|
||||
}
|
||||
|
||||
node.SubNodes = subNodes;
|
||||
}
|
||||
|
||||
Nodes.Add(node);
|
||||
sequence++;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user