app now starts up,

added monodevelop, siaodb files to git.ignore
This commit is contained in:
kay.one 2013-02-16 20:59:35 -08:00
parent a0d0e4715e
commit 63cf7a3b85
6 changed files with 21 additions and 23 deletions

3
.gitignore vendored
View File

@ -133,3 +133,6 @@ NzbDrone.Web/_backboneApp/.idea/workspace.xml
*/.idea/workspace.xml */.idea/workspace.xml
*workspace.xml *workspace.xml
NzbDrone.Web/_backboneApp/.idea/. NzbDrone.Web/_backboneApp/.idea/.
*.test-cache
*.sqo
*.userprefs

View File

@ -16,10 +16,9 @@ namespace NzbDrone.Common
public const string NZBDRONE_EXE = "NzbDrone.exe"; public const string NZBDRONE_EXE = "NzbDrone.exe";
public const string NZBDRONE_SQLCE_DB_FILE = "nzbdrone.sdf"; 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_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"; 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); 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) public static string GetMediaCoverPath(this EnvironmentProvider environmentProvider)
{ {

View File

@ -52,11 +52,11 @@ namespace NzbDrone.Core.Test.Framework
{ {
if (memory) if (memory)
{ {
_db = new SiaqoDbFactory(new DiskProvider()).CreateMemoryDb(); _db = new SiaqoDbFactory(new DiskProvider(),new EnvironmentProvider()).CreateMemoryDb();
} }
else 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); Mocker.SetConstant(Db);

View File

@ -82,7 +82,7 @@ namespace NzbDrone.Core
container.Register(c => container.Register(c =>
{ {
return c.Resolve<IObjectDbFactory>().Create(""); return c.Resolve<IObjectDbFactory>().Create();
}).As<IObjectDatabase>().SingleInstance(); }).As<IObjectDatabase>().SingleInstance();
container.RegisterType<DatabaseTarget>().WithParameter(ResolvedParameter.ForNamed<IDatabase>("DatabaseTarget")); container.RegisterType<DatabaseTarget>().WithParameter(ResolvedParameter.ForNamed<IDatabase>("DatabaseTarget"));

View File

@ -40,7 +40,7 @@ namespace NzbDrone.Core.Datastore.Migrations
var sqlCeConnection = SqlCeProxy.EnsureDatabase(Database.ConnectionString); var sqlCeConnection = SqlCeProxy.EnsureDatabase(Database.ConnectionString);
var eqPath = sqlCeConnection.Database.Replace(".sdf", ".eq"); 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() public override void Down()

View File

@ -1,5 +1,4 @@
using System; using System.Linq;
using System.Linq;
using NzbDrone.Common; using NzbDrone.Common;
using Sqo; using Sqo;
@ -7,27 +6,28 @@ namespace NzbDrone.Core.Datastore
{ {
public interface IObjectDbFactory public interface IObjectDbFactory
{ {
IObjectDatabase CreateMemoryDb(); IObjectDatabase Create(string dbPath = null);
IObjectDatabase Create(string dbPath);
} }
public class SiaqoDbFactory : IObjectDbFactory public class SiaqoDbFactory : IObjectDbFactory
{ {
private readonly DiskProvider _diskProvider; private readonly DiskProvider _diskProvider;
private readonly EnvironmentProvider _environmentProvider;
public SiaqoDbFactory(DiskProvider diskProvider) public SiaqoDbFactory(DiskProvider diskProvider, EnvironmentProvider environmentProvider)
{ {
_diskProvider = diskProvider; _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); _diskProvider.CreateDirectory(dbPath);
} }