diff --git a/Interfaces/IPluginRegister.cs b/Interfaces/IPluginRegister.cs
index f82f9d0..1d198f4 100644
--- a/Interfaces/IPluginRegister.cs
+++ b/Interfaces/IPluginRegister.cs
@@ -39,49 +39,52 @@
using System;
using System.Collections.Generic;
-namespace Aaru.CommonTypes.Interfaces
+namespace Aaru.CommonTypes.Interfaces;
+
+/// Defines a register of all known plugins
+public interface IPluginRegister
{
- /// Defines a register of all known plugins
- public interface IPluginRegister
- {
- /// Gets all checksum plugins
- /// List of checksum plugins
- List GetAllChecksumPlugins();
+ /// Gets all checksum plugins
+ /// List of checksum plugins
+ List GetAllChecksumPlugins();
- /// Gets all filesystem plugins
- /// List of filesystem plugins
- List GetAllFilesystemPlugins();
+ /// Gets all filesystem plugins
+ /// List of filesystem plugins
+ List GetAllFilesystemPlugins();
- /// Gets all filter plugins
- /// List of filter plugins
- List GetAllFilterPlugins();
+ /// Gets all filter plugins
+ /// List of filter plugins
+ List GetAllFilterPlugins();
- /// Gets all floppy image plugins
- /// List of floppy image plugins
- List GetAllFloppyImagePlugins();
+ /// Gets all floppy image plugins
+ /// List of floppy image plugins
+ List GetAllFloppyImagePlugins();
- /// Gets all media image plugins
- /// List of media image plugins
- List GetAllMediaImagePlugins();
+ /// Gets all media image plugins
+ /// List of media image plugins
+ List GetAllMediaImagePlugins();
- /// Gets all partition plugins
- /// List of partition plugins
- List GetAllPartitionPlugins();
+ /// Gets all partition plugins
+ /// List of partition plugins
+ List GetAllPartitionPlugins();
- /// Gets all read-only filesystem plugins
- /// List of read-only filesystem plugins
- List GetAllReadOnlyFilesystemPlugins();
+ /// Gets all read-only filesystem plugins
+ /// List of read-only filesystem plugins
+ List GetAllReadOnlyFilesystemPlugins();
- /// Gets all writable floppy image plugins
- /// List of writable floppy image plugins
- List GetAllWritableFloppyImagePlugins();
+ /// Gets all writable floppy image plugins
+ /// List of writable floppy image plugins
+ List GetAllWritableFloppyImagePlugins();
- /// Gets all writable media image plugins
- /// List of writable media image plugins
- List GetAllWritableImagePlugins();
+ /// Gets all writable media image plugins
+ /// List of writable media image plugins
+ List GetAllWritableImagePlugins();
- /// Gets all archive plugins
- /// List of archive plugins
- List GetAllArchivePlugins();
- }
+ /// Gets all archive plugins
+ /// List of archive plugins
+ List GetAllArchivePlugins();
+
+ /// Gets all byte addressable plugins
+ /// List of byte addressable plugins
+ List GetAllByteAddressablePlugins();
}
\ No newline at end of file
diff --git a/PluginBase.cs b/PluginBase.cs
index 2929db5..cfc2a8a 100644
--- a/PluginBase.cs
+++ b/PluginBase.cs
@@ -41,109 +41,117 @@ using System.Collections.Generic;
using System.Linq;
using Aaru.CommonTypes.Interfaces;
-namespace Aaru.CommonTypes
+namespace Aaru.CommonTypes;
+
+/// Contain all plugins (filesystem, partition and image)
+public class PluginBase
{
- /// Contain all plugins (filesystem, partition and image)
- public class PluginBase
+ /// List of all archive formats
+ public readonly SortedDictionary Archives;
+ /// List of byte addressable image plugins
+ public readonly SortedDictionary ByteAddressableImages;
+ /// List of checksum plugins
+ public readonly List Checksums;
+ /// List of filter plugins
+ public readonly SortedDictionary Filters;
+ /// List of floppy image plugins
+ public readonly SortedDictionary FloppyImages;
+ /// List of all media image plugins
+ public readonly SortedDictionary ImagePluginsList;
+ /// List of all partition plugins
+ public readonly SortedDictionary PartPluginsList;
+ /// List of all filesystem plugins
+ public readonly SortedDictionary PluginsList;
+ /// List of read-only filesystem plugins
+ public readonly SortedDictionary ReadOnlyFilesystems;
+ /// List of writable floppy image plugins
+ public readonly SortedDictionary WritableFloppyImages;
+ /// List of writable media image plugins
+ public readonly SortedDictionary WritableImages;
+
+ /// Initializes the plugins lists
+ public PluginBase()
{
- /// List of all archive formats
- public readonly SortedDictionary Archives;
- /// List of checksum plugins
- public readonly List Checksums;
- /// List of filter plugins
- public readonly SortedDictionary Filters;
- /// List of floppy image plugins
- public readonly SortedDictionary FloppyImages;
- /// List of all media image plugins
- public readonly SortedDictionary ImagePluginsList;
- /// List of all partition plugins
- public readonly SortedDictionary PartPluginsList;
- /// List of all filesystem plugins
- public readonly SortedDictionary PluginsList;
- /// List of read-only filesystem plugins
- public readonly SortedDictionary ReadOnlyFilesystems;
- /// List of writable floppy image plugins
- public readonly SortedDictionary WritableFloppyImages;
- /// List of writable media image plugins
- public readonly SortedDictionary WritableImages;
+ PluginsList = new SortedDictionary();
+ ReadOnlyFilesystems = new SortedDictionary();
+ PartPluginsList = new SortedDictionary();
+ ImagePluginsList = new SortedDictionary();
+ WritableImages = new SortedDictionary();
+ Checksums = new List();
+ Filters = new SortedDictionary();
+ FloppyImages = new SortedDictionary();
+ WritableFloppyImages = new SortedDictionary();
+ Archives = new SortedDictionary();
+ ByteAddressableImages = new SortedDictionary();
+ }
- /// Initializes the plugins lists
- public PluginBase()
- {
- PluginsList = new SortedDictionary();
- ReadOnlyFilesystems = new SortedDictionary();
- PartPluginsList = new SortedDictionary();
- ImagePluginsList = new SortedDictionary();
- WritableImages = new SortedDictionary();
- Checksums = new List();
- Filters = new SortedDictionary();
- FloppyImages = new SortedDictionary();
- WritableFloppyImages = new SortedDictionary();
- Archives = new SortedDictionary();
- }
+ /// Adds plugins to the central plugin register
+ /// Plugin register
+ public void AddPlugins(IPluginRegister pluginRegister)
+ {
+ foreach(Type type in pluginRegister.GetAllChecksumPlugins() ?? Enumerable.Empty())
+ if(type.GetConstructor(Type.EmptyTypes)?.Invoke(new object[]
+ {}) is IChecksum plugin)
+ Checksums.Add(plugin);
- /// Adds plugins to the central plugin register
- /// Plugin register
- public void AddPlugins(IPluginRegister pluginRegister)
- {
- foreach(Type type in pluginRegister.GetAllChecksumPlugins() ?? Enumerable.Empty())
- if(type.GetConstructor(Type.EmptyTypes)?.Invoke(new object[]
- {}) is IChecksum plugin)
- Checksums.Add(plugin);
+ foreach(Type type in pluginRegister.GetAllFilesystemPlugins() ?? Enumerable.Empty())
+ if(type.GetConstructor(Type.EmptyTypes)?.Invoke(new object[]
+ {}) is IFilesystem plugin &&
+ !PluginsList.ContainsKey(plugin.Name.ToLower()))
+ PluginsList.Add(plugin.Name.ToLower(), plugin);
- foreach(Type type in pluginRegister.GetAllFilesystemPlugins() ?? Enumerable.Empty())
- if(type.GetConstructor(Type.EmptyTypes)?.Invoke(new object[]
- {}) is IFilesystem plugin &&
- !PluginsList.ContainsKey(plugin.Name.ToLower()))
- PluginsList.Add(plugin.Name.ToLower(), plugin);
+ foreach(Type type in pluginRegister.GetAllFilterPlugins() ?? Enumerable.Empty())
+ if(type.GetConstructor(Type.EmptyTypes)?.Invoke(new object[]
+ {}) is IFilter plugin &&
+ !Filters.ContainsKey(plugin.Name.ToLower()))
+ Filters.Add(plugin.Name.ToLower(), plugin);
- foreach(Type type in pluginRegister.GetAllFilterPlugins() ?? Enumerable.Empty())
- if(type.GetConstructor(Type.EmptyTypes)?.Invoke(new object[]
- {}) is IFilter plugin &&
- !Filters.ContainsKey(plugin.Name.ToLower()))
- Filters.Add(plugin.Name.ToLower(), plugin);
+ foreach(Type type in pluginRegister.GetAllFloppyImagePlugins() ?? Enumerable.Empty())
+ if(type.GetConstructor(Type.EmptyTypes)?.Invoke(new object[]
+ {}) is IFloppyImage plugin &&
+ !FloppyImages.ContainsKey(plugin.Name.ToLower()))
+ FloppyImages.Add(plugin.Name.ToLower(), plugin);
- foreach(Type type in pluginRegister.GetAllFloppyImagePlugins() ?? Enumerable.Empty())
- if(type.GetConstructor(Type.EmptyTypes)?.Invoke(new object[]
- {}) is IFloppyImage plugin &&
- !FloppyImages.ContainsKey(plugin.Name.ToLower()))
- FloppyImages.Add(plugin.Name.ToLower(), plugin);
+ foreach(Type type in pluginRegister.GetAllMediaImagePlugins() ?? Enumerable.Empty())
+ if(type.GetConstructor(Type.EmptyTypes)?.Invoke(new object[]
+ {}) is IMediaImage plugin &&
+ !ImagePluginsList.ContainsKey(plugin.Name.ToLower()))
+ ImagePluginsList.Add(plugin.Name.ToLower(), plugin);
- foreach(Type type in pluginRegister.GetAllMediaImagePlugins() ?? Enumerable.Empty())
- if(type.GetConstructor(Type.EmptyTypes)?.Invoke(new object[]
- {}) is IMediaImage plugin &&
- !ImagePluginsList.ContainsKey(plugin.Name.ToLower()))
- ImagePluginsList.Add(plugin.Name.ToLower(), plugin);
+ foreach(Type type in pluginRegister.GetAllPartitionPlugins() ?? Enumerable.Empty())
+ if(type.GetConstructor(Type.EmptyTypes)?.Invoke(new object[]
+ {}) is IPartition plugin &&
+ !PartPluginsList.ContainsKey(plugin.Name.ToLower()))
+ PartPluginsList.Add(plugin.Name.ToLower(), plugin);
- foreach(Type type in pluginRegister.GetAllPartitionPlugins() ?? Enumerable.Empty())
- if(type.GetConstructor(Type.EmptyTypes)?.Invoke(new object[]
- {}) is IPartition plugin &&
- !PartPluginsList.ContainsKey(plugin.Name.ToLower()))
- PartPluginsList.Add(plugin.Name.ToLower(), plugin);
+ foreach(Type type in pluginRegister.GetAllReadOnlyFilesystemPlugins() ?? Enumerable.Empty())
+ if(type.GetConstructor(Type.EmptyTypes)?.Invoke(new object[]
+ {}) is IReadOnlyFilesystem plugin &&
+ !ReadOnlyFilesystems.ContainsKey(plugin.Name.ToLower()))
+ ReadOnlyFilesystems.Add(plugin.Name.ToLower(), plugin);
- foreach(Type type in pluginRegister.GetAllReadOnlyFilesystemPlugins() ?? Enumerable.Empty())
- if(type.GetConstructor(Type.EmptyTypes)?.Invoke(new object[]
- {}) is IReadOnlyFilesystem plugin &&
- !ReadOnlyFilesystems.ContainsKey(plugin.Name.ToLower()))
- ReadOnlyFilesystems.Add(plugin.Name.ToLower(), plugin);
+ foreach(Type type in pluginRegister.GetAllWritableFloppyImagePlugins() ?? Enumerable.Empty())
+ if(type.GetConstructor(Type.EmptyTypes)?.Invoke(new object[]
+ {}) is IWritableFloppyImage plugin &&
+ !WritableFloppyImages.ContainsKey(plugin.Name.ToLower()))
+ WritableFloppyImages.Add(plugin.Name.ToLower(), plugin);
- foreach(Type type in pluginRegister.GetAllWritableFloppyImagePlugins() ?? Enumerable.Empty())
- if(type.GetConstructor(Type.EmptyTypes)?.Invoke(new object[]
- {}) is IWritableFloppyImage plugin &&
- !WritableFloppyImages.ContainsKey(plugin.Name.ToLower()))
- WritableFloppyImages.Add(plugin.Name.ToLower(), plugin);
+ foreach(Type type in pluginRegister.GetAllWritableImagePlugins() ?? Enumerable.Empty())
+ if(type.GetConstructor(Type.EmptyTypes)?.Invoke(new object[]
+ {}) is IWritableImage plugin &&
+ !WritableImages.ContainsKey(plugin.Name.ToLower()))
+ WritableImages.Add(plugin.Name.ToLower(), plugin);
- foreach(Type type in pluginRegister.GetAllWritableImagePlugins() ?? Enumerable.Empty())
- if(type.GetConstructor(Type.EmptyTypes)?.Invoke(new object[]
- {}) is IWritableImage plugin &&
- !WritableImages.ContainsKey(plugin.Name.ToLower()))
- WritableImages.Add(plugin.Name.ToLower(), plugin);
+ foreach(Type type in pluginRegister.GetAllArchivePlugins() ?? Enumerable.Empty())
+ if(type.GetConstructor(Type.EmptyTypes)?.Invoke(new object[]
+ {}) is IArchive plugin &&
+ !Archives.ContainsKey(plugin.Name.ToLower()))
+ Archives.Add(plugin.Name.ToLower(), plugin);
- foreach(Type type in pluginRegister.GetAllArchivePlugins() ?? Enumerable.Empty())
- if(type.GetConstructor(Type.EmptyTypes)?.Invoke(new object[]
- {}) is IArchive plugin &&
- !Archives.ContainsKey(plugin.Name.ToLower()))
- Archives.Add(plugin.Name.ToLower(), plugin);
- }
+ foreach(Type type in pluginRegister.GetAllArchivePlugins() ?? Enumerable.Empty())
+ if(type.GetConstructor(Type.EmptyTypes)?.Invoke(new object[]
+ {}) is IByteAddressableImage plugin &&
+ !ByteAddressableImages.ContainsKey(plugin.Name.ToLower()))
+ ByteAddressableImages.Add(plugin.Name.ToLower(), plugin);
}
}
\ No newline at end of file