1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2025-01-21 11:02:01 +02:00
Sonarr/NzbDrone.Core/Providers/BackupProvider.cs

39 lines
942 B
C#
Raw Normal View History

2012-01-26 21:05:09 -08:00
using System;
using System.Linq;
using Ionic.Zip;
using NLog;
using NzbDrone.Common;
namespace NzbDrone.Core.Providers
{
public class BackupProvider
{
2013-05-10 16:53:50 -07:00
private readonly IEnvironmentProvider _environmentProvider;
2012-01-26 21:05:09 -08:00
private static readonly Logger logger = LogManager.GetCurrentClassLogger();
2013-05-10 16:53:50 -07:00
public BackupProvider(IEnvironmentProvider environmentProvider)
2012-01-26 21:05:09 -08:00
{
_environmentProvider = environmentProvider;
2012-01-26 21:05:09 -08:00
}
public BackupProvider()
{
}
public virtual string CreateBackupZip()
{
var configFile = _environmentProvider.GetConfigPath();
var zipFile = _environmentProvider.GetConfigBackupFile();
2012-01-26 21:05:09 -08:00
using (var zip = new ZipFile())
2012-01-26 21:05:09 -08:00
{
zip.AddFile(configFile, String.Empty);
zip.Save(zipFile);
2012-01-26 21:05:09 -08:00
}
return zipFile;
2012-01-26 21:05:09 -08:00
}
}
}