// /*************************************************************************** // The Disc Image Chef // ---------------------------------------------------------------------------- // // Filename : IFilter.cs // Author(s) : Natalia Portillo // // Component : Filters. // // --[ Description ] ---------------------------------------------------------- // // Defines the interface for a Filter. // // --[ 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 © 2011-2018 Natalia Portillo // ****************************************************************************/ using System; using System.IO; namespace DiscImageChef.Filters { public interface IFilter { /// Descriptive name of the plugin string Name { get; } /// Unique UUID of the plugin Guid Id { get; } /// /// Closes all opened streams. /// void Close(); /// /// 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 GetBasePath(); /// /// Gets creation time of file referenced by this filter. /// /// The creation time. DateTime GetCreationTime(); /// /// Gets length of this filter's data fork. /// /// The data fork length. long GetDataForkLength(); /// /// Gets a stream to access the data fork contents. /// /// The data fork stream. Stream GetDataForkStream(); /// /// 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 GetFilename(); /// /// Gets last write time of file referenced by this filter. /// /// The last write time. DateTime GetLastWriteTime(); /// /// Gets length of file referenced by ths filter. /// /// The length. long GetLength(); /// /// 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 GetPath(); /// /// 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 GetParentFolder(); /// /// Gets length of this filter's resource fork. /// /// The resource fork length. long GetResourceForkLength(); /// /// Gets a stream to access the resource fork contents. /// /// The resource fork stream. Stream GetResourceForkStream(); /// /// Returns true if the file referenced by this filter has a resource fork /// bool HasResourceFork(); /// /// 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); /// /// Returns true if the filter has a file/stream/buffer currently opened and no /// has been issued. /// bool IsOpened(); /// /// Opens the specified path with this filter instance /// /// Path. void Open(string path); /// /// Opens the specified stream with this filter instance /// /// Stream. void Open(Stream stream); /// /// Opens the specified buffer with this filter instance /// /// Buffer. void Open(byte[] buffer); } }