mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
Make PluginBase a singleton.
This commit is contained in:
Submodule Aaru.CommonTypes updated: d603dca1ad...b2afea72c8
@@ -51,7 +51,7 @@ public static class Filesystems
|
|||||||
public static void Identify(IMediaImage imagePlugin, out List<string> idPlugins, Partition partition,
|
public static void Identify(IMediaImage imagePlugin, out List<string> idPlugins, Partition partition,
|
||||||
bool getGuid = false)
|
bool getGuid = false)
|
||||||
{
|
{
|
||||||
PluginBase plugins = GetPluginBase.Instance;
|
PluginBase plugins = PluginBase.Singleton;
|
||||||
|
|
||||||
idPlugins = new List<string>();
|
idPlugins = new List<string>();
|
||||||
|
|
||||||
|
|||||||
@@ -1,66 +0,0 @@
|
|||||||
// /***************************************************************************
|
|
||||||
// Aaru Data Preservation Suite
|
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
//
|
|
||||||
// Filename : ImageFormat.cs
|
|
||||||
// Author(s) : Natalia Portillo <claunia@claunia.com>
|
|
||||||
//
|
|
||||||
// Component : Core algorithms.
|
|
||||||
//
|
|
||||||
// --[ Description ] ----------------------------------------------------------
|
|
||||||
//
|
|
||||||
// Gets a new instance of all known plugins.
|
|
||||||
//
|
|
||||||
// --[ License ] --------------------------------------------------------------
|
|
||||||
//
|
|
||||||
// This program is free software: you can redistribute it and/or modify
|
|
||||||
// it under the terms of the GNU General Public License as
|
|
||||||
// published by the Free Software Foundation, either version 3 of the
|
|
||||||
// License, or (at your option) any later version.
|
|
||||||
//
|
|
||||||
// This program is distributed in the hope that it will be useful,
|
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
// GNU General Public License for more details.
|
|
||||||
//
|
|
||||||
// You should have received a copy of the GNU General Public License
|
|
||||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
//
|
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
// Copyright © 2011-2023 Natalia Portillo
|
|
||||||
// ****************************************************************************/
|
|
||||||
|
|
||||||
using Aaru.Checksums;
|
|
||||||
using Aaru.CommonTypes;
|
|
||||||
using Aaru.CommonTypes.Interfaces;
|
|
||||||
|
|
||||||
namespace Aaru.Core;
|
|
||||||
|
|
||||||
/// <summary>Plugin base operations</summary>
|
|
||||||
public static class GetPluginBase
|
|
||||||
{
|
|
||||||
/// <summary>Gets an instance with all the known plugins</summary>
|
|
||||||
public static PluginBase Instance
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
var instance = new PluginBase();
|
|
||||||
|
|
||||||
IPluginRegister checksumRegister = new Register();
|
|
||||||
IPluginRegister imagesRegister = new DiscImages.Register();
|
|
||||||
IPluginRegister filesystemsRegister = new Aaru.Filesystems.Register();
|
|
||||||
IPluginRegister filtersRegister = new Filters.Register();
|
|
||||||
IPluginRegister partitionsRegister = new Aaru.Partitions.Register();
|
|
||||||
IPluginRegister archiveRegister = new Archives.Register();
|
|
||||||
|
|
||||||
instance.AddPlugins(checksumRegister);
|
|
||||||
instance.AddPlugins(imagesRegister);
|
|
||||||
instance.AddPlugins(filesystemsRegister);
|
|
||||||
instance.AddPlugins(filtersRegister);
|
|
||||||
instance.AddPlugins(partitionsRegister);
|
|
||||||
instance.AddPlugins(archiveRegister);
|
|
||||||
|
|
||||||
return instance;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -31,7 +31,6 @@
|
|||||||
// ****************************************************************************/
|
// ****************************************************************************/
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using Aaru.CommonTypes;
|
|
||||||
using Aaru.CommonTypes.Interfaces;
|
using Aaru.CommonTypes.Interfaces;
|
||||||
using Aaru.Console;
|
using Aaru.Console;
|
||||||
|
|
||||||
@@ -47,7 +46,7 @@ public static class ImageFormat
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
PluginBase plugins = GetPluginBase.Instance;
|
PluginBase plugins = PluginBase.Singleton;
|
||||||
|
|
||||||
IBaseImage imageFormat = null;
|
IBaseImage imageFormat = null;
|
||||||
|
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ public static class Partitions
|
|||||||
/// <returns>List of found partitions</returns>
|
/// <returns>List of found partitions</returns>
|
||||||
public static List<Partition> GetAll(IMediaImage image)
|
public static List<Partition> GetAll(IMediaImage image)
|
||||||
{
|
{
|
||||||
PluginBase plugins = GetPluginBase.Instance;
|
PluginBase plugins = PluginBase.Singleton;
|
||||||
List<Partition> foundPartitions = new();
|
List<Partition> foundPartitions = new();
|
||||||
List<Partition> childPartitions = new();
|
List<Partition> childPartitions = new();
|
||||||
List<ulong> checkedLocations = new();
|
List<ulong> checkedLocations = new();
|
||||||
|
|||||||
163
Aaru.Core/PluginBase.cs
Normal file
163
Aaru.Core/PluginBase.cs
Normal file
@@ -0,0 +1,163 @@
|
|||||||
|
// /***************************************************************************
|
||||||
|
// Aaru Data Preservation Suite
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
//
|
||||||
|
// Filename : PluginBase.cs
|
||||||
|
// Author(s) : Natalia Portillo <claunia@claunia.com>
|
||||||
|
//
|
||||||
|
// Component : Core algorithms.
|
||||||
|
//
|
||||||
|
// --[ Description ] ----------------------------------------------------------
|
||||||
|
//
|
||||||
|
// Gets lists of all known plugins.
|
||||||
|
//
|
||||||
|
// --[ License ] --------------------------------------------------------------
|
||||||
|
//
|
||||||
|
// This program is free software: you can redistribute it and/or modify
|
||||||
|
// it under the terms of the GNU General Public License as
|
||||||
|
// published by the Free Software Foundation, either version 3 of the
|
||||||
|
// License, or (at your option) any later version.
|
||||||
|
//
|
||||||
|
// This program is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
// GNU General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU General Public License
|
||||||
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
//
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
// Copyright © 2011-2023 Natalia Portillo
|
||||||
|
// ****************************************************************************/
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using Aaru.Checksums;
|
||||||
|
using Aaru.CommonTypes.Interfaces;
|
||||||
|
|
||||||
|
namespace Aaru.Core;
|
||||||
|
|
||||||
|
/// <summary>Plugin base operations</summary>
|
||||||
|
public sealed class PluginBase
|
||||||
|
{
|
||||||
|
static PluginBase _instance;
|
||||||
|
|
||||||
|
/// <summary>List of all archive formats</summary>
|
||||||
|
public readonly SortedDictionary<string, Type> Archives;
|
||||||
|
/// <summary>List of byte addressable image plugins</summary>
|
||||||
|
public readonly SortedDictionary<string, Type> ByteAddressableImages;
|
||||||
|
/// <summary>List of all filesystem plugins</summary>
|
||||||
|
public readonly SortedDictionary<string, Type> Filesystems;
|
||||||
|
/// <summary>List of filter plugins</summary>
|
||||||
|
public readonly SortedDictionary<string, Type> Filters;
|
||||||
|
/// <summary>List of floppy image plugins</summary>
|
||||||
|
public readonly SortedDictionary<string, Type> FloppyImages;
|
||||||
|
/// <summary>List of all media image plugins</summary>
|
||||||
|
public readonly SortedDictionary<string, Type> MediaImages;
|
||||||
|
/// <summary>List of all partition plugins</summary>
|
||||||
|
public readonly SortedDictionary<string, Type> Partitions;
|
||||||
|
/// <summary>List of read-only filesystem plugins</summary>
|
||||||
|
public readonly SortedDictionary<string, Type> ReadOnlyFilesystems;
|
||||||
|
/// <summary>List of writable floppy image plugins</summary>
|
||||||
|
public readonly SortedDictionary<string, Type> WritableFloppyImages;
|
||||||
|
/// <summary>List of writable media image plugins</summary>
|
||||||
|
public readonly SortedDictionary<string, Type> WritableImages;
|
||||||
|
|
||||||
|
PluginBase()
|
||||||
|
{
|
||||||
|
Filesystems = new SortedDictionary<string, Type>();
|
||||||
|
ReadOnlyFilesystems = new SortedDictionary<string, Type>();
|
||||||
|
Partitions = new SortedDictionary<string, Type>();
|
||||||
|
MediaImages = new SortedDictionary<string, Type>();
|
||||||
|
WritableImages = new SortedDictionary<string, Type>();
|
||||||
|
Filters = new SortedDictionary<string, Type>();
|
||||||
|
FloppyImages = new SortedDictionary<string, Type>();
|
||||||
|
WritableFloppyImages = new SortedDictionary<string, Type>();
|
||||||
|
Archives = new SortedDictionary<string, Type>();
|
||||||
|
ByteAddressableImages = new SortedDictionary<string, Type>();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>Gets a singleton with all the known plugins</summary>
|
||||||
|
public static PluginBase Singleton
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if(_instance != null)
|
||||||
|
return _instance;
|
||||||
|
|
||||||
|
_instance = new PluginBase();
|
||||||
|
|
||||||
|
IPluginRegister checksumRegister = new Register();
|
||||||
|
IPluginRegister imagesRegister = new DiscImages.Register();
|
||||||
|
IPluginRegister filesystemsRegister = new Aaru.Filesystems.Register();
|
||||||
|
IPluginRegister filtersRegister = new Filters.Register();
|
||||||
|
IPluginRegister partitionsRegister = new Aaru.Partitions.Register();
|
||||||
|
IPluginRegister archiveRegister = new Archives.Register();
|
||||||
|
|
||||||
|
_instance.AddPlugins(checksumRegister);
|
||||||
|
_instance.AddPlugins(imagesRegister);
|
||||||
|
_instance.AddPlugins(filesystemsRegister);
|
||||||
|
_instance.AddPlugins(filtersRegister);
|
||||||
|
_instance.AddPlugins(partitionsRegister);
|
||||||
|
_instance.AddPlugins(archiveRegister);
|
||||||
|
|
||||||
|
return _instance;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>Adds plugins to the central plugin register</summary>
|
||||||
|
/// <param name="pluginRegister">Plugin register</param>
|
||||||
|
void AddPlugins(IPluginRegister pluginRegister)
|
||||||
|
{
|
||||||
|
foreach(Type type in pluginRegister.GetAllFilesystemPlugins() ?? Enumerable.Empty<Type>())
|
||||||
|
if(Activator.CreateInstance(type) is IFilesystem plugin &&
|
||||||
|
!Filesystems.ContainsKey(plugin.Name.ToLower()))
|
||||||
|
Filesystems.Add(plugin.Name.ToLower(), type);
|
||||||
|
|
||||||
|
foreach(Type type in pluginRegister.GetAllFilterPlugins() ?? Enumerable.Empty<Type>())
|
||||||
|
if(Activator.CreateInstance(type) is IFilter plugin &&
|
||||||
|
!Filters.ContainsKey(plugin.Name.ToLower()))
|
||||||
|
Filters.Add(plugin.Name.ToLower(), type);
|
||||||
|
|
||||||
|
foreach(Type type in pluginRegister.GetAllFloppyImagePlugins() ?? Enumerable.Empty<Type>())
|
||||||
|
if(Activator.CreateInstance(type) is IFloppyImage plugin &&
|
||||||
|
!FloppyImages.ContainsKey(plugin.Name.ToLower()))
|
||||||
|
FloppyImages.Add(plugin.Name.ToLower(), type);
|
||||||
|
|
||||||
|
foreach(Type type in pluginRegister.GetAllMediaImagePlugins() ?? Enumerable.Empty<Type>())
|
||||||
|
if(Activator.CreateInstance(type) is IMediaImage plugin &&
|
||||||
|
!MediaImages.ContainsKey(plugin.Name.ToLower()))
|
||||||
|
MediaImages.Add(plugin.Name.ToLower(), type);
|
||||||
|
|
||||||
|
foreach(Type type in pluginRegister.GetAllPartitionPlugins() ?? Enumerable.Empty<Type>())
|
||||||
|
if(Activator.CreateInstance(type) is IPartition plugin &&
|
||||||
|
!Partitions.ContainsKey(plugin.Name.ToLower()))
|
||||||
|
Partitions.Add(plugin.Name.ToLower(), type);
|
||||||
|
|
||||||
|
foreach(Type type in pluginRegister.GetAllReadOnlyFilesystemPlugins() ?? Enumerable.Empty<Type>())
|
||||||
|
if(Activator.CreateInstance(type) is IReadOnlyFilesystem plugin &&
|
||||||
|
!ReadOnlyFilesystems.ContainsKey(plugin.Name.ToLower()))
|
||||||
|
ReadOnlyFilesystems.Add(plugin.Name.ToLower(), type);
|
||||||
|
|
||||||
|
foreach(Type type in pluginRegister.GetAllWritableFloppyImagePlugins() ?? Enumerable.Empty<Type>())
|
||||||
|
if(Activator.CreateInstance(type) is IWritableFloppyImage plugin &&
|
||||||
|
!WritableFloppyImages.ContainsKey(plugin.Name.ToLower()))
|
||||||
|
WritableFloppyImages.Add(plugin.Name.ToLower(), type);
|
||||||
|
|
||||||
|
foreach(Type type in pluginRegister.GetAllWritableImagePlugins() ?? Enumerable.Empty<Type>())
|
||||||
|
if(Activator.CreateInstance(type) is IBaseWritableImage plugin &&
|
||||||
|
!WritableImages.ContainsKey(plugin.Name.ToLower()))
|
||||||
|
WritableImages.Add(plugin.Name.ToLower(), type);
|
||||||
|
|
||||||
|
foreach(Type type in pluginRegister.GetAllArchivePlugins() ?? Enumerable.Empty<Type>())
|
||||||
|
if(Activator.CreateInstance(type) is IArchive plugin &&
|
||||||
|
!Archives.ContainsKey(plugin.Name.ToLower()))
|
||||||
|
Archives.Add(plugin.Name.ToLower(), type);
|
||||||
|
|
||||||
|
foreach(Type type in pluginRegister.GetAllByteAddressablePlugins() ?? Enumerable.Empty<Type>())
|
||||||
|
if(Activator.CreateInstance(type) is IByteAddressableImage plugin &&
|
||||||
|
!ByteAddressableImages.ContainsKey(plugin.Name.ToLower()))
|
||||||
|
ByteAddressableImages.Add(plugin.Name.ToLower(), type);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -34,7 +34,6 @@ using System;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using Aaru.CommonTypes;
|
|
||||||
using Aaru.CommonTypes.AaruMetadata;
|
using Aaru.CommonTypes.AaruMetadata;
|
||||||
using Aaru.CommonTypes.Enums;
|
using Aaru.CommonTypes.Enums;
|
||||||
using Aaru.CommonTypes.Interfaces;
|
using Aaru.CommonTypes.Interfaces;
|
||||||
@@ -60,7 +59,7 @@ public sealed partial class Sidecar
|
|||||||
/// <summary>Initializes a new instance of this class</summary>
|
/// <summary>Initializes a new instance of this class</summary>
|
||||||
public Sidecar()
|
public Sidecar()
|
||||||
{
|
{
|
||||||
_plugins = GetPluginBase.Instance;
|
_plugins = PluginBase.Singleton;
|
||||||
_imgChkWorker = new Checksum();
|
_imgChkWorker = new Checksum();
|
||||||
_aborted = false;
|
_aborted = false;
|
||||||
|
|
||||||
@@ -80,7 +79,7 @@ public sealed partial class Sidecar
|
|||||||
_filterId = filterId;
|
_filterId = filterId;
|
||||||
_encoding = encoding;
|
_encoding = encoding;
|
||||||
_sidecar = image.AaruMetadata ?? new Metadata();
|
_sidecar = image.AaruMetadata ?? new Metadata();
|
||||||
_plugins = GetPluginBase.Instance;
|
_plugins = PluginBase.Singleton;
|
||||||
_fi = new FileInfo(imagePath);
|
_fi = new FileInfo(imagePath);
|
||||||
_fs = new FileStream(imagePath, FileMode.Open, FileAccess.Read);
|
_fs = new FileStream(imagePath, FileMode.Open, FileAccess.Read);
|
||||||
_imgChkWorker = new Checksum();
|
_imgChkWorker = new Checksum();
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ public sealed class PluginsViewModel : ViewModelBase
|
|||||||
CloseCommand = ReactiveCommand.Create(ExecuteCloseCommand);
|
CloseCommand = ReactiveCommand.Create(ExecuteCloseCommand);
|
||||||
|
|
||||||
// TODO: Takes too much time
|
// TODO: Takes too much time
|
||||||
foreach(Type filterType in GetPluginBase.Instance.Filters.Values)
|
foreach(Type filterType in PluginBase.Singleton.Filters.Values)
|
||||||
{
|
{
|
||||||
if(Activator.CreateInstance(filterType) is not IFilter filter)
|
if(Activator.CreateInstance(filterType) is not IFilter filter)
|
||||||
continue;
|
continue;
|
||||||
@@ -76,7 +76,7 @@ public sealed class PluginsViewModel : ViewModelBase
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach(Type imageType in GetPluginBase.Instance.FloppyImages.Values)
|
foreach(Type imageType in PluginBase.Singleton.FloppyImages.Values)
|
||||||
{
|
{
|
||||||
if(Activator.CreateInstance(imageType) is not IFloppyImage floppyImage)
|
if(Activator.CreateInstance(imageType) is not IFloppyImage floppyImage)
|
||||||
continue;
|
continue;
|
||||||
@@ -90,7 +90,7 @@ public sealed class PluginsViewModel : ViewModelBase
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach(Type imageType in GetPluginBase.Instance.MediaImages.Values)
|
foreach(Type imageType in PluginBase.Singleton.MediaImages.Values)
|
||||||
{
|
{
|
||||||
if(Activator.CreateInstance(imageType) is not IMediaImage mediaImage)
|
if(Activator.CreateInstance(imageType) is not IMediaImage mediaImage)
|
||||||
continue;
|
continue;
|
||||||
@@ -104,7 +104,7 @@ public sealed class PluginsViewModel : ViewModelBase
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach(Type partitionType in GetPluginBase.Instance.Partitions.Values)
|
foreach(Type partitionType in PluginBase.Singleton.Partitions.Values)
|
||||||
{
|
{
|
||||||
if(Activator.CreateInstance(partitionType) is not IPartition partition)
|
if(Activator.CreateInstance(partitionType) is not IPartition partition)
|
||||||
continue;
|
continue;
|
||||||
@@ -118,7 +118,7 @@ public sealed class PluginsViewModel : ViewModelBase
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach(Type filesystem in GetPluginBase.Instance.Filesystems.Values)
|
foreach(Type filesystem in PluginBase.Singleton.Filesystems.Values)
|
||||||
{
|
{
|
||||||
if(Activator.CreateInstance(filesystem) is not IFilesystem fs)
|
if(Activator.CreateInstance(filesystem) is not IFilesystem fs)
|
||||||
continue;
|
continue;
|
||||||
@@ -132,7 +132,7 @@ public sealed class PluginsViewModel : ViewModelBase
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach(Type readOnlyFilesystem in GetPluginBase.Instance.ReadOnlyFilesystems.Values)
|
foreach(Type readOnlyFilesystem in PluginBase.Singleton.ReadOnlyFilesystems.Values)
|
||||||
{
|
{
|
||||||
if(Activator.CreateInstance(readOnlyFilesystem) is not IReadOnlyFilesystem fs)
|
if(Activator.CreateInstance(readOnlyFilesystem) is not IReadOnlyFilesystem fs)
|
||||||
continue;
|
continue;
|
||||||
@@ -146,7 +146,7 @@ public sealed class PluginsViewModel : ViewModelBase
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach(Type imageType in GetPluginBase.Instance.WritableFloppyImages.Values)
|
foreach(Type imageType in PluginBase.Singleton.WritableFloppyImages.Values)
|
||||||
{
|
{
|
||||||
if(Activator.CreateInstance(imageType) is not IWritableFloppyImage writableFloppyImage)
|
if(Activator.CreateInstance(imageType) is not IWritableFloppyImage writableFloppyImage)
|
||||||
continue;
|
continue;
|
||||||
@@ -160,7 +160,7 @@ public sealed class PluginsViewModel : ViewModelBase
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach(Type baseWritableImageType in GetPluginBase.Instance.WritableImages.Values)
|
foreach(Type baseWritableImageType in PluginBase.Singleton.WritableImages.Values)
|
||||||
{
|
{
|
||||||
if(Activator.CreateInstance(baseWritableImageType) is not IWritableImage writableImage)
|
if(Activator.CreateInstance(baseWritableImageType) is not IWritableImage writableImage)
|
||||||
continue;
|
continue;
|
||||||
|
|||||||
@@ -41,7 +41,6 @@ using System.Text;
|
|||||||
using System.Text.Json;
|
using System.Text.Json;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Aaru.CommonTypes;
|
|
||||||
using Aaru.CommonTypes.AaruMetadata;
|
using Aaru.CommonTypes.AaruMetadata;
|
||||||
using Aaru.CommonTypes.Enums;
|
using Aaru.CommonTypes.Enums;
|
||||||
using Aaru.CommonTypes.Interfaces;
|
using Aaru.CommonTypes.Interfaces;
|
||||||
@@ -200,7 +199,7 @@ public sealed class ImageConvertViewModel : ViewModelBase
|
|||||||
DriveSerialNumberVisible = !string.IsNullOrWhiteSpace(inputFormat.Info.DriveSerialNumber);
|
DriveSerialNumberVisible = !string.IsNullOrWhiteSpace(inputFormat.Info.DriveSerialNumber);
|
||||||
DriveFirmwareRevisionVisible = !string.IsNullOrWhiteSpace(inputFormat.Info.DriveFirmwareRevision);
|
DriveFirmwareRevisionVisible = !string.IsNullOrWhiteSpace(inputFormat.Info.DriveFirmwareRevision);
|
||||||
|
|
||||||
PluginBase plugins = GetPluginBase.Instance;
|
PluginBase plugins = PluginBase.Singleton;
|
||||||
|
|
||||||
foreach(Type pluginType in plugins.WritableImages.Values)
|
foreach(Type pluginType in plugins.WritableImages.Values)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -594,7 +594,7 @@ public sealed class MainWindowViewModel : ViewModelBase
|
|||||||
bool checkRaw = false;
|
bool checkRaw = false;
|
||||||
List<string> idPlugins;
|
List<string> idPlugins;
|
||||||
Type pluginType;
|
Type pluginType;
|
||||||
PluginBase plugins = GetPluginBase.Instance;
|
PluginBase plugins = PluginBase.Singleton;
|
||||||
|
|
||||||
if(partitions.Count == 0)
|
if(partitions.Count == 0)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -42,7 +42,6 @@ using System.Text.Json;
|
|||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Xml.Serialization;
|
using System.Xml.Serialization;
|
||||||
using Aaru.CommonTypes;
|
|
||||||
using Aaru.CommonTypes.AaruMetadata;
|
using Aaru.CommonTypes.AaruMetadata;
|
||||||
using Aaru.CommonTypes.Enums;
|
using Aaru.CommonTypes.Enums;
|
||||||
using Aaru.CommonTypes.Interfaces;
|
using Aaru.CommonTypes.Interfaces;
|
||||||
@@ -166,7 +165,7 @@ public sealed class MediaDumpViewModel : ViewModelBase
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
PluginBase plugins = GetPluginBase.Instance;
|
PluginBase plugins = PluginBase.Singleton;
|
||||||
|
|
||||||
foreach(Type pluginType in plugins.WritableImages.Values)
|
foreach(Type pluginType in plugins.WritableImages.Values)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -133,7 +133,7 @@ public abstract class BlockMediaImageTest : BaseMediaImageTest
|
|||||||
public void Contents()
|
public void Contents()
|
||||||
{
|
{
|
||||||
Environment.CurrentDirectory = DataFolder;
|
Environment.CurrentDirectory = DataFolder;
|
||||||
PluginBase plugins = GetPluginBase.Instance;
|
PluginBase plugins = PluginBase.Singleton;
|
||||||
|
|
||||||
Assert.Multiple(() =>
|
Assert.Multiple(() =>
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -187,7 +187,7 @@ public abstract class OpticalMediaImageTest : BaseMediaImageTest
|
|||||||
|
|
||||||
for(int i = 0; i < track.FileSystems.Length; i++)
|
for(int i = 0; i < track.FileSystems.Length; i++)
|
||||||
{
|
{
|
||||||
PluginBase plugins = GetPluginBase.Instance;
|
PluginBase plugins = PluginBase.Singleton;
|
||||||
bool found = plugins.Filesystems.TryGetValue(idPlugins[i], out Type pluginType);
|
bool found = plugins.Filesystems.TryGetValue(idPlugins[i], out Type pluginType);
|
||||||
|
|
||||||
// ReSharper disable once ConditionIsAlwaysTrueOrFalse
|
// ReSharper disable once ConditionIsAlwaysTrueOrFalse
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ public abstract class FsExtractHashIssueTest
|
|||||||
if(Encoding != null)
|
if(Encoding != null)
|
||||||
encodingClass = Claunia.Encoding.Encoding.GetEncoding(Encoding);
|
encodingClass = Claunia.Encoding.Encoding.GetEncoding(Encoding);
|
||||||
|
|
||||||
PluginBase plugins = GetPluginBase.Instance;
|
PluginBase plugins = PluginBase.Singleton;
|
||||||
|
|
||||||
var imageFormat = ImageFormat.Detect(inputFilter) as IMediaImage;
|
var imageFormat = ImageFormat.Detect(inputFilter) as IMediaImage;
|
||||||
|
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ public abstract class FsExtractIssueTest
|
|||||||
if(Encoding != null)
|
if(Encoding != null)
|
||||||
encodingClass = Claunia.Encoding.Encoding.GetEncoding(Encoding);
|
encodingClass = Claunia.Encoding.Encoding.GetEncoding(Encoding);
|
||||||
|
|
||||||
PluginBase plugins = GetPluginBase.Instance;
|
PluginBase plugins = PluginBase.Singleton;
|
||||||
|
|
||||||
var imageFormat = ImageFormat.Detect(inputFilter) as IMediaImage;
|
var imageFormat = ImageFormat.Detect(inputFilter) as IMediaImage;
|
||||||
|
|
||||||
|
|||||||
@@ -174,7 +174,7 @@ sealed class ExtractFilesCommand : Command
|
|||||||
return (int)ErrorNumber.EncodingUnknown;
|
return (int)ErrorNumber.EncodingUnknown;
|
||||||
}
|
}
|
||||||
|
|
||||||
PluginBase plugins = GetPluginBase.Instance;
|
PluginBase plugins = PluginBase.Singleton;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -146,7 +146,7 @@ sealed class FilesystemInfoCommand : Command
|
|||||||
return (int)ErrorNumber.EncodingUnknown;
|
return (int)ErrorNumber.EncodingUnknown;
|
||||||
}
|
}
|
||||||
|
|
||||||
PluginBase plugins = GetPluginBase.Instance;
|
PluginBase plugins = PluginBase.Singleton;
|
||||||
|
|
||||||
bool checkRaw = false;
|
bool checkRaw = false;
|
||||||
|
|
||||||
|
|||||||
@@ -162,7 +162,7 @@ sealed class LsCommand : Command
|
|||||||
return (int)ErrorNumber.EncodingUnknown;
|
return (int)ErrorNumber.EncodingUnknown;
|
||||||
}
|
}
|
||||||
|
|
||||||
PluginBase plugins = GetPluginBase.Instance;
|
PluginBase plugins = PluginBase.Singleton;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -35,7 +35,6 @@ using System.Collections.Generic;
|
|||||||
using System.CommandLine;
|
using System.CommandLine;
|
||||||
using System.CommandLine.NamingConventionBinder;
|
using System.CommandLine.NamingConventionBinder;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Aaru.CommonTypes;
|
|
||||||
using Aaru.CommonTypes.Enums;
|
using Aaru.CommonTypes.Enums;
|
||||||
using Aaru.CommonTypes.Interfaces;
|
using Aaru.CommonTypes.Interfaces;
|
||||||
using Aaru.Console;
|
using Aaru.Console;
|
||||||
@@ -84,7 +83,7 @@ sealed class ListOptionsCommand : Command
|
|||||||
AaruConsole.DebugWriteLine("List-Options command", "--verbose={0}", verbose);
|
AaruConsole.DebugWriteLine("List-Options command", "--verbose={0}", verbose);
|
||||||
Statistics.AddCommand("list-options");
|
Statistics.AddCommand("list-options");
|
||||||
|
|
||||||
PluginBase plugins = GetPluginBase.Instance;
|
PluginBase plugins = PluginBase.Singleton;
|
||||||
|
|
||||||
AaruConsole.WriteLine(UI.Read_only_filesystems_options);
|
AaruConsole.WriteLine(UI.Read_only_filesystems_options);
|
||||||
|
|
||||||
|
|||||||
@@ -84,7 +84,7 @@ sealed class FormatsCommand : Command
|
|||||||
AaruConsole.DebugWriteLine("Formats command", "--debug={0}", debug);
|
AaruConsole.DebugWriteLine("Formats command", "--debug={0}", debug);
|
||||||
AaruConsole.DebugWriteLine("Formats command", "--verbose={0}", verbose);
|
AaruConsole.DebugWriteLine("Formats command", "--verbose={0}", verbose);
|
||||||
|
|
||||||
PluginBase plugins = GetPluginBase.Instance;
|
PluginBase plugins = PluginBase.Singleton;
|
||||||
var filtersList = new FiltersList();
|
var filtersList = new FiltersList();
|
||||||
|
|
||||||
Table table = new()
|
Table table = new()
|
||||||
|
|||||||
@@ -432,7 +432,7 @@ sealed class ConvertImageCommand : Command
|
|||||||
return (int)ErrorNumber.FileExists;
|
return (int)ErrorNumber.FileExists;
|
||||||
}
|
}
|
||||||
|
|
||||||
PluginBase plugins = GetPluginBase.Instance;
|
PluginBase plugins = PluginBase.Singleton;
|
||||||
IMediaImage inputFormat = null;
|
IMediaImage inputFormat = null;
|
||||||
IBaseImage baseImage = null;
|
IBaseImage baseImage = null;
|
||||||
|
|
||||||
|
|||||||
@@ -35,7 +35,6 @@ using System.Collections.Generic;
|
|||||||
using System.CommandLine;
|
using System.CommandLine;
|
||||||
using System.CommandLine.NamingConventionBinder;
|
using System.CommandLine.NamingConventionBinder;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Aaru.CommonTypes;
|
|
||||||
using Aaru.CommonTypes.Enums;
|
using Aaru.CommonTypes.Enums;
|
||||||
using Aaru.CommonTypes.Interfaces;
|
using Aaru.CommonTypes.Interfaces;
|
||||||
using Aaru.Console;
|
using Aaru.Console;
|
||||||
@@ -84,7 +83,7 @@ sealed class ListOptionsCommand : Command
|
|||||||
AaruConsole.DebugWriteLine("List-Options command", "--verbose={0}", verbose);
|
AaruConsole.DebugWriteLine("List-Options command", "--verbose={0}", verbose);
|
||||||
Statistics.AddCommand("list-options");
|
Statistics.AddCommand("list-options");
|
||||||
|
|
||||||
PluginBase plugins = GetPluginBase.Instance;
|
PluginBase plugins = PluginBase.Singleton;
|
||||||
|
|
||||||
AaruConsole.WriteLine(UI.Read_Write_media_images_options);
|
AaruConsole.WriteLine(UI.Read_Write_media_images_options);
|
||||||
|
|
||||||
|
|||||||
@@ -35,7 +35,6 @@ using System.Collections.Generic;
|
|||||||
using System.CommandLine;
|
using System.CommandLine;
|
||||||
using System.CommandLine.NamingConventionBinder;
|
using System.CommandLine.NamingConventionBinder;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Aaru.CommonTypes;
|
|
||||||
using Aaru.CommonTypes.Enums;
|
using Aaru.CommonTypes.Enums;
|
||||||
using Aaru.CommonTypes.Interfaces;
|
using Aaru.CommonTypes.Interfaces;
|
||||||
using Aaru.Console;
|
using Aaru.Console;
|
||||||
@@ -83,7 +82,7 @@ sealed class ListNamespacesCommand : Command
|
|||||||
AaruConsole.DebugWriteLine("List-Namespaces command", "--verbose={0}", verbose);
|
AaruConsole.DebugWriteLine("List-Namespaces command", "--verbose={0}", verbose);
|
||||||
Statistics.AddCommand("list-namespaces");
|
Statistics.AddCommand("list-namespaces");
|
||||||
|
|
||||||
PluginBase plugins = GetPluginBase.Instance;
|
PluginBase plugins = PluginBase.Singleton;
|
||||||
|
|
||||||
foreach(KeyValuePair<string, Type> kvp in plugins.ReadOnlyFilesystems)
|
foreach(KeyValuePair<string, Type> kvp in plugins.ReadOnlyFilesystems)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -42,7 +42,6 @@ using System.Text;
|
|||||||
using System.Text.Json;
|
using System.Text.Json;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Xml.Serialization;
|
using System.Xml.Serialization;
|
||||||
using Aaru.CommonTypes;
|
|
||||||
using Aaru.CommonTypes.AaruMetadata;
|
using Aaru.CommonTypes.AaruMetadata;
|
||||||
using Aaru.CommonTypes.Enums;
|
using Aaru.CommonTypes.Enums;
|
||||||
using Aaru.CommonTypes.Interfaces;
|
using Aaru.CommonTypes.Interfaces;
|
||||||
@@ -364,7 +363,7 @@ sealed class DumpMediaCommand : Command
|
|||||||
if(isResponse)
|
if(isResponse)
|
||||||
eject = true;
|
eject = true;
|
||||||
|
|
||||||
PluginBase plugins = GetPluginBase.Instance;
|
PluginBase plugins = PluginBase.Singleton;
|
||||||
List<IBaseWritableImage> candidates = new();
|
List<IBaseWritableImage> candidates = new();
|
||||||
string extension = Path.GetExtension(outputPath);
|
string extension = Path.GetExtension(outputPath);
|
||||||
|
|
||||||
@@ -609,7 +608,7 @@ sealed class DumpMediaCommand : Command
|
|||||||
return (int)ErrorNumber.NoSuchFile;
|
return (int)ErrorNumber.NoSuchFile;
|
||||||
}
|
}
|
||||||
|
|
||||||
plugins = GetPluginBase.Instance;
|
plugins = PluginBase.Singleton;
|
||||||
candidates = new List<IBaseWritableImage>();
|
candidates = new List<IBaseWritableImage>();
|
||||||
|
|
||||||
// Try extension
|
// Try extension
|
||||||
|
|||||||
Reference in New Issue
Block a user