1
0
mirror of https://github.com/Radarr/Radarr.git synced 2024-11-12 22:12:38 +01:00
Radarr/NzbDrone.Core/Datastore/ObjectDbFactory.cs
Mark McDowall bd9683fcc1 Added full release of siaqodb.
Excluded license.lic - this is going to be messy...
2013-03-18 17:42:44 -07:00

41 lines
1.0 KiB
C#

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