diff --git a/Interfaces/IArchive.cs b/Interfaces/IArchive.cs index ef0025060..37bc8a602 100644 --- a/Interfaces/IArchive.cs +++ b/Interfaces/IArchive.cs @@ -84,7 +84,7 @@ public interface IArchive /// Identifies if the specified path contains data recognizable by this archive instance /// Path. - bool Identify(string 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. @@ -92,11 +92,13 @@ public interface IArchive /// Identifies if the specified buffer contains data recognizable by this archive instance /// Buffer. - bool Identify(byte[] buffer); + bool Identify(byte[] buffer) => Identify(new MemoryStream(buffer)); /// Opens the specified path with this archive instance /// Path. - ErrorNumber Open(string path); + ErrorNumber Open(string path) => !File.Exists(path) + ? ErrorNumber.NoSuchFile + : Open(new FileStream(path, FileMode.Open, FileAccess.Read)); /// Opens the specified stream with this archive instance /// Stream. @@ -104,7 +106,7 @@ public interface IArchive /// Opens the specified buffer with this archive instance /// Buffer. - ErrorNumber Open(byte[] buffer); + ErrorNumber Open(byte[] buffer) => Open(new MemoryStream(buffer)); /// /// Returns true if the archive has a file/stream/buffer currently opened and no