From ef84faca3829237a5e4f8cb152d32fca8865c128 Mon Sep 17 00:00:00 2001 From: Natalia Portillo Date: Fri, 6 Oct 2023 13:52:58 +0100 Subject: [PATCH] [IArchive] Use `IFilter` for `Identify()` and `Open()`. --- Interfaces/IArchive.cs | 28 +++++----------------------- 1 file changed, 5 insertions(+), 23 deletions(-) diff --git a/Interfaces/IArchive.cs b/Interfaces/IArchive.cs index 37bc8a602..affc462a7 100644 --- a/Interfaces/IArchive.cs +++ b/Interfaces/IArchive.cs @@ -82,31 +82,13 @@ public interface IArchive /// Plugin author string Author { get; } - /// Identifies if the specified path contains data recognizable by this archive instance - /// Path. - bool Identify(string path) => File.Exists(path) && Identify(new FileStream(path, FileMode.Open, FileAccess.Read)); - - /// 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) => Identify(new MemoryStream(buffer)); - - /// Opens the specified path with this archive instance - /// Path. - ErrorNumber Open(string path) => !File.Exists(path) - ? ErrorNumber.NoSuchFile - : Open(new FileStream(path, FileMode.Open, FileAccess.Read)); + /// Identifies if the specified filter contains data recognizable by this archive instance + /// Filter that contains the archive. This allows use to handle .tar.gz and similars. + bool Identify(IFilter filter); /// Opens the specified stream with this archive instance - /// Stream. - ErrorNumber Open(Stream stream); - - /// Opens the specified buffer with this archive instance - /// Buffer. - ErrorNumber Open(byte[] buffer) => Open(new MemoryStream(buffer)); + /// Filter that contains the archive. This allows use to handle .tar.gz and similars. + ErrorNumber Open(IFilter filter); /// /// Returns true if the archive has a file/stream/buffer currently opened and no