mirror of
https://github.com/Sonarr/Sonarr.git
synced 2024-10-29 23:12:39 +01:00
app now starts up,
added monodevelop, siaodb files to git.ignore
This commit is contained in:
parent
a0d0e4715e
commit
63cf7a3b85
3
.gitignore
vendored
3
.gitignore
vendored
@ -133,3 +133,6 @@ NzbDrone.Web/_backboneApp/.idea/workspace.xml
|
||||
*/.idea/workspace.xml
|
||||
*workspace.xml
|
||||
NzbDrone.Web/_backboneApp/.idea/.
|
||||
*.test-cache
|
||||
*.sqo
|
||||
*.userprefs
|
||||
|
@ -16,10 +16,9 @@ namespace NzbDrone.Common
|
||||
|
||||
public const string NZBDRONE_EXE = "NzbDrone.exe";
|
||||
public const string NZBDRONE_SQLCE_DB_FILE = "nzbdrone.sdf";
|
||||
public const string NZBDRONE_ELQ_DB_FILE = "nzbdrone.eq";
|
||||
|
||||
public const string LOG_SQLCE_DB_FILE = "log.sdf";
|
||||
public const string LOG_ELQ_DB_FILE = "log.eq";
|
||||
public const string OBJ_DB_FOLDER = "objDb";
|
||||
|
||||
private const string BACKUP_ZIP_FILE = "NzbDrone_Backup.zip";
|
||||
|
||||
@ -96,15 +95,11 @@ namespace NzbDrone.Common
|
||||
return Path.Combine(environmentProvider.GetAppDataPath(), LOG_SQLCE_DB_FILE);
|
||||
}
|
||||
|
||||
public static string GetElqMainDbPath(this EnvironmentProvider environmentProvider)
|
||||
public static string GetObjectDbFolder(this EnvironmentProvider environmentProvider)
|
||||
{
|
||||
return Path.Combine(environmentProvider.GetAppDataPath(), NZBDRONE_ELQ_DB_FILE);
|
||||
return Path.Combine(environmentProvider.GetAppDataPath(), OBJ_DB_FOLDER);
|
||||
}
|
||||
|
||||
public static string GetElqLogDbPath(this EnvironmentProvider environmentProvider)
|
||||
{
|
||||
return Path.Combine(environmentProvider.GetAppDataPath(), LOG_ELQ_DB_FILE);
|
||||
}
|
||||
|
||||
public static string GetMediaCoverPath(this EnvironmentProvider environmentProvider)
|
||||
{
|
||||
|
@ -52,11 +52,11 @@ namespace NzbDrone.Core.Test.Framework
|
||||
{
|
||||
if (memory)
|
||||
{
|
||||
_db = new SiaqoDbFactory(new DiskProvider()).CreateMemoryDb();
|
||||
_db = new SiaqoDbFactory(new DiskProvider(),new EnvironmentProvider()).CreateMemoryDb();
|
||||
}
|
||||
else
|
||||
{
|
||||
_db = new SiaqoDbFactory(new DiskProvider()).Create(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, Guid.NewGuid().ToString()));
|
||||
_db = new SiaqoDbFactory(new DiskProvider(),new EnvironmentProvider()).Create(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, Guid.NewGuid().ToString()));
|
||||
}
|
||||
|
||||
Mocker.SetConstant(Db);
|
||||
|
@ -82,7 +82,7 @@ namespace NzbDrone.Core
|
||||
|
||||
container.Register(c =>
|
||||
{
|
||||
return c.Resolve<IObjectDbFactory>().Create("");
|
||||
return c.Resolve<IObjectDbFactory>().Create();
|
||||
}).As<IObjectDatabase>().SingleInstance();
|
||||
|
||||
container.RegisterType<DatabaseTarget>().WithParameter(ResolvedParameter.ForNamed<IDatabase>("DatabaseTarget"));
|
||||
|
@ -40,7 +40,7 @@ namespace NzbDrone.Core.Datastore.Migrations
|
||||
var sqlCeConnection = SqlCeProxy.EnsureDatabase(Database.ConnectionString);
|
||||
|
||||
var eqPath = sqlCeConnection.Database.Replace(".sdf", ".eq");
|
||||
return new SiaqoDbFactory(new DiskProvider()).Create(eqPath);
|
||||
return new SiaqoDbFactory(new DiskProvider(),new EnvironmentProvider()).Create(eqPath);
|
||||
}
|
||||
|
||||
public override void Down()
|
||||
|
@ -1,5 +1,4 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Linq;
|
||||
using NzbDrone.Common;
|
||||
using Sqo;
|
||||
|
||||
@ -7,27 +6,28 @@ namespace NzbDrone.Core.Datastore
|
||||
{
|
||||
public interface IObjectDbFactory
|
||||
{
|
||||
IObjectDatabase CreateMemoryDb();
|
||||
IObjectDatabase Create(string dbPath);
|
||||
IObjectDatabase Create(string dbPath = null);
|
||||
}
|
||||
|
||||
public class SiaqoDbFactory : IObjectDbFactory
|
||||
{
|
||||
private readonly DiskProvider _diskProvider;
|
||||
private readonly EnvironmentProvider _environmentProvider;
|
||||
|
||||
public SiaqoDbFactory(DiskProvider diskProvider)
|
||||
public SiaqoDbFactory(DiskProvider diskProvider, EnvironmentProvider environmentProvider)
|
||||
{
|
||||
_diskProvider = diskProvider;
|
||||
_environmentProvider = environmentProvider;
|
||||
}
|
||||
|
||||
public IObjectDatabase CreateMemoryDb()
|
||||
public IObjectDatabase Create(string dbPath = null)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
if (string.IsNullOrWhiteSpace(dbPath))
|
||||
{
|
||||
dbPath = _environmentProvider.GetObjectDbFolder();
|
||||
}
|
||||
|
||||
public IObjectDatabase Create(string dbPath)
|
||||
{
|
||||
if(!_diskProvider.FolderExists(dbPath))
|
||||
if (!_diskProvider.FolderExists(dbPath))
|
||||
{
|
||||
_diskProvider.CreateDirectory(dbPath);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user