1
0
mirror of https://github.com/Radarr/Radarr.git synced 2024-11-11 05:22:44 +01:00
Radarr/NzbDrone.Core/Providers/BackupProvider.cs
Mark McDowall 1990f5ab8c Removed try/catch from CreateBackupZip.
Build NzbDrone.Common when debugging now.
2012-01-26 21:24:41 -08:00

46 lines
1.1 KiB
C#

using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using Ionic.Zip;
using NLog;
using Ninject;
using NzbDrone.Common;
namespace NzbDrone.Core.Providers
{
public class BackupProvider
{
private readonly EnviromentProvider _enviromentProvider;
private static readonly Logger logger = LogManager.GetCurrentClassLogger();
[Inject]
public BackupProvider(EnviromentProvider enviromentProvider)
{
_enviromentProvider = enviromentProvider;
}
public BackupProvider()
{
}
public virtual string CreateBackupZip()
{
var dbFile = _enviromentProvider.GetNzbDronoeDbFile();
var configFile = _enviromentProvider.GetConfigPath();
var zipFile = _enviromentProvider.GetConfigBackupFile();
using (var zip = new ZipFile())
{
zip.AddFile(dbFile, String.Empty);
zip.AddFile(configFile, String.Empty);
zip.Save(zipFile);
}
return zipFile;
}
}
}