mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
Move most of PluginBase logic into Aaru.Commontypes.
This commit is contained in:
Submodule Aaru.Checksums updated: 6cf148e849...7e91888aca
Submodule Aaru.CommonTypes updated: 50e0b8071f...d626697942
@@ -51,7 +51,8 @@ public static class Filesystems
|
||||
public static void Identify(IMediaImage imagePlugin, out List<string> idPlugins, Partition partition,
|
||||
bool getGuid = false)
|
||||
{
|
||||
PluginBase plugins = PluginBase.Singleton;
|
||||
PluginBase.Init();
|
||||
PluginRegister plugins = PluginRegister.Singleton;
|
||||
|
||||
idPlugins = new List<string>();
|
||||
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
// ****************************************************************************/
|
||||
|
||||
using System;
|
||||
using Aaru.CommonTypes;
|
||||
using Aaru.CommonTypes.Interfaces;
|
||||
using Aaru.Console;
|
||||
|
||||
@@ -48,7 +49,8 @@ public static class ImageFormat
|
||||
{
|
||||
try
|
||||
{
|
||||
PluginBase plugins = PluginBase.Singleton;
|
||||
PluginBase.Init();
|
||||
PluginRegister plugins = PluginRegister.Singleton;
|
||||
|
||||
IBaseImage imageFormat = null;
|
||||
|
||||
|
||||
@@ -50,7 +50,8 @@ public static class Partitions
|
||||
/// <returns>List of found partitions</returns>
|
||||
public static List<Partition> GetAll(IMediaImage image)
|
||||
{
|
||||
PluginBase plugins = PluginBase.Singleton;
|
||||
PluginBase.Init();
|
||||
PluginRegister plugins = PluginRegister.Singleton;
|
||||
List<Partition> foundPartitions = new();
|
||||
List<Partition> childPartitions = new();
|
||||
List<ulong> checkedLocations = new();
|
||||
|
||||
@@ -30,173 +30,28 @@
|
||||
// Copyright © 2011-2023 Natalia Portillo
|
||||
// ****************************************************************************/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
using Aaru.Checksums;
|
||||
using Aaru.CommonTypes;
|
||||
using Aaru.CommonTypes.Interfaces;
|
||||
using Aaru.DiscImages;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
|
||||
namespace Aaru.Core;
|
||||
|
||||
/// <summary>Plugin base operations</summary>
|
||||
[SuppressMessage("ReSharper", "UnusedMember.Global")]
|
||||
public sealed class PluginBase
|
||||
public static 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;
|
||||
IServiceProvider _serviceProvider;
|
||||
IServiceCollection _services;
|
||||
|
||||
PluginBase()
|
||||
public static void Init()
|
||||
{
|
||||
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>List of all checksums formats</summary>
|
||||
public SortedDictionary<string, IChecksum> Checksums
|
||||
{
|
||||
get
|
||||
PluginRegister.Singleton.InitPlugins(new List<IPluginRegister>
|
||||
{
|
||||
SortedDictionary<string, IChecksum> checksums = new();
|
||||
foreach(IChecksum plugin in _serviceProvider.GetServices<IChecksum>())
|
||||
checksums.Add(plugin.Name.ToLower(), plugin);
|
||||
|
||||
return checksums;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets a singleton with all the known plugins</summary>
|
||||
public static PluginBase Singleton
|
||||
{
|
||||
get
|
||||
{
|
||||
if(_instance != null)
|
||||
return _instance;
|
||||
|
||||
_instance = new PluginBase
|
||||
{
|
||||
_services = new ServiceCollection()
|
||||
};
|
||||
|
||||
IPluginRegister imagesRegister = new 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(new Checksums.Register());
|
||||
_instance.AddPlugins(imagesRegister);
|
||||
_instance.AddPlugins(filesystemsRegister);
|
||||
_instance.AddPlugins(filtersRegister);
|
||||
_instance.AddPlugins(partitionsRegister);
|
||||
_instance.AddPlugins(archiveRegister);
|
||||
|
||||
_instance._serviceProvider = _instance._services.BuildServiceProvider();
|
||||
|
||||
return _instance;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Adds plugins to the central plugin register</summary>
|
||||
/// <param name="pluginRegister">Plugin register</param>
|
||||
void AddPlugins(IPluginRegister pluginRegister)
|
||||
{
|
||||
pluginRegister.RegisterChecksumPlugins(_services);
|
||||
|
||||
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);
|
||||
}
|
||||
new Register(),
|
||||
new Filters.Register(),
|
||||
new DiscImages.Register(),
|
||||
new Aaru.Filesystems.Register(),
|
||||
new Aaru.Partitions.Register(),
|
||||
new Archives.Register()
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -34,6 +34,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using Aaru.CommonTypes;
|
||||
using Aaru.CommonTypes.AaruMetadata;
|
||||
using Aaru.CommonTypes.Interfaces;
|
||||
|
||||
@@ -53,7 +54,7 @@ public sealed partial class Sidecar
|
||||
/// <param name="imgChecksums">List of image checksums</param>
|
||||
/// <param name="sidecar">Metadata sidecar</param>
|
||||
/// <param name="encoding">Encoding to be used for filesystem plugins</param>
|
||||
static void AudioMedia(IBaseImage image, Guid filterId, string imagePath, FileInfo fi, PluginBase plugins,
|
||||
static void AudioMedia(IBaseImage image, Guid filterId, string imagePath, FileInfo fi, PluginRegister plugins,
|
||||
List<CommonTypes.AaruMetadata.Checksum> imgChecksums, ref Metadata sidecar,
|
||||
Encoding encoding)
|
||||
{
|
||||
|
||||
@@ -35,10 +35,10 @@ using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Aaru.CommonTypes;
|
||||
using Aaru.CommonTypes.AaruMetadata;
|
||||
using Aaru.CommonTypes.Enums;
|
||||
using Aaru.CommonTypes.Interfaces;
|
||||
using Aaru.CommonTypes.Metadata;
|
||||
using Aaru.CommonTypes.Structs.Devices.ATA;
|
||||
using Aaru.Console;
|
||||
using Aaru.Decoders.PCMCIA;
|
||||
@@ -47,10 +47,9 @@ using Aaru.Filters;
|
||||
using Aaru.Helpers;
|
||||
using Directory = System.IO.Directory;
|
||||
using File = System.IO.File;
|
||||
using MediaType = Aaru.CommonTypes.Metadata.MediaType;
|
||||
using Partition = Aaru.CommonTypes.Partition;
|
||||
using Pcmcia = Aaru.CommonTypes.AaruMetadata.Pcmcia;
|
||||
using Tuple = Aaru.Decoders.PCMCIA.Tuple;
|
||||
using Usb = Aaru.CommonTypes.AaruMetadata.Usb;
|
||||
|
||||
namespace Aaru.Core;
|
||||
|
||||
@@ -65,7 +64,7 @@ public sealed partial class Sidecar
|
||||
/// <param name="imgChecksums">List of image checksums</param>
|
||||
/// <param name="sidecar">Metadata sidecar</param>
|
||||
/// <param name="encoding">Encoding to be used for filesystem plugins</param>
|
||||
void BlockMedia(IMediaImage image, Guid filterId, string imagePath, FileInfo fi, PluginBase plugins,
|
||||
void BlockMedia(IMediaImage image, Guid filterId, string imagePath, FileInfo fi, PluginRegister plugins,
|
||||
List<CommonTypes.AaruMetadata.Checksum> imgChecksums, ref Metadata sidecar, Encoding encoding)
|
||||
{
|
||||
if(_aborted)
|
||||
|
||||
@@ -34,6 +34,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using Aaru.CommonTypes;
|
||||
using Aaru.CommonTypes.AaruMetadata;
|
||||
using Aaru.CommonTypes.Interfaces;
|
||||
|
||||
@@ -54,7 +55,7 @@ public sealed partial class Sidecar
|
||||
/// <param name="sidecar">Metadata sidecar</param>
|
||||
/// <param name="encoding">Encoding to be used for filesystem plugins</param>
|
||||
static void LinearMedia(IByteAddressableImage image, Guid filterId, string imagePath, FileInfo fi,
|
||||
PluginBase plugins, List<CommonTypes.AaruMetadata.Checksum> imgChecksums,
|
||||
PluginRegister plugins, List<CommonTypes.AaruMetadata.Checksum> imgChecksums,
|
||||
ref Metadata sidecar, Encoding encoding) => sidecar.LinearMedias = new List<LinearMedia>
|
||||
{
|
||||
new()
|
||||
|
||||
@@ -61,7 +61,7 @@ public sealed partial class Sidecar
|
||||
/// <param name="imgChecksums">List of image checksums</param>
|
||||
/// <param name="sidecar">Metadata sidecar</param>
|
||||
/// <param name="encoding">Encoding to be used for filesystem plugins</param>
|
||||
void OpticalDisc(IOpticalMediaImage image, Guid filterId, string imagePath, FileInfo fi, PluginBase plugins,
|
||||
void OpticalDisc(IOpticalMediaImage image, Guid filterId, string imagePath, FileInfo fi, PluginRegister plugins,
|
||||
List<CommonTypes.AaruMetadata.Checksum> imgChecksums, ref Metadata sidecar, Encoding encoding)
|
||||
{
|
||||
if(_aborted)
|
||||
|
||||
@@ -34,6 +34,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using Aaru.CommonTypes;
|
||||
using Aaru.CommonTypes.AaruMetadata;
|
||||
using Aaru.CommonTypes.Enums;
|
||||
using Aaru.CommonTypes.Interfaces;
|
||||
@@ -52,7 +53,7 @@ public sealed partial class Sidecar
|
||||
readonly IBaseImage _image;
|
||||
readonly string _imagePath;
|
||||
readonly Checksum _imgChkWorker;
|
||||
readonly PluginBase _plugins;
|
||||
readonly PluginRegister _plugins;
|
||||
bool _aborted;
|
||||
FileStream _fs;
|
||||
Metadata _sidecar;
|
||||
@@ -60,7 +61,8 @@ public sealed partial class Sidecar
|
||||
/// <summary>Initializes a new instance of this class</summary>
|
||||
public Sidecar()
|
||||
{
|
||||
_plugins = PluginBase.Singleton;
|
||||
PluginBase.Init();
|
||||
_plugins = PluginRegister.Singleton;
|
||||
_imgChkWorker = new Checksum();
|
||||
_aborted = false;
|
||||
|
||||
@@ -75,12 +77,14 @@ public sealed partial class Sidecar
|
||||
/// <param name="encoding">Encoding for analysis</param>
|
||||
public Sidecar(IBaseImage image, string imagePath, Guid filterId, Encoding encoding)
|
||||
{
|
||||
PluginBase.Init();
|
||||
|
||||
_image = image;
|
||||
_imagePath = imagePath;
|
||||
_filterId = filterId;
|
||||
_encoding = encoding;
|
||||
_sidecar = image.AaruMetadata ?? new Metadata();
|
||||
_plugins = PluginBase.Singleton;
|
||||
_plugins = PluginRegister.Singleton;
|
||||
_fi = new FileInfo(imagePath);
|
||||
_fs = new FileStream(imagePath, FileMode.Open, FileAccess.Read);
|
||||
_imgChkWorker = new Checksum();
|
||||
|
||||
@@ -34,6 +34,7 @@ using System;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Reactive;
|
||||
using System.Reflection;
|
||||
using Aaru.CommonTypes;
|
||||
using Aaru.CommonTypes.Interfaces;
|
||||
using Aaru.Core;
|
||||
using Aaru.Gui.Models;
|
||||
@@ -60,9 +61,10 @@ public sealed class PluginsViewModel : ViewModelBase
|
||||
FloppyImages = new ObservableCollection<PluginModel>();
|
||||
WritableFloppyImages = new ObservableCollection<PluginModel>();
|
||||
CloseCommand = ReactiveCommand.Create(ExecuteCloseCommand);
|
||||
PluginBase.Init();
|
||||
|
||||
// TODO: Takes too much time
|
||||
foreach(Type filterType in PluginBase.Singleton.Filters.Values)
|
||||
foreach(Type filterType in PluginRegister.Singleton.Filters.Values)
|
||||
{
|
||||
if(Activator.CreateInstance(filterType) is not IFilter filter)
|
||||
continue;
|
||||
@@ -76,7 +78,7 @@ public sealed class PluginsViewModel : ViewModelBase
|
||||
});
|
||||
}
|
||||
|
||||
foreach(Type imageType in PluginBase.Singleton.FloppyImages.Values)
|
||||
foreach(Type imageType in PluginRegister.Singleton.FloppyImages.Values)
|
||||
{
|
||||
if(Activator.CreateInstance(imageType) is not IFloppyImage floppyImage)
|
||||
continue;
|
||||
@@ -90,7 +92,7 @@ public sealed class PluginsViewModel : ViewModelBase
|
||||
});
|
||||
}
|
||||
|
||||
foreach(Type imageType in PluginBase.Singleton.MediaImages.Values)
|
||||
foreach(Type imageType in PluginRegister.Singleton.MediaImages.Values)
|
||||
{
|
||||
if(Activator.CreateInstance(imageType) is not IMediaImage mediaImage)
|
||||
continue;
|
||||
@@ -104,7 +106,7 @@ public sealed class PluginsViewModel : ViewModelBase
|
||||
});
|
||||
}
|
||||
|
||||
foreach(Type partitionType in PluginBase.Singleton.Partitions.Values)
|
||||
foreach(Type partitionType in PluginRegister.Singleton.Partitions.Values)
|
||||
{
|
||||
if(Activator.CreateInstance(partitionType) is not IPartition partition)
|
||||
continue;
|
||||
@@ -118,7 +120,7 @@ public sealed class PluginsViewModel : ViewModelBase
|
||||
});
|
||||
}
|
||||
|
||||
foreach(Type filesystem in PluginBase.Singleton.Filesystems.Values)
|
||||
foreach(Type filesystem in PluginRegister.Singleton.Filesystems.Values)
|
||||
{
|
||||
if(Activator.CreateInstance(filesystem) is not IFilesystem fs)
|
||||
continue;
|
||||
@@ -132,7 +134,7 @@ public sealed class PluginsViewModel : ViewModelBase
|
||||
});
|
||||
}
|
||||
|
||||
foreach(Type readOnlyFilesystem in PluginBase.Singleton.ReadOnlyFilesystems.Values)
|
||||
foreach(Type readOnlyFilesystem in PluginRegister.Singleton.ReadOnlyFilesystems.Values)
|
||||
{
|
||||
if(Activator.CreateInstance(readOnlyFilesystem) is not IReadOnlyFilesystem fs)
|
||||
continue;
|
||||
@@ -146,7 +148,7 @@ public sealed class PluginsViewModel : ViewModelBase
|
||||
});
|
||||
}
|
||||
|
||||
foreach(Type imageType in PluginBase.Singleton.WritableFloppyImages.Values)
|
||||
foreach(Type imageType in PluginRegister.Singleton.WritableFloppyImages.Values)
|
||||
{
|
||||
if(Activator.CreateInstance(imageType) is not IWritableFloppyImage writableFloppyImage)
|
||||
continue;
|
||||
@@ -160,7 +162,7 @@ public sealed class PluginsViewModel : ViewModelBase
|
||||
});
|
||||
}
|
||||
|
||||
foreach(Type baseWritableImageType in PluginBase.Singleton.WritableImages.Values)
|
||||
foreach(Type baseWritableImageType in PluginRegister.Singleton.WritableImages.Values)
|
||||
{
|
||||
if(Activator.CreateInstance(baseWritableImageType) is not IWritableImage writableImage)
|
||||
continue;
|
||||
|
||||
@@ -41,6 +41,7 @@ using System.Text;
|
||||
using System.Text.Json;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Aaru.CommonTypes;
|
||||
using Aaru.CommonTypes.AaruMetadata;
|
||||
using Aaru.CommonTypes.Enums;
|
||||
using Aaru.CommonTypes.Interfaces;
|
||||
@@ -172,7 +173,8 @@ public sealed class ImageConvertViewModel : ViewModelBase
|
||||
DriveSerialNumberVisible = !string.IsNullOrWhiteSpace(inputFormat.Info.DriveSerialNumber);
|
||||
DriveFirmwareRevisionVisible = !string.IsNullOrWhiteSpace(inputFormat.Info.DriveFirmwareRevision);
|
||||
|
||||
PluginBase plugins = PluginBase.Singleton;
|
||||
PluginBase.Init();
|
||||
PluginRegister plugins = PluginRegister.Singleton;
|
||||
|
||||
foreach(Type pluginType in plugins.WritableImages.Values)
|
||||
{
|
||||
@@ -1385,10 +1387,12 @@ public sealed class ImageConvertViewModel : ViewModelBase
|
||||
if(trackFlags.Count > 0)
|
||||
{
|
||||
foreach(KeyValuePair<byte, byte> flags in trackFlags)
|
||||
{
|
||||
outputOptical.WriteSectorTag(new[]
|
||||
{
|
||||
flags.Value
|
||||
}, flags.Key, SectorTagType.CdTrackFlags);
|
||||
}
|
||||
}
|
||||
|
||||
if(mcn != null)
|
||||
|
||||
@@ -609,7 +609,8 @@ public sealed class MainWindowViewModel : ViewModelBase
|
||||
var checkRaw = false;
|
||||
List<string> idPlugins;
|
||||
Type pluginType;
|
||||
PluginBase plugins = PluginBase.Singleton;
|
||||
PluginBase.Init();
|
||||
PluginRegister plugins = PluginRegister.Singleton;
|
||||
|
||||
if(partitions.Count == 0)
|
||||
{
|
||||
|
||||
@@ -42,6 +42,7 @@ using System.Text.Json;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Xml.Serialization;
|
||||
using Aaru.CommonTypes;
|
||||
using Aaru.CommonTypes.AaruMetadata;
|
||||
using Aaru.CommonTypes.Enums;
|
||||
using Aaru.CommonTypes.Interfaces;
|
||||
@@ -167,7 +168,8 @@ public sealed class MediaDumpViewModel : ViewModelBase
|
||||
}
|
||||
}
|
||||
|
||||
PluginBase plugins = PluginBase.Singleton;
|
||||
PluginBase.Init();
|
||||
PluginRegister plugins = PluginRegister.Singleton;
|
||||
|
||||
foreach(Type pluginType in plugins.WritableImages.Values)
|
||||
{
|
||||
|
||||
@@ -135,7 +135,8 @@ public abstract class BlockMediaImageTest : BaseMediaImageTest
|
||||
public void Contents()
|
||||
{
|
||||
Environment.CurrentDirectory = DataFolder;
|
||||
PluginBase plugins = PluginBase.Singleton;
|
||||
PluginBase.Init();
|
||||
PluginRegister plugins = PluginRegister.Singleton;
|
||||
|
||||
Assert.Multiple(() =>
|
||||
{
|
||||
|
||||
@@ -199,8 +199,9 @@ public abstract class OpticalMediaImageTest : BaseMediaImageTest
|
||||
|
||||
for(var i = 0; i < track.FileSystems.Length; i++)
|
||||
{
|
||||
PluginBase plugins = PluginBase.Singleton;
|
||||
bool found = plugins.Filesystems.TryGetValue(idPlugins[i], out Type pluginType);
|
||||
PluginBase.Init();
|
||||
PluginRegister plugins = PluginRegister.Singleton;
|
||||
bool found = plugins.Filesystems.TryGetValue(idPlugins[i], out Type pluginType);
|
||||
|
||||
// ReSharper disable once ConditionIsAlwaysTrueOrFalse
|
||||
// It is not the case, it changes
|
||||
|
||||
@@ -46,7 +46,8 @@ public abstract class FsExtractHashIssueTest
|
||||
if(Encoding != null)
|
||||
encodingClass = Claunia.Encoding.Encoding.GetEncoding(Encoding);
|
||||
|
||||
PluginBase plugins = PluginBase.Singleton;
|
||||
PluginBase.Init();
|
||||
PluginRegister plugins = PluginRegister.Singleton;
|
||||
|
||||
var imageFormat = ImageFormat.Detect(inputFilter) as IMediaImage;
|
||||
|
||||
|
||||
@@ -40,7 +40,8 @@ public abstract class FsExtractIssueTest
|
||||
if(Encoding != null)
|
||||
encodingClass = Claunia.Encoding.Encoding.GetEncoding(Encoding);
|
||||
|
||||
PluginBase plugins = PluginBase.Singleton;
|
||||
PluginBase.Init();
|
||||
PluginRegister plugins = PluginRegister.Singleton;
|
||||
|
||||
var imageFormat = ImageFormat.Detect(inputFilter) as IMediaImage;
|
||||
|
||||
|
||||
@@ -179,7 +179,8 @@ sealed class ExtractFilesCommand : Command
|
||||
}
|
||||
}
|
||||
|
||||
PluginBase plugins = PluginBase.Singleton;
|
||||
PluginBase.Init();
|
||||
PluginRegister plugins = PluginRegister.Singleton;
|
||||
|
||||
try
|
||||
{
|
||||
|
||||
@@ -154,7 +154,8 @@ sealed class FilesystemInfoCommand : Command
|
||||
}
|
||||
}
|
||||
|
||||
PluginBase plugins = PluginBase.Singleton;
|
||||
PluginBase.Init();
|
||||
PluginRegister plugins = PluginRegister.Singleton;
|
||||
|
||||
var checkRaw = false;
|
||||
|
||||
|
||||
@@ -168,7 +168,8 @@ sealed class LsCommand : Command
|
||||
}
|
||||
}
|
||||
|
||||
PluginBase plugins = PluginBase.Singleton;
|
||||
PluginBase.Init();
|
||||
PluginRegister plugins = PluginRegister.Singleton;
|
||||
|
||||
try
|
||||
{
|
||||
|
||||
@@ -35,6 +35,7 @@ using System.Collections.Generic;
|
||||
using System.CommandLine;
|
||||
using System.CommandLine.NamingConventionBinder;
|
||||
using System.Linq;
|
||||
using Aaru.CommonTypes;
|
||||
using Aaru.CommonTypes.Enums;
|
||||
using Aaru.CommonTypes.Interfaces;
|
||||
using Aaru.Console;
|
||||
@@ -87,7 +88,8 @@ sealed class ListOptionsCommand : Command
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--verbose={0}", verbose);
|
||||
Statistics.AddCommand("list-options");
|
||||
|
||||
PluginBase plugins = PluginBase.Singleton;
|
||||
PluginBase.Init();
|
||||
PluginRegister plugins = PluginRegister.Singleton;
|
||||
|
||||
AaruConsole.WriteLine(UI.Read_only_filesystems_options);
|
||||
|
||||
|
||||
@@ -88,8 +88,9 @@ sealed class FormatsCommand : Command
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--debug={0}", debug);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--verbose={0}", verbose);
|
||||
|
||||
PluginBase plugins = PluginBase.Singleton;
|
||||
var filtersList = new FiltersList();
|
||||
PluginBase.Init();
|
||||
PluginRegister plugins = PluginRegister.Singleton;
|
||||
var filtersList = new FiltersList();
|
||||
|
||||
Table table = new()
|
||||
{
|
||||
|
||||
@@ -449,9 +449,10 @@ sealed class ConvertImageCommand : Command
|
||||
return (int)ErrorNumber.FileExists;
|
||||
}
|
||||
|
||||
PluginBase plugins = PluginBase.Singleton;
|
||||
IMediaImage inputFormat = null;
|
||||
IBaseImage baseImage = null;
|
||||
PluginBase.Init();
|
||||
PluginRegister plugins = PluginRegister.Singleton;
|
||||
IMediaImage inputFormat = null;
|
||||
IBaseImage baseImage = null;
|
||||
|
||||
Core.Spectre.ProgressSingleSpinner(ctx =>
|
||||
{
|
||||
|
||||
@@ -35,6 +35,7 @@ using System.Collections.Generic;
|
||||
using System.CommandLine;
|
||||
using System.CommandLine.NamingConventionBinder;
|
||||
using System.Linq;
|
||||
using Aaru.CommonTypes;
|
||||
using Aaru.CommonTypes.Enums;
|
||||
using Aaru.CommonTypes.Interfaces;
|
||||
using Aaru.Console;
|
||||
@@ -87,7 +88,8 @@ sealed class ListOptionsCommand : Command
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--verbose={0}", verbose);
|
||||
Statistics.AddCommand("list-options");
|
||||
|
||||
PluginBase plugins = PluginBase.Singleton;
|
||||
PluginBase.Init();
|
||||
PluginRegister plugins = PluginRegister.Singleton;
|
||||
|
||||
AaruConsole.WriteLine(UI.Read_Write_media_images_options);
|
||||
|
||||
|
||||
@@ -35,6 +35,7 @@ using System.Collections.Generic;
|
||||
using System.CommandLine;
|
||||
using System.CommandLine.NamingConventionBinder;
|
||||
using System.Linq;
|
||||
using Aaru.CommonTypes;
|
||||
using Aaru.CommonTypes.Enums;
|
||||
using Aaru.CommonTypes.Interfaces;
|
||||
using Aaru.Console;
|
||||
@@ -86,7 +87,8 @@ sealed class ListNamespacesCommand : Command
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--verbose={0}", verbose);
|
||||
Statistics.AddCommand("list-namespaces");
|
||||
|
||||
PluginBase plugins = PluginBase.Singleton;
|
||||
PluginBase.Init();
|
||||
PluginRegister plugins = PluginRegister.Singleton;
|
||||
|
||||
foreach(KeyValuePair<string, Type> kvp in plugins.ReadOnlyFilesystems)
|
||||
{
|
||||
|
||||
@@ -42,6 +42,7 @@ using System.Text;
|
||||
using System.Text.Json;
|
||||
using System.Threading;
|
||||
using System.Xml.Serialization;
|
||||
using Aaru.CommonTypes;
|
||||
using Aaru.CommonTypes.AaruMetadata;
|
||||
using Aaru.CommonTypes.Enums;
|
||||
using Aaru.CommonTypes.Interfaces;
|
||||
@@ -369,7 +370,8 @@ sealed class DumpMediaCommand : Command
|
||||
if(isResponse)
|
||||
eject = true;
|
||||
|
||||
PluginBase plugins = PluginBase.Singleton;
|
||||
PluginBase.Init();
|
||||
PluginRegister plugins = PluginRegister.Singleton;
|
||||
List<IBaseWritableImage> candidates = new();
|
||||
string extension = Path.GetExtension(outputPath);
|
||||
|
||||
@@ -638,7 +640,7 @@ sealed class DumpMediaCommand : Command
|
||||
}
|
||||
}
|
||||
|
||||
plugins = PluginBase.Singleton;
|
||||
plugins = PluginRegister.Singleton;
|
||||
candidates = new List<IBaseWritableImage>();
|
||||
|
||||
// Try extension
|
||||
|
||||
Reference in New Issue
Block a user