1
0
Fork 0
mirror of https://github.com/Sonarr/Sonarr synced 2024-12-26 17:57:43 +00:00
Sonarr/NzbDrone.Core/Providers/BackupProvider.cs

43 lines
1.1 KiB
C#
Raw Normal View History

2012-01-27 05:05:09 +00:00
using System;
using System.Linq;
using Ionic.Zip;
using NLog;
using Ninject;
using NzbDrone.Common;
namespace NzbDrone.Core.Providers
{
public class BackupProvider
{
private readonly EnvironmentProvider _environmentProvider;
2012-01-27 05:05:09 +00:00
private static readonly Logger logger = LogManager.GetCurrentClassLogger();
[Inject]
public BackupProvider(EnvironmentProvider environmentProvider)
2012-01-27 05:05:09 +00:00
{
_environmentProvider = environmentProvider;
2012-01-27 05:05:09 +00:00
}
public BackupProvider()
{
}
public virtual string CreateBackupZip()
{
var dbFile = _environmentProvider.GetNzbDroneDbFile();
var configFile = _environmentProvider.GetConfigPath();
var zipFile = _environmentProvider.GetConfigBackupFile();
2012-01-27 05:05:09 +00:00
using (var zip = new ZipFile())
2012-01-27 05:05:09 +00:00
{
zip.AddFile(dbFile, String.Empty);
zip.AddFile(configFile, String.Empty);
zip.Save(zipFile);
2012-01-27 05:05:09 +00:00
}
return zipFile;
2012-01-27 05:05:09 +00:00
}
}
}