You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 lines
818 B
37 lines
818 B
using System;
|
|
using System.Linq;
|
|
using Ionic.Zip;
|
|
using NzbDrone.Common;
|
|
using NzbDrone.Common.EnvironmentInfo;
|
|
|
|
namespace NzbDrone.Core.Providers
|
|
{
|
|
public class BackupProvider
|
|
{
|
|
private readonly IAppFolderInfo _appFolderInfo;
|
|
|
|
public BackupProvider(IAppFolderInfo appFolderInfo)
|
|
{
|
|
_appFolderInfo = appFolderInfo;
|
|
}
|
|
|
|
public BackupProvider()
|
|
{
|
|
}
|
|
|
|
public virtual string CreateBackupZip()
|
|
{
|
|
var configFile = _appFolderInfo.GetConfigPath();
|
|
var zipFile = _appFolderInfo.GetConfigBackupFile();
|
|
|
|
using (var zip = new ZipFile())
|
|
{
|
|
zip.AddFile(configFile, String.Empty);
|
|
zip.Save(zipFile);
|
|
}
|
|
|
|
return zipFile;
|
|
}
|
|
}
|
|
}
|