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.
Prowlarr/NzbDrone.Core/Datastore/ObjectDbFactory.cs

43 lines
1.1 KiB

using System.Linq;
12 years ago
using NzbDrone.Common;
using Sqo;
namespace NzbDrone.Core.Datastore
{
public interface IObjectDbFactory
{
IObjectDatabase Create(string dbPath = null);
12 years ago
}
public class SiaqoDbFactory : IObjectDbFactory
{
private readonly DiskProvider _diskProvider;
private readonly EnvironmentProvider _environmentProvider;
12 years ago
public SiaqoDbFactory(DiskProvider diskProvider, EnvironmentProvider environmentProvider)
12 years ago
{
_diskProvider = diskProvider;
_environmentProvider = environmentProvider;
12 years ago
}
public IObjectDatabase Create(string dbPath = null)
12 years ago
{
if (string.IsNullOrWhiteSpace(dbPath))
{
dbPath = _environmentProvider.GetObjectDbFolder();
}
12 years ago
if (!_diskProvider.FolderExists(dbPath))
12 years ago
{
_diskProvider.CreateDirectory(dbPath);
}
SiaqodbConfigurator.SetTrialLicense("uvhpW4hT5Rtq+Uoyq8MOm1Smon15foxV5iS5bAegIXU=");
var db = new Siaqodb(dbPath);
return new SiaqodbProxy(db);
}
}
}