mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
Use Type for writable media image plugin list.
This commit is contained in:
@@ -145,9 +145,9 @@ public sealed class PluginsViewModel : ViewModelBase
|
||||
Author = writableFloppyImage.Author
|
||||
});
|
||||
|
||||
foreach(IBaseWritableImage baseWritableImage in GetPluginBase.Instance.WritableImages.Values)
|
||||
foreach(Type baseWritableImageType in GetPluginBase.Instance.WritableImages.Values)
|
||||
{
|
||||
if(baseWritableImage is not IWritableImage writableImage)
|
||||
if(Activator.CreateInstance(baseWritableImageType) is not IWritableImage writableImage)
|
||||
continue;
|
||||
|
||||
WritableImages.Add(new PluginModel
|
||||
|
||||
@@ -202,14 +202,17 @@ public sealed class ImageConvertViewModel : ViewModelBase
|
||||
|
||||
PluginBase plugins = GetPluginBase.Instance;
|
||||
|
||||
foreach(IWritableImage plugin in plugins.WritableImages.Values.
|
||||
Where(p => p.SupportedMediaTypes.Contains(inputFormat.Info.MediaType)).
|
||||
Select(baseWritableImage => baseWritableImage as IWritableImage).
|
||||
Where(plugin => plugin is not null))
|
||||
PluginsList.Add(new ImagePluginModel
|
||||
{
|
||||
Plugin = plugin
|
||||
});
|
||||
foreach(Type pluginType in plugins.WritableImages.Values)
|
||||
{
|
||||
if(Activator.CreateInstance(pluginType) is not IWritableImage plugin)
|
||||
continue;
|
||||
|
||||
if(plugin.SupportedMediaTypes.Contains(inputFormat.Info.MediaType))
|
||||
PluginsList.Add(new ImagePluginModel
|
||||
{
|
||||
Plugin = plugin
|
||||
});
|
||||
}
|
||||
|
||||
AaruMetadataFromImageVisible = inputFormat.AaruMetadata != null;
|
||||
ResumeFileFromImageVisible = inputFormat.DumpHardware?.Any() == true;
|
||||
|
||||
@@ -168,12 +168,17 @@ public sealed class MediaDumpViewModel : ViewModelBase
|
||||
|
||||
PluginBase plugins = GetPluginBase.Instance;
|
||||
|
||||
foreach(IWritableImage plugin in
|
||||
plugins.WritableImages.Values.Where(p => p.SupportedMediaTypes.Contains(mediaType)))
|
||||
PluginsList.Add(new ImagePluginModel
|
||||
{
|
||||
Plugin = plugin
|
||||
});
|
||||
foreach(Type pluginType in plugins.WritableImages.Values)
|
||||
{
|
||||
if(Activator.CreateInstance(pluginType) is not IWritableImage plugin)
|
||||
continue;
|
||||
|
||||
if(plugin.SupportedMediaTypes.Contains(mediaType))
|
||||
PluginsList.Add(new ImagePluginModel
|
||||
{
|
||||
Plugin = plugin
|
||||
});
|
||||
}
|
||||
|
||||
Encodings.AddRange(Encoding.GetEncodings().Select(info => new EncodingModel
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user