mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
[Plugin system] Move filesystems to dependency injection.
This commit is contained in:
@@ -118,17 +118,17 @@ public sealed class PluginsViewModel : ViewModelBase
|
||||
});
|
||||
}
|
||||
|
||||
foreach(Type filesystem in PluginRegister.Singleton.Filesystems.Values)
|
||||
foreach(IFilesystem filesystem in PluginRegister.Singleton.Filesystems.Values)
|
||||
{
|
||||
if(Activator.CreateInstance(filesystem) is not IFilesystem fs)
|
||||
if(filesystem is null)
|
||||
continue;
|
||||
|
||||
Filesystems.Add(new PluginModel
|
||||
{
|
||||
Name = fs.Name,
|
||||
Uuid = fs.Id,
|
||||
Version = Assembly.GetAssembly(filesystem)?.GetName().Version?.ToString(),
|
||||
Author = fs.Author
|
||||
Name = filesystem.Name,
|
||||
Uuid = filesystem.Id,
|
||||
Version = Assembly.GetAssembly(filesystem.GetType())?.GetName().Version?.ToString(),
|
||||
Author = filesystem.Author
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -651,9 +651,9 @@ public sealed class MainWindowViewModel : ViewModelBase
|
||||
|
||||
foreach(string pluginName in idPlugins)
|
||||
{
|
||||
if(!plugins.Filesystems.TryGetValue(pluginName, out pluginType))
|
||||
if(!plugins.Filesystems.TryGetValue(pluginName, out IFilesystem fs))
|
||||
continue;
|
||||
if(Activator.CreateInstance(pluginType) is not IFilesystem fs)
|
||||
if(fs is null)
|
||||
continue;
|
||||
|
||||
fs.GetInformation(imageFormat, partition, null, out string information,
|
||||
@@ -726,9 +726,9 @@ public sealed class MainWindowViewModel : ViewModelBase
|
||||
|
||||
foreach(string pluginName in idPlugins)
|
||||
{
|
||||
if(!plugins.Filesystems.TryGetValue(pluginName, out pluginType))
|
||||
if(!plugins.Filesystems.TryGetValue(pluginName, out IFilesystem fs))
|
||||
continue;
|
||||
if(Activator.CreateInstance(pluginType) is not IFilesystem fs)
|
||||
if(fs is null)
|
||||
continue;
|
||||
|
||||
fs.GetInformation(imageFormat, wholePart, null, out string information,
|
||||
|
||||
Reference in New Issue
Block a user