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.
39 lines
942 B
39 lines
942 B
using System;
|
|
using System.Linq;
|
|
using Ionic.Zip;
|
|
using NLog;
|
|
using NzbDrone.Common;
|
|
|
|
namespace NzbDrone.Core.Providers
|
|
{
|
|
public class BackupProvider
|
|
{
|
|
private readonly IEnvironmentProvider _environmentProvider;
|
|
private static readonly Logger logger = LogManager.GetCurrentClassLogger();
|
|
|
|
public BackupProvider(IEnvironmentProvider environmentProvider)
|
|
{
|
|
_environmentProvider = environmentProvider;
|
|
}
|
|
|
|
public BackupProvider()
|
|
{
|
|
|
|
}
|
|
|
|
public virtual string CreateBackupZip()
|
|
{
|
|
var configFile = _environmentProvider.GetConfigPath();
|
|
var zipFile = _environmentProvider.GetConfigBackupFile();
|
|
|
|
using (var zip = new ZipFile())
|
|
{
|
|
zip.AddFile(configFile, String.Empty);
|
|
zip.Save(zipFile);
|
|
}
|
|
|
|
return zipFile;
|
|
}
|
|
}
|
|
}
|