// /*************************************************************************** // The Disc Image Chef // ---------------------------------------------------------------------------- // // 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-2018 Natalia Portillo // ****************************************************************************/ using System; using System.IO; namespace DiscImageChef.CommonTypes.Interfaces { 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); } }