diff --git a/Interfaces/IPluginRegister.cs b/Interfaces/IPluginRegister.cs
index 73f24303a..8c415aaf7 100644
--- a/Interfaces/IPluginRegister.cs
+++ b/Interfaces/IPluginRegister.cs
@@ -89,9 +89,11 @@ public interface IPluginRegister
/// List of writable media image plugins
List GetAllWritableImagePlugins();
- /// Gets all archive plugins
- /// List of archive plugins
- List GetAllArchivePlugins();
+ ///
+ /// Registers all archive plugins in the provided service collection
+ ///
+ /// Service collection
+ void RegisterArchivePlugins(IServiceCollection services);
/// Gets all byte addressable plugins
/// List of byte addressable plugins
diff --git a/PluginRegister.cs b/PluginRegister.cs
index 4b90bd716..d5bc7557c 100644
--- a/PluginRegister.cs
+++ b/PluginRegister.cs
@@ -43,8 +43,7 @@ namespace Aaru.CommonTypes;
public class PluginRegister
{
static PluginRegister _instance;
- /// List of all archive formats
- public readonly SortedDictionary Archives;
+
/// List of byte addressable image plugins
public readonly SortedDictionary ByteAddressableImages;
/// List of all filesystem plugins
@@ -72,10 +71,22 @@ public class PluginRegister
WritableImages = new SortedDictionary();
FloppyImages = new SortedDictionary();
WritableFloppyImages = new SortedDictionary();
- Archives = new SortedDictionary();
ByteAddressableImages = new SortedDictionary();
}
+ /// List of all archive formats
+ public SortedDictionary Archives
+ {
+ get
+ {
+ SortedDictionary archives = new();
+ foreach(IArchive plugin in _serviceProvider.GetServices())
+ archives.Add(plugin.Name.ToLower(), plugin);
+
+ return archives;
+ }
+ }
+
/// List of all partition plugins
public SortedDictionary Partitions
{
@@ -199,11 +210,7 @@ public class PluginRegister
WritableImages.Add(plugin.Name.ToLower(), type);
}
- foreach(Type type in pluginRegister.GetAllArchivePlugins() ?? Enumerable.Empty())
- {
- if(Activator.CreateInstance(type) is IArchive plugin && !Archives.ContainsKey(plugin.Name.ToLower()))
- Archives.Add(plugin.Name.ToLower(), type);
- }
+ pluginRegister.RegisterArchivePlugins(_services);
foreach(Type type in pluginRegister.GetAllByteAddressablePlugins() ?? Enumerable.Empty())
{