mirror of
https://github.com/adamhathcock/sharpcompress.git
synced 2026-09-24 16:05:27 +00:00
Added Archive Name
This commit is contained in:
@@ -76,9 +76,7 @@ namespace SharpCompress.Archives
|
||||
}
|
||||
|
||||
var extensions = Factories
|
||||
.SelectMany(item => item.GetSupportedExtensions())
|
||||
.Select(item => item.Key)
|
||||
.Distinct()
|
||||
.Select(item => item.Name)
|
||||
.Aggregate((a,b) => a + ", " + b );
|
||||
|
||||
throw new InvalidOperationException($"Cannot determine compressed stream type. Supported Archive Formats: {extensions}");
|
||||
|
||||
@@ -10,9 +10,12 @@ namespace SharpCompress.Archives.GZip
|
||||
public class GZipArchiveFactory : IArchiveFactory
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
public IEnumerable<KeyValuePair<string, string>> GetSupportedExtensions()
|
||||
public string Name => "GZip";
|
||||
|
||||
/// <inheritdoc/>
|
||||
public IEnumerable<string> GetSupportedExtensions()
|
||||
{
|
||||
yield return new KeyValuePair<string, string>("GZip", "gz");
|
||||
yield return "gz";
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
|
||||
@@ -22,11 +22,16 @@ namespace SharpCompress.Archives
|
||||
/// </remarks>
|
||||
public interface IArchiveFactory
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the archive Type name
|
||||
/// </summary>
|
||||
string Name { get; }
|
||||
|
||||
/// <summary>
|
||||
/// returns the extensions typically used by this archive type.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
IEnumerable<KeyValuePair<string, string>> GetSupportedExtensions();
|
||||
IEnumerable<string> GetSupportedExtensions();
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if the stream represents an archive of the format defined by this type.
|
||||
|
||||
@@ -10,10 +10,13 @@ namespace SharpCompress.Archives.Rar
|
||||
public class RarArchiveFactory : IArchiveFactory
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
public IEnumerable<KeyValuePair<string, string>> GetSupportedExtensions()
|
||||
public string Name => "Rar";
|
||||
|
||||
/// <inheritdoc/>
|
||||
public IEnumerable<string> GetSupportedExtensions()
|
||||
{
|
||||
yield return new KeyValuePair<string, string>("Rar", "rar");
|
||||
yield return new KeyValuePair<string, string>("Rar", "cbr");
|
||||
yield return "rar";
|
||||
yield return "cbr";
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
|
||||
@@ -10,9 +10,12 @@ namespace SharpCompress.Archives.SevenZip
|
||||
public class SevenZipArchiveFactory : IArchiveFactory
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
public IEnumerable<KeyValuePair<string, string>> GetSupportedExtensions()
|
||||
public string Name => "7Zip";
|
||||
|
||||
/// <inheritdoc/>
|
||||
public IEnumerable<string> GetSupportedExtensions()
|
||||
{
|
||||
yield return new KeyValuePair<string, string>("7Zip", "7z");
|
||||
yield return "7z";
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
|
||||
@@ -10,9 +10,12 @@ namespace SharpCompress.Archives.Tar
|
||||
public class TarArchiveFactory : IArchiveFactory
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
public IEnumerable<KeyValuePair<string, string>> GetSupportedExtensions()
|
||||
public string Name => "Tar";
|
||||
|
||||
/// <inheritdoc/>
|
||||
public IEnumerable<string> GetSupportedExtensions()
|
||||
{
|
||||
yield return new KeyValuePair<string, string>("Tar", "tar");
|
||||
yield return "tar";
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
|
||||
@@ -10,11 +10,14 @@ namespace SharpCompress.Archives.Zip
|
||||
public class ZipArchiveFactory : IArchiveFactory
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
public IEnumerable<KeyValuePair<string, string>> GetSupportedExtensions()
|
||||
public string Name => "Zip";
|
||||
|
||||
/// <inheritdoc/>
|
||||
public IEnumerable<string> GetSupportedExtensions()
|
||||
{
|
||||
yield return new KeyValuePair<string, string>("Zip", "zip");
|
||||
yield return new KeyValuePair<string, string>("Zip", "zipx");
|
||||
yield return new KeyValuePair<string, string>("Zip", "cbz");
|
||||
yield return "zip";
|
||||
yield return "zipx";
|
||||
yield return "cbz";
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
|
||||
Reference in New Issue
Block a user