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