mirror of
https://github.com/Sonarr/Sonarr.git
synced 2024-12-16 11:37:58 +02:00
32 lines
882 B
C#
32 lines
882 B
C#
|
using System;
|
||
|
using System.Collections.Generic;
|
||
|
using System.IO;
|
||
|
using System.Linq;
|
||
|
using System.Text;
|
||
|
using Eloquera.Client;
|
||
|
using NzbDrone.Common;
|
||
|
|
||
|
namespace NzbDrone.Core.Datastore
|
||
|
{
|
||
|
public class EloqueraDbFactory
|
||
|
{
|
||
|
private readonly EnvironmentProvider _environmentProvider;
|
||
|
|
||
|
public EloqueraDbFactory()
|
||
|
{
|
||
|
_environmentProvider = new EnvironmentProvider();
|
||
|
}
|
||
|
|
||
|
public EloqueraDb Create(string dbName = "NzbDrone", string dbFilename = "nzbdrone.eloq")
|
||
|
{
|
||
|
DB db = new DB();
|
||
|
DB.Configuration.ServerSettings.DatabasePath = Path.Combine(_environmentProvider.GetAppDataPath(), dbName);
|
||
|
db.CreateDatabase(dbName);
|
||
|
db.OpenDatabase(dbName);
|
||
|
db.RefreshMode = ObjectRefreshMode.AlwaysReturnUpdatedValues;
|
||
|
|
||
|
return new EloqueraDb(db);
|
||
|
}
|
||
|
}
|
||
|
}
|