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