mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
Use Type for media image plugin list.
This commit is contained in:
Submodule Aaru.CommonTypes updated: 679d36b353...e0035dbda6
@@ -53,8 +53,14 @@ public static class ImageFormat
|
||||
IBaseImage imageFormat = null;
|
||||
|
||||
// Check all but RAW plugin
|
||||
foreach(IMediaImage imagePlugin in plugins.ImagePluginsList.Values.Where(imagePlugin =>
|
||||
imagePlugin.Id != new Guid("12345678-AAAA-BBBB-CCCC-123456789000")))
|
||||
foreach(Type pluginType in plugins.MediaImages.Values)
|
||||
{
|
||||
if(Activator.CreateInstance(pluginType) is not IMediaImage imagePlugin)
|
||||
continue;
|
||||
|
||||
if(imagePlugin.Id == new Guid("12345678-AAAA-BBBB-CCCC-123456789000"))
|
||||
continue;
|
||||
|
||||
try
|
||||
{
|
||||
AaruConsole.DebugWriteLine("Format detection", Localization.Core.Trying_plugin_0, imagePlugin.Name);
|
||||
@@ -71,6 +77,7 @@ public static class ImageFormat
|
||||
{
|
||||
// ignored
|
||||
}
|
||||
}
|
||||
|
||||
if(imageFormat != null)
|
||||
return imageFormat;
|
||||
@@ -99,8 +106,14 @@ public static class ImageFormat
|
||||
return imageFormat;
|
||||
|
||||
// Check only RAW plugin
|
||||
foreach(IMediaImage imagePlugin in plugins.ImagePluginsList.Values.Where(imagePlugin =>
|
||||
imagePlugin.Id == new Guid("12345678-AAAA-BBBB-CCCC-123456789000")))
|
||||
foreach(Type pluginType in plugins.MediaImages.Values)
|
||||
{
|
||||
if(Activator.CreateInstance(pluginType) is not IMediaImage imagePlugin)
|
||||
continue;
|
||||
|
||||
if(imagePlugin.Id != new Guid("12345678-AAAA-BBBB-CCCC-123456789000"))
|
||||
continue;
|
||||
|
||||
try
|
||||
{
|
||||
AaruConsole.DebugWriteLine("Format detection", Localization.Core.Trying_plugin_0, imagePlugin.Name);
|
||||
@@ -117,6 +130,7 @@ public static class ImageFormat
|
||||
{
|
||||
// ignored
|
||||
}
|
||||
}
|
||||
|
||||
// Still not recognized
|
||||
return imageFormat;
|
||||
|
||||
@@ -80,14 +80,19 @@ public sealed class PluginsViewModel : ViewModelBase
|
||||
Author = floppyImage.Author
|
||||
});
|
||||
|
||||
foreach(IMediaImage mediaImage in GetPluginBase.Instance.ImagePluginsList.Values)
|
||||
foreach(Type imageType in GetPluginBase.Instance.MediaImages.Values)
|
||||
{
|
||||
if(Activator.CreateInstance(imageType) is not IMediaImage mediaImage)
|
||||
continue;
|
||||
|
||||
Images.Add(new PluginModel
|
||||
{
|
||||
Name = mediaImage.Name,
|
||||
Uuid = mediaImage.Id,
|
||||
Version = Assembly.GetAssembly(mediaImage.GetType())?.GetName().Version?.ToString(),
|
||||
Version = Assembly.GetAssembly(imageType)?.GetName().Version?.ToString(),
|
||||
Author = mediaImage.Author
|
||||
});
|
||||
}
|
||||
|
||||
foreach(Type partitionType in GetPluginBase.Instance.Partitions.Values)
|
||||
{
|
||||
|
||||
@@ -110,9 +110,8 @@ sealed class FormatsCommand : Command
|
||||
table = new Table
|
||||
{
|
||||
Title = new TableTitle(string.Format(UI.Read_only_media_image_formats_0,
|
||||
plugins.ImagePluginsList.Count(t => !t.Value.GetType().GetInterfaces().
|
||||
Contains(typeof(
|
||||
IWritableImage)))))
|
||||
plugins.MediaImages.Count(t => !t.Value.GetInterfaces().
|
||||
Contains(typeof(IWritableImage)))))
|
||||
};
|
||||
|
||||
if(verbose)
|
||||
@@ -120,12 +119,17 @@ sealed class FormatsCommand : Command
|
||||
|
||||
table.AddColumn(UI.Title_Media_image_format);
|
||||
|
||||
foreach(KeyValuePair<string, IMediaImage> kvp in plugins.ImagePluginsList.Where(t => !t.Value.GetType().
|
||||
GetInterfaces().Contains(typeof(IWritableImage))))
|
||||
foreach(KeyValuePair<string, Type> kvp in plugins.MediaImages.Where(t => !t.Value.GetInterfaces().
|
||||
Contains(typeof(IWritableImage))))
|
||||
{
|
||||
if(Activator.CreateInstance(kvp.Value) is not IMediaImage imagePlugin)
|
||||
continue;
|
||||
|
||||
if(verbose)
|
||||
table.AddRow(kvp.Value.Id.ToString(), Markup.Escape(kvp.Value.Name));
|
||||
table.AddRow(imagePlugin.Id.ToString(), Markup.Escape(imagePlugin.Name));
|
||||
else
|
||||
table.AddRow(Markup.Escape(kvp.Value.Name));
|
||||
table.AddRow(Markup.Escape(imagePlugin.Name));
|
||||
}
|
||||
|
||||
AnsiConsole.Write(table);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user