// /*************************************************************************** // Aaru Data Preservation Suite // ---------------------------------------------------------------------------- // // Filename : IFilter.cs // Author(s) : Natalia Portillo // // Component : Filters. // // --[ Description ] ---------------------------------------------------------- // // Defines the interface for a Filter. // // --[ License ] -------------------------------------------------------------- // // Permission is hereby granted, free of charge, to any person obtaining a // copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be included // in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. // IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY // CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, // TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE // SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // // ---------------------------------------------------------------------------- // Copyright © 2011-2022 Natalia Portillo // ****************************************************************************/ using System; using System.IO; using Aaru.CommonTypes.Enums; namespace Aaru.CommonTypes.Interfaces { /// /// Defines a filter, that is, a transformation of the data from a file, like, for example, a compressor (e.g. /// GZIP), or a container (e.g. AppleDouble) /// public interface IFilter { /// Descriptive name of the plugin string Name { get; } /// Unique UUID of the plugin Guid Id { get; } /// Plugin author string Author { get; } /// /// Gets the path used to open this filter.
UNIX: /path/to/archive.zip/path/to/file.bin => /// /path/to/archive.zip/path/to/file.bin
Windows: C:\path\to\archive.zip\path\to\file.bin => /// C:\path\to\archive.zip\path\to\file.bin ///
/// Path used to open this filter. string BasePath { get; } /// Gets creation time of file referenced by this filter. /// The creation time. DateTime CreationTime { get; } /// Gets length of this filter's data fork. /// The data fork length. long DataForkLength { get; } /// /// Gets the filename for the file referenced by this filter.
UNIX: /path/to/archive.zip/path/to/file.bin = /// > file.bin
Windows: C:\path\to\archive.zip\path\to\file.bin => file.bin ///
/// The filename. string Filename { get; } /// Gets last write time of file referenced by this filter. /// The last write time. DateTime LastWriteTime { get; } /// Gets length of file referenced by ths filter. /// The length. long Length { get; } /// /// Gets full path to file referenced by this filter. If it's an archive, it's the path inside the archive.
/// UNIX: /path/to/archive.zip/path/to/file.bin => /path/to/file.bin
Windows: /// C:\path\to\archive.zip\path\to\file.bin => \path\to\file.bin ///
/// The path. string Path { get; } /// /// Gets path to parent folder to the file referenced by this filter. If it's an archive, it's the full path to /// the archive itself.
UNIX: /path/to/archive.zip/path/to/file.bin => /path/to/archive.zip
Windows: /// C:\path\to\archive.zip\path\to\file.bin => C:\path\to\archive.zip ///
/// The parent folder. string ParentFolder { get; } /// Gets length of this filter's resource fork. /// The resource fork length. long ResourceForkLength { get; } /// Returns true if the file referenced by this filter has a resource fork bool HasResourceFork { get; } /// Closes all opened streams. void Close(); /// Gets a stream to access the data fork contents. /// The data fork stream. Stream GetDataForkStream(); /// Gets a stream to access the resource fork contents. /// The resource fork stream. Stream GetResourceForkStream(); /// Identifies if the specified path contains data recognizable by this filter instance /// Path. bool Identify(string path); /// Identifies if the specified stream contains data recognizable by this filter instance /// Stream. bool Identify(Stream stream); /// Identifies if the specified buffer contains data recognizable by this filter instance /// Buffer. bool Identify(byte[] buffer); /// Opens the specified path with this filter instance /// Path. ErrorNumber Open(string path); /// Opens the specified stream with this filter instance /// Stream. ErrorNumber Open(Stream stream); /// Opens the specified buffer with this filter instance /// Buffer. ErrorNumber Open(byte[] buffer); } }