adamhathcock / sharpcompress

SharpCompress is a fully managed C# library to deal with many compression types and formats.
MIT License
2.28k stars 480 forks source link

SharpCompress.Archives.ArchiveFactory.IsArchive(Stream, out ArchiveType?) is private #739

Closed AlissaSabre closed 1 year ago

AlissaSabre commented 1 year ago

Issue description

We sometimes need to know whether a particular file is an archive of some kind or not an archive. If it is a plain file on the filesystem, SharpCompress provides SharpCompress.Archives.ArchiveFactory.IsArchive(string, out ArchiveType?) for the purpose. If it is not a file on the filesystem, e.g., it is an in-memory data or a part of a file on the filesystem embedded in a larger file format, the IsArchive(string, out ArchiveType?) doesn't work, unless we first write the data into a single temporary file.

The SharpCompress.Archives.ArchiveFactory class has another method IsArchive(Stream, out ArchiveType?), whch just fits the purpose. However, the IsArchive(Stream, out ArchiveType?) method is private and not available for user programs.

I consider it is a bug (or a design flaw.)

Proposed solution

Make SharpCompress.Archives.ArchiveFactory.IsArchive(Stream, out ArchiveType?) public.