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