1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2024-12-23 02:05:27 +02:00
Sonarr/NzbDrone.Core/Providers/BackupProvider.cs

37 lines
818 B
C#
Raw Normal View History

2012-01-27 08:05:09 +03:00
using System;
using System.Linq;
using Ionic.Zip;
using NzbDrone.Common;
using NzbDrone.Common.EnvironmentInfo;
2012-01-27 08:05:09 +03:00
namespace NzbDrone.Core.Providers
{
public class BackupProvider
{
private readonly IAppFolderInfo _appFolderInfo;
public BackupProvider(IAppFolderInfo appFolderInfo)
2012-01-27 08:05:09 +03:00
{
_appFolderInfo = appFolderInfo;
2012-01-27 08:05:09 +03:00
}
public BackupProvider()
{
}
public virtual string CreateBackupZip()
{
var configFile = _appFolderInfo.GetConfigPath();
var zipFile = _appFolderInfo.GetConfigBackupFile();
2012-01-27 08:05:09 +03:00
using (var zip = new ZipFile())
2012-01-27 08:05:09 +03:00
{
zip.AddFile(configFile, String.Empty);
zip.Save(zipFile);
2012-01-27 08:05:09 +03:00
}
return zipFile;
2012-01-27 08:05:09 +03:00
}
}
}