2013-03-05 08:33:34 +03:00
|
|
|
using System.Linq;
|
2011-10-21 08:04:26 +03:00
|
|
|
using Ionic.Zip;
|
|
|
|
using NLog;
|
2010-09-23 06:19:47 +03:00
|
|
|
|
2013-03-05 08:33:34 +03:00
|
|
|
namespace NzbDrone.Common
|
2010-09-23 06:19:47 +03:00
|
|
|
{
|
2011-11-13 07:07:06 +03:00
|
|
|
public class ArchiveProvider
|
2010-09-23 06:19:47 +03:00
|
|
|
{
|
2011-11-13 07:07:06 +03:00
|
|
|
private static readonly Logger logger = LogManager.GetCurrentClassLogger();
|
2011-10-11 07:00:31 +03:00
|
|
|
|
2011-10-21 08:04:26 +03:00
|
|
|
public virtual void ExtractArchive(string compressedFile, string destination)
|
|
|
|
{
|
2011-11-13 07:07:06 +03:00
|
|
|
logger.Trace("Extracting archive [{0}] to [{1}]", compressedFile, destination);
|
2011-10-21 08:04:26 +03:00
|
|
|
|
2013-03-05 08:33:34 +03:00
|
|
|
using (var zipFile = ZipFile.Read(compressedFile))
|
2011-10-21 08:04:26 +03:00
|
|
|
{
|
|
|
|
zipFile.ExtractAll(destination);
|
|
|
|
}
|
|
|
|
|
2011-11-13 07:07:06 +03:00
|
|
|
logger.Trace("Extraction complete.");
|
2011-10-21 08:04:26 +03:00
|
|
|
}
|
2010-09-23 06:19:47 +03:00
|
|
|
}
|
|
|
|
}
|