IArchiveExtensions.cs 648 B

1234567891011121314151617181920212223242526
  1. #if !NO_FILE
  2. using System.Linq;
  3. using SharpCompress.Common;
  4. #endif
  5. namespace SharpCompress.Archives
  6. {
  7. public static class IArchiveExtensions
  8. {
  9. #if !NO_FILE
  10. /// <summary>
  11. /// Extract to specific directory, retaining filename
  12. /// </summary>
  13. public static void WriteToDirectory(this IArchive archive, string destinationDirectory,
  14. ExtractionOptions options = null)
  15. {
  16. foreach (IArchiveEntry entry in archive.Entries.Where(x => !x.IsDirectory))
  17. {
  18. entry.WriteToDirectory(destinationDirectory, options);
  19. }
  20. }
  21. #endif
  22. }
  23. }