aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.ServerApplication
diff options
context:
space:
mode:
authorLuke Pulverenti <luke.pulverenti@gmail.com>2013-09-26 17:20:26 -0400
committerLuke Pulverenti <luke.pulverenti@gmail.com>2013-09-26 17:20:26 -0400
commit2d8152f36ad8ecc5674cfb25ad328d3e671a22de (patch)
tree3adc6e475d7375141af11acb80714114a5fab931 /MediaBrowser.ServerApplication
parent2d0cc66e6bea278b7be5078130f55fc05ce756ce (diff)
mono progress - able to start app
Diffstat (limited to 'MediaBrowser.ServerApplication')
-rw-r--r--MediaBrowser.ServerApplication/App.xaml.cs2
-rw-r--r--MediaBrowser.ServerApplication/ApplicationHost.cs37
-rw-r--r--MediaBrowser.ServerApplication/MainStartup.cs2
-rw-r--r--MediaBrowser.ServerApplication/MediaBrowser.ServerApplication.csproj9
-rw-r--r--MediaBrowser.ServerApplication/Native/Sqlite.cs36
-rw-r--r--MediaBrowser.ServerApplication/packages.config1
6 files changed, 8 insertions, 79 deletions
diff --git a/MediaBrowser.ServerApplication/App.xaml.cs b/MediaBrowser.ServerApplication/App.xaml.cs
index ad4727023..7bfebdfe9 100644
--- a/MediaBrowser.ServerApplication/App.xaml.cs
+++ b/MediaBrowser.ServerApplication/App.xaml.cs
@@ -55,8 +55,6 @@ namespace MediaBrowser.ServerApplication
public void OnUnhandledException(Exception ex)
{
- _logger.ErrorException("UnhandledException", ex);
-
MessageBox.Show("Unhandled exception: " + ex.Message);
}
diff --git a/MediaBrowser.ServerApplication/ApplicationHost.cs b/MediaBrowser.ServerApplication/ApplicationHost.cs
index 3090ad033..4327f4149 100644
--- a/MediaBrowser.ServerApplication/ApplicationHost.cs
+++ b/MediaBrowser.ServerApplication/ApplicationHost.cs
@@ -53,7 +53,6 @@ using MediaBrowser.ServerApplication.Native;
using MediaBrowser.WebDashboard.Api;
using System;
using System.Collections.Generic;
-using System.Data;
using System.IO;
using System.Linq;
using System.Net.Http;
@@ -157,7 +156,7 @@ namespace MediaBrowser.ServerApplication
private ISessionManager SessionManager { get; set; }
private ILiveTvManager LiveTvManager { get; set; }
-
+
private ILocalizationManager LocalizationManager { get; set; }
/// <summary>
@@ -329,13 +328,9 @@ namespace MediaBrowser.ServerApplication
private async Task<IUserRepository> GetUserRepository()
{
- var dbFile = Path.Combine(ApplicationPaths.DataPath, "users.db");
-
- var connection = await ConnectToDb(dbFile).ConfigureAwait(false);
+ var repo = new SqliteUserRepository(JsonSerializer, LogManager, ApplicationPaths);
- var repo = new SqliteUserRepository(connection, JsonSerializer, LogManager);
-
- repo.Initialize();
+ await repo.Initialize().ConfigureAwait(false);
return repo;
}
@@ -346,13 +341,9 @@ namespace MediaBrowser.ServerApplication
/// <returns>Task.</returns>
private async Task ConfigureNotificationsRepository()
{
- var dbFile = Path.Combine(ApplicationPaths.DataPath, "notifications.db");
-
- var connection = await ConnectToDb(dbFile).ConfigureAwait(false);
+ var repo = new SqliteNotificationsRepository(LogManager, ApplicationPaths);
- var repo = new SqliteNotificationsRepository(connection, LogManager);
-
- repo.Initialize();
+ await repo.Initialize().ConfigureAwait(false);
NotificationsRepository = repo;
@@ -389,22 +380,6 @@ namespace MediaBrowser.ServerApplication
}
/// <summary>
- /// Connects to db.
- /// </summary>
- /// <param name="dbPath">The db path.</param>
- /// <returns>Task{IDbConnection}.</returns>
- /// <exception cref="System.ArgumentNullException">dbPath</exception>
- private static Task<IDbConnection> ConnectToDb(string dbPath)
- {
- if (string.IsNullOrEmpty(dbPath))
- {
- throw new ArgumentNullException("dbPath");
- }
-
- return Sqlite.OpenDatabase(dbPath);
- }
-
- /// <summary>
/// Dirty hacks
/// </summary>
private void SetStaticProperties()
@@ -550,7 +525,7 @@ namespace MediaBrowser.ServerApplication
.Select(LoadAssembly)
.Where(a => a != null)
.ToList();
-
+
// Gets all plugin assemblies by first reading all bytes of the .dll and calling Assembly.Load against that
// This will prevent the .dll file from getting locked, and allow us to replace it when needed
diff --git a/MediaBrowser.ServerApplication/MainStartup.cs b/MediaBrowser.ServerApplication/MainStartup.cs
index 55fa60ed2..a6a403609 100644
--- a/MediaBrowser.ServerApplication/MainStartup.cs
+++ b/MediaBrowser.ServerApplication/MainStartup.cs
@@ -314,6 +314,8 @@ namespace MediaBrowser.ServerApplication
{
var exception = (Exception)e.ExceptionObject;
+ _logger.ErrorException("UnhandledException", ex);
+
if (_backgroundService == null)
{
_app.OnUnhandledException(exception);
diff --git a/MediaBrowser.ServerApplication/MediaBrowser.ServerApplication.csproj b/MediaBrowser.ServerApplication/MediaBrowser.ServerApplication.csproj
index ddbe05e59..0d052db6a 100644
--- a/MediaBrowser.ServerApplication/MediaBrowser.ServerApplication.csproj
+++ b/MediaBrowser.ServerApplication/MediaBrowser.ServerApplication.csproj
@@ -167,14 +167,6 @@
<Reference Include="System" />
<Reference Include="System.Configuration.Install" />
<Reference Include="System.Data" />
- <Reference Include="System.Data.SQLite, Version=1.0.88.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139, processorArchitecture=x86">
- <SpecificVersion>False</SpecificVersion>
- <HintPath>..\packages\System.Data.SQLite.x86.1.0.88.0\lib\net45\System.Data.SQLite.dll</HintPath>
- </Reference>
- <Reference Include="System.Data.SQLite.Linq, Version=1.0.88.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139, processorArchitecture=MSIL">
- <SpecificVersion>False</SpecificVersion>
- <HintPath>..\packages\System.Data.SQLite.x86.1.0.88.0\lib\net45\System.Data.SQLite.Linq.dll</HintPath>
- </Reference>
<Reference Include="System.Drawing" />
<Reference Include="System.Net" />
<Reference Include="System.Net.Http" />
@@ -212,7 +204,6 @@
<Compile Include="BackgroundServiceInstaller.cs">
<SubType>Component</SubType>
</Compile>
- <Compile Include="Native\Sqlite.cs" />
<Compile Include="Splash\SplashWindow.xaml.cs">
<DependentUpon>SplashWindow.xaml</DependentUpon>
</Compile>
diff --git a/MediaBrowser.ServerApplication/Native/Sqlite.cs b/MediaBrowser.ServerApplication/Native/Sqlite.cs
deleted file mode 100644
index cc20952d7..000000000
--- a/MediaBrowser.ServerApplication/Native/Sqlite.cs
+++ /dev/null
@@ -1,36 +0,0 @@
-using System.Data;
-using System.Data.SQLite;
-using System.Threading.Tasks;
-
-namespace MediaBrowser.ServerApplication.Native
-{
- /// <summary>
- /// Class Sqlite
- /// </summary>
- public static class Sqlite
- {
- /// <summary>
- /// Connects to db.
- /// </summary>
- /// <param name="dbPath">The db path.</param>
- /// <returns>Task{IDbConnection}.</returns>
- /// <exception cref="System.ArgumentNullException">dbPath</exception>
- public static async Task<IDbConnection> OpenDatabase(string dbPath)
- {
- var connectionstr = new SQLiteConnectionStringBuilder
- {
- PageSize = 4096,
- CacheSize = 4096,
- SyncMode = SynchronizationModes.Normal,
- DataSource = dbPath,
- JournalMode = SQLiteJournalModeEnum.Wal
- };
-
- var connection = new SQLiteConnection(connectionstr.ConnectionString);
-
- await connection.OpenAsync().ConfigureAwait(false);
-
- return connection;
- }
- }
-}
diff --git a/MediaBrowser.ServerApplication/packages.config b/MediaBrowser.ServerApplication/packages.config
index d776597ec..fd96a8fc1 100644
--- a/MediaBrowser.ServerApplication/packages.config
+++ b/MediaBrowser.ServerApplication/packages.config
@@ -10,5 +10,4 @@
<package id="ServiceStack.Redis" version="3.9.44" targetFramework="net45" />
<package id="ServiceStack.Text" version="3.9.62" targetFramework="net45" />
<package id="SimpleInjector" version="2.3.5" targetFramework="net45" />
- <package id="System.Data.SQLite.x86" version="1.0.88.0" targetFramework="net45" />
</packages> \ No newline at end of file