diff --git a/Aaru.CommonTypes.csproj b/Aaru.CommonTypes.csproj index 55e51fd..6d81687 100644 --- a/Aaru.CommonTypes.csproj +++ b/Aaru.CommonTypes.csproj @@ -54,81 +54,80 @@ false - + Metadata/cicm.cs - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - + + + + + @@ -136,16 +135,16 @@ - - + + - - - + + + diff --git a/Interfaces/IArchive.cs b/Interfaces/IArchive.cs deleted file mode 100644 index 9bfb61b..0000000 --- a/Interfaces/IArchive.cs +++ /dev/null @@ -1,202 +0,0 @@ -// /*************************************************************************** -// Aaru Data Preservation Suite -// ---------------------------------------------------------------------------- -// -// Filename : IArchive.cs -// Author(s) : Michael Drüing -// -// Component : Archives. -// -// --[ Description ] ---------------------------------------------------------- -// -// Defines the interface for implementing archive plugins. -// -// --[ License ] -------------------------------------------------------------- -// -// This library is free software; you can redistribute it and/or modify -// it under the terms of the GNU Lesser General Public License as -// published by the Free Software Foundation; either version 2.1 of the -// License, or (at your option) any later version. -// -// This library 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 -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, see . -// -// ---------------------------------------------------------------------------- -// Copyright © 2018-2019 Michael Drüing -// Copyright © 2011-2021 Natalia Portillo -// ****************************************************************************/ - -using System; -using System.Collections.Generic; -using System.IO; - -// ReSharper disable UnusedMember.Global - -namespace Aaru.CommonTypes.Interfaces -{ - /// Supported archive features - [Flags] - public enum ArchiveSupportedFeature : uint - { - /// The archive supports filenames for its entries. If this flag is not set, files can only be accessed by number. - SupportsFilenames = 1 << 0, - /// - /// The archive supports compression. If this flag is not set, compressed and uncompressed lengths are always the - /// same. - /// - SupportsCompression = 1 << 1, - /// - /// The archive supports subdirectories. If this flag is not set, all filenames are guaranteed to not contain any - /// "/" character. - /// - SupportsSubdirectories = 1 << 2, - /// - /// The archive supports explicit entries for directories (like Zip, for example). If this flag is not set, - /// directories are implicit by the relative name of the files. - /// - HasExplicitDirectories = 1 << 3, - /// The archive stores a timestamp with each entry if this flag is set. - HasEntryTimestamp = 1 << 4, - /// If this flag is set, individual files or the whole archive might be encrypted or password-protected. - SupportsProtection = 1 << 5, // TODO: not implemented yet - - /// If this flag is set, the archive supports returning extended attributes (Xattrs) for each entry. - SupportsXAttrs = 1 << 6 - } - - /// Defines the interface to handle an archive (e.g. ZIP, WAD, etc) - public interface IArchive - { - /// Descriptive name of the plugin - string Name { get; } - - /// Unique UUID of the plugin - Guid Id { get; } - - /// Identifies if the specified path contains data recognizable by this archive instance - /// Path. - bool Identify(string path); - - /// Identifies if the specified stream contains data recognizable by this archive instance - /// Stream. - bool Identify(Stream stream); - - /// Identifies if the specified buffer contains data recognizable by this archive instance - /// Buffer. - bool Identify(byte[] buffer); - - /// Opens the specified path with this archive instance - /// Path. - void Open(string path); - - /// Opens the specified stream with this archive instance - /// Stream. - void Open(Stream stream); - - /// Opens the specified buffer with this archive instance - /// Buffer. - void Open(byte[] buffer); - - /// - /// Returns true if the archive has a file/stream/buffer currently opened and no - /// has been issued. - /// - bool IsOpened(); - - /// Closes all opened streams. - void Close(); - - /// Return a bitfield indicating the features supported by this archive type. - /// The ArchiveSupportedFeature bitfield. - /// - /// This should be a constant, tied to the archive type, not to the particular features used by the - /// currently-opened archive file. - /// - ArchiveSupportedFeature GetArchiveFeatures(); - - /// Gets the number of entries (i.e. files) that are contained in this archive. - /// - /// Entries in this context can also mean directories or volume labels, for some types of archives that store - /// these explicitly. Do not rely on all entries being regular files! - /// - /// The number of files. - int GetNumberOfEntries(); - - /// Gets the file name (and path) of the given entry in the archive. - /// - /// The path components are separated by a forward slash "/".
The path should not start with a leading - /// slash (i.e. it should be relative, not absolute). - ///
- /// - /// The entry in the archive for which to return the file name. - /// The file name, with (relative) path - string GetFilename(int entryNumber); - - /// - /// Gets the entry number for a particular file path in the archive. fileName is the relative path of the - /// file in the archive. If the file cannot be found, -1 is returned. - /// - /// - /// The path should be relative (no leading slash), using regular slashes as path separator, and be normalized, - /// i.e. no "foo//bar" or "foo/../bar" path components. - /// - /// The relative path for which to get the entry number. - /// If set, do a case insensitive matching and return the first file that matches. - /// The number of the entry corresponding to the given path, or -1 if the path does not exist. - int GetEntryNumber(string fileName, bool caseInsensitiveMatch); - - /// Gets the (compressed) size of the given entry. - /// The entry for which to get the compressed size. - /// The compressed size of the entry, or 0 if the entry is not a regular file. - /// The return value is equal to the return value of GetUncompressedSize() if the file is not compressed. - /// - long GetCompressedSize(int entryNumber); - - /// Gets the uncompressed size of the given entry. - /// The entry for which to get the uncompressed size. - /// The uncompressed size of the entry, or 0 if the entry is not a regular file. - /// The return value is equal to the return value of GetCompressedSize() if the file is not compressed. - /// - long GetUncompressedSize(int entryNumber); - - /// Gets the attributes of a file or directory. - /// - /// Error number. - /// The entry in the archive for which to retrieve the attributes. - /// File attributes, or zero if the archive does not support attributes. - FileAttributes GetAttributes(int entryNumber); - - /// Lists all extended attributes, alternate data streams and forks of the given file. - /// The entry in the archive for which to retrieve the list of attributes. - /// List of extended attributes, alternate data streams and forks. - List GetXAttrs(int entryNumber); - - /// Reads an extended attribute, alternate data stream or fork from the given file. - /// Error number. - /// The entry in the archive for which to retrieve the XAttr. - /// Extended attribute, alternate data stream or fork name. - /// Buffer with the XAttr data. - byte[] GetXattr(int entryNumber, string xattr); - - /// Gets information about an entry in the archive. - /// Note that some of the data might be incomplete or not available at all, depending on the type of archive. - /// - /// - /// The entry int he archive for which to get the information - /// The available information about the entry in the archive - FileSystemInfo Stat(int entryNumber); - - /// - /// Returns the Filter for the given entry. It will return null if the entry in question is not a regular - /// file (i.e. directory, volume label, etc.) - /// - /// The entry for which the Filter should be returned. - /// The Filter for the given entry. - IFilter GetEntry(int entryNumber); - } -} \ No newline at end of file diff --git a/Interfaces/IPluginRegister.cs b/Interfaces/IPluginRegister.cs index f82f9d0..12a1111 100644 --- a/Interfaces/IPluginRegister.cs +++ b/Interfaces/IPluginRegister.cs @@ -79,9 +79,5 @@ namespace Aaru.CommonTypes.Interfaces /// Gets all writable media image plugins /// List of writable media image plugins List GetAllWritableImagePlugins(); - - /// Gets all archive plugins - /// List of archive plugins - List GetAllArchivePlugins(); } } \ No newline at end of file diff --git a/PluginBase.cs b/PluginBase.cs index 2929db5..edf6410 100644 --- a/PluginBase.cs +++ b/PluginBase.cs @@ -46,8 +46,6 @@ namespace Aaru.CommonTypes /// Contain all plugins (filesystem, partition and image) public class PluginBase { - /// List of all archive formats - public readonly SortedDictionary Archives; /// List of checksum plugins public readonly List Checksums; /// List of filter plugins @@ -79,7 +77,6 @@ namespace Aaru.CommonTypes Filters = new SortedDictionary(); FloppyImages = new SortedDictionary(); WritableFloppyImages = new SortedDictionary(); - Archives = new SortedDictionary(); } /// Adds plugins to the central plugin register @@ -138,12 +135,6 @@ namespace Aaru.CommonTypes {}) 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); } } } \ No newline at end of file