diff --git a/Interfaces/IFilter.cs b/Interfaces/IFilter.cs index 03f591b..eca29c8 100644 --- a/Interfaces/IFilter.cs +++ b/Interfaces/IFilter.cs @@ -128,7 +128,7 @@ public interface IFilter /// Identifies if the specified path contains data recognizable by this filter 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 filter instance /// Stream. @@ -136,11 +136,13 @@ public interface IFilter /// Identifies if the specified buffer contains data recognizable by this filter instance /// Buffer. - bool Identify(byte[] buffer); + bool Identify(byte[] buffer) => Identify(new MemoryStream(buffer)); /// Opens the specified path with this filter 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 filter instance /// Stream. @@ -148,5 +150,5 @@ public interface IFilter /// Opens the specified buffer with this filter instance /// Buffer. - ErrorNumber Open(byte[] buffer); + ErrorNumber Open(byte[] buffer) => Open(new MemoryStream(buffer)); } \ No newline at end of file