From fe80e3b6c905cabc33799ecd7b8847a037f79794 Mon Sep 17 00:00:00 2001 From: Natalia Portillo Date: Wed, 15 Sep 2021 11:25:19 +0100 Subject: [PATCH] Use properties instead of methods in IFilter. --- Filters.cs | 2 +- Interfaces/IFilter.cs | 50 +++++++++++++++++++++---------------------- 2 files changed, 26 insertions(+), 26 deletions(-) diff --git a/Filters.cs b/Filters.cs index 1de6ad041..38c7d2a0a 100644 --- a/Filters.cs +++ b/Filters.cs @@ -95,7 +95,7 @@ namespace Aaru.CommonTypes foundFilter?.Open(path); - if(foundFilter?.IsOpened() == true) + if(foundFilter.Opened) return foundFilter; } else diff --git a/Interfaces/IFilter.cs b/Interfaces/IFilter.cs index 7aecd8240..cb5bd6c87 100644 --- a/Interfaces/IFilter.cs +++ b/Interfaces/IFilter.cs @@ -54,43 +54,36 @@ namespace Aaru.CommonTypes.Interfaces /// Plugin author string Author { 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(); + string BasePath { get; } /// Gets creation time of file referenced by this filter. /// The creation time. - DateTime GetCreationTime(); + DateTime CreationTime { get; } /// 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(); + 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 GetFilename(); + string Filename { get; } /// Gets last write time of file referenced by this filter. /// The last write time. - DateTime GetLastWriteTime(); + DateTime LastWriteTime { get; } /// Gets length of file referenced by ths filter. /// The length. - long GetLength(); + long Length { get; } /// /// Gets full path to file referenced by this filter. If it's an archive, it's the path inside the archive.
@@ -98,7 +91,7 @@ namespace Aaru.CommonTypes.Interfaces /// C:\path\to\archive.zip\path\to\file.bin => \path\to\file.bin ///
/// The path. - string GetPath(); + 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 @@ -106,19 +99,32 @@ namespace Aaru.CommonTypes.Interfaces /// C:\path\to\archive.zip\path\to\file.bin => C:\path\to\archive.zip /// /// The parent folder. - string GetParentFolder(); + string ParentFolder { get; } /// Gets length of this filter's resource fork. /// The resource fork length. - long GetResourceForkLength(); + long ResourceForkLength { get; } + + /// Returns true if the file referenced by this filter has a resource fork + bool HasResourceFork { get; } + + /// + /// Returns true if the filter has a file/stream/buffer currently opened and no + /// has been issued. + /// + bool Opened { 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(); - /// 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); @@ -131,12 +137,6 @@ namespace Aaru.CommonTypes.Interfaces /// 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);