From 2d8152f36ad8ecc5674cfb25ad328d3e671a22de Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Thu, 26 Sep 2013 17:20:26 -0400 Subject: [PATCH] mono progress - able to start app --- MediaBrowser.Controller/Entities/Folder.cs | 29 ++- .../Notifications/INotificationsRepository.cs | 6 + .../Persistence/IItemRepository.cs | 1 - .../Persistence/IUserRepository.cs | 2 +- MediaBrowser.Mono.userprefs | 13 +- .../Dto/DtoService.cs | 2 +- .../SqliteNotificationsRepository.cs | 18 +- .../Persistence/SqliteUserRepository.cs | 17 +- .../MediaBrowser.Server.Mono.csproj | 16 +- MediaBrowser.Server.Mono/Native/NativeApp.cs | 7 +- MediaBrowser.Server.Mono/Native/Sqlite.cs | 36 ---- MediaBrowser.Server.Mono/Program.cs | 174 +++++++++++++++++- .../Properties/AssemblyInfo.cs | 11 +- MediaBrowser.Server.Mono/app.config | 14 ++ MediaBrowser.ServerApplication/App.xaml.cs | 2 - .../ApplicationHost.cs | 37 +--- MediaBrowser.ServerApplication/MainStartup.cs | 2 + .../MediaBrowser.ServerApplication.csproj | 9 - .../Native/Sqlite.cs | 36 ---- .../packages.config | 1 - 20 files changed, 273 insertions(+), 160 deletions(-) delete mode 100644 MediaBrowser.Server.Mono/Native/Sqlite.cs create mode 100644 MediaBrowser.Server.Mono/app.config delete mode 100644 MediaBrowser.ServerApplication/Native/Sqlite.cs diff --git a/MediaBrowser.Controller/Entities/Folder.cs b/MediaBrowser.Controller/Entities/Folder.cs index 1015a3021..6f5bc3e3b 100644 --- a/MediaBrowser.Controller/Entities/Folder.cs +++ b/MediaBrowser.Controller/Entities/Folder.cs @@ -980,7 +980,7 @@ namespace MediaBrowser.Controller.Entities var initialCount = _children.Count; var list = new List(initialCount); - AddChildrenToList(user, includeLinkedChildren, list, false); + AddChildrenToList(user, includeLinkedChildren, list, false, null); return list; } @@ -992,7 +992,9 @@ namespace MediaBrowser.Controller.Entities /// if set to true [include linked children]. /// The list. /// if set to true [recursive]. - private bool AddChildrenToList(User user, bool includeLinkedChildren, List list, bool recursive) + /// The filter. + /// true if XXXX, false otherwise + private bool AddChildrenToList(User user, bool includeLinkedChildren, List list, bool recursive, Func filter) { var hasLinkedChildren = false; @@ -1000,7 +1002,10 @@ namespace MediaBrowser.Controller.Entities { if (child.IsVisible(user)) { - list.Add(child); + if (filter == null || filter(child)) + { + list.Add(child); + } } if (recursive) @@ -1009,7 +1014,7 @@ namespace MediaBrowser.Controller.Entities if (folder != null) { - if (folder.AddChildrenToList(user, includeLinkedChildren, list, true)) + if (folder.AddChildrenToList(user, includeLinkedChildren, list, true, filter)) { hasLinkedChildren = true; } @@ -1021,6 +1026,11 @@ namespace MediaBrowser.Controller.Entities { foreach (var child in GetLinkedChildren()) { + if (filter != null && !filter(child)) + { + continue; + } + hasLinkedChildren = true; if (child.IsVisible(user)) @@ -1042,6 +1052,11 @@ namespace MediaBrowser.Controller.Entities /// IEnumerable{BaseItem}. /// public IEnumerable GetRecursiveChildren(User user, bool includeLinkedChildren = true) + { + return GetRecursiveChildren(user, null, true); + } + + public IEnumerable GetRecursiveChildren(User user, Func filter, bool includeLinkedChildren = true) { if (user == null) { @@ -1051,10 +1066,10 @@ namespace MediaBrowser.Controller.Entities var initialCount = _lastRecursiveCount == 0 ? _children.Count : _lastRecursiveCount; var list = new List(initialCount); - var hasLinkedChildren = AddChildrenToList(user, includeLinkedChildren, list, true); + var hasLinkedChildren = AddChildrenToList(user, includeLinkedChildren, list, true, null); _lastRecursiveCount = list.Count; - + if (includeLinkedChildren && hasLinkedChildren) { list = list.Distinct().ToList(); @@ -1062,7 +1077,7 @@ namespace MediaBrowser.Controller.Entities return list; } - + /// /// Gets the linked children. /// diff --git a/MediaBrowser.Controller/Notifications/INotificationsRepository.cs b/MediaBrowser.Controller/Notifications/INotificationsRepository.cs index 8790b54f4..7a4b69b52 100644 --- a/MediaBrowser.Controller/Notifications/INotificationsRepository.cs +++ b/MediaBrowser.Controller/Notifications/INotificationsRepository.cs @@ -25,6 +25,12 @@ namespace MediaBrowser.Controller.Notifications /// event EventHandler NotificationsMarkedRead; + /// + /// Opens the connection to the repository + /// + /// Task. + Task Initialize(); + /// /// Gets the notifications. /// diff --git a/MediaBrowser.Controller/Persistence/IItemRepository.cs b/MediaBrowser.Controller/Persistence/IItemRepository.cs index 8960b5dfb..e04f25605 100644 --- a/MediaBrowser.Controller/Persistence/IItemRepository.cs +++ b/MediaBrowser.Controller/Persistence/IItemRepository.cs @@ -2,7 +2,6 @@ using MediaBrowser.Model.Entities; using System; using System.Collections.Generic; -using System.Linq; using System.Threading; using System.Threading.Tasks; diff --git a/MediaBrowser.Controller/Persistence/IUserRepository.cs b/MediaBrowser.Controller/Persistence/IUserRepository.cs index 49c418c30..0241b8c03 100644 --- a/MediaBrowser.Controller/Persistence/IUserRepository.cs +++ b/MediaBrowser.Controller/Persistence/IUserRepository.cs @@ -14,7 +14,7 @@ namespace MediaBrowser.Controller.Persistence /// Opens the connection to the repository /// /// Task. - void Initialize(); + Task Initialize(); /// /// Deletes the user. diff --git a/MediaBrowser.Mono.userprefs b/MediaBrowser.Mono.userprefs index 80da5915d..b57fb35e0 100644 --- a/MediaBrowser.Mono.userprefs +++ b/MediaBrowser.Mono.userprefs @@ -1,15 +1,12 @@  - + + + + + - - - - - - - diff --git a/MediaBrowser.Server.Implementations/Dto/DtoService.cs b/MediaBrowser.Server.Implementations/Dto/DtoService.cs index a5f54b938..740f5fbbc 100644 --- a/MediaBrowser.Server.Implementations/Dto/DtoService.cs +++ b/MediaBrowser.Server.Implementations/Dto/DtoService.cs @@ -1074,7 +1074,7 @@ namespace MediaBrowser.Server.Implementations.Dto double totalPercentPlayed = 0; // Loop through each recursive child - foreach (var child in folder.GetRecursiveChildren(user, true).Where(i => !i.IsFolder).ToList()) + foreach (var child in folder.GetRecursiveChildren(user, i => !i.IsFolder)) { var userdata = _userDataRepository.GetUserData(user.Id, child.GetUserDataKey()); diff --git a/MediaBrowser.Server.Implementations/Persistence/SqliteNotificationsRepository.cs b/MediaBrowser.Server.Implementations/Persistence/SqliteNotificationsRepository.cs index f755bd4e6..d85b1d874 100644 --- a/MediaBrowser.Server.Implementations/Persistence/SqliteNotificationsRepository.cs +++ b/MediaBrowser.Server.Implementations/Persistence/SqliteNotificationsRepository.cs @@ -1,4 +1,6 @@ -using MediaBrowser.Controller.Notifications; +using System.IO; +using MediaBrowser.Controller; +using MediaBrowser.Controller.Notifications; using MediaBrowser.Model.Logging; using MediaBrowser.Model.Notifications; using System; @@ -12,15 +14,15 @@ namespace MediaBrowser.Server.Implementations.Persistence { public class SqliteNotificationsRepository : INotificationsRepository { - private readonly IDbConnection _connection; + private IDbConnection _connection; private readonly ILogger _logger; + private readonly IServerApplicationPaths _appPaths; private readonly SemaphoreSlim _writeLock = new SemaphoreSlim(1, 1); - public SqliteNotificationsRepository(IDbConnection connection, ILogManager logManager) + public SqliteNotificationsRepository(ILogManager logManager, IServerApplicationPaths appPaths) { - _connection = connection; - + _appPaths = appPaths; _logger = logManager.GetLogger(GetType().Name); } @@ -31,8 +33,12 @@ namespace MediaBrowser.Server.Implementations.Persistence private IDbCommand _replaceNotificationCommand; private IDbCommand _markReadCommand; - public void Initialize() + public async Task Initialize() { + var dbFile = Path.Combine(_appPaths.DataPath, "notifications.db"); + + _connection = await SqliteExtensions.ConnectToDb(dbFile).ConfigureAwait(false); + string[] queries = { "create table if not exists Notifications (Id GUID NOT NULL, UserId GUID NOT NULL, Date DATETIME NOT NULL, Name TEXT NOT NULL, Description TEXT, Url TEXT, Level TEXT NOT NULL, IsRead BOOLEAN NOT NULL, Category TEXT NOT NULL, RelatedId TEXT, PRIMARY KEY (Id, UserId))", diff --git a/MediaBrowser.Server.Implementations/Persistence/SqliteUserRepository.cs b/MediaBrowser.Server.Implementations/Persistence/SqliteUserRepository.cs index c96ed970a..1aa0e8395 100644 --- a/MediaBrowser.Server.Implementations/Persistence/SqliteUserRepository.cs +++ b/MediaBrowser.Server.Implementations/Persistence/SqliteUserRepository.cs @@ -1,10 +1,12 @@ -using MediaBrowser.Controller.Entities; +using MediaBrowser.Controller; +using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Persistence; using MediaBrowser.Model.Logging; using MediaBrowser.Model.Serialization; using System; using System.Collections.Generic; using System.Data; +using System.IO; using System.Threading; using System.Threading.Tasks; @@ -20,6 +22,7 @@ namespace MediaBrowser.Server.Implementations.Persistence private readonly SemaphoreSlim _writeLock = new SemaphoreSlim(1, 1); private IDbConnection _connection; + private readonly IServerApplicationPaths _appPaths; /// /// Gets the name of the repository @@ -42,19 +45,19 @@ namespace MediaBrowser.Server.Implementations.Persistence /// /// Initializes a new instance of the class. /// - /// The connection. /// The json serializer. /// The log manager. + /// The app paths. /// appPaths - public SqliteUserRepository(IDbConnection connection, IJsonSerializer jsonSerializer, ILogManager logManager) + public SqliteUserRepository(IJsonSerializer jsonSerializer, ILogManager logManager, IServerApplicationPaths appPaths) { if (jsonSerializer == null) { throw new ArgumentNullException("jsonSerializer"); } - _connection = connection; _jsonSerializer = jsonSerializer; + _appPaths = appPaths; _logger = logManager.GetLogger(GetType().Name); } @@ -63,8 +66,12 @@ namespace MediaBrowser.Server.Implementations.Persistence /// Opens the connection to the database /// /// Task. - public void Initialize() + public async Task Initialize() { + var dbFile = Path.Combine(_appPaths.DataPath, "users.db"); + + _connection = await SqliteExtensions.ConnectToDb(dbFile).ConfigureAwait(false); + string[] queries = { "create table if not exists users (guid GUID primary key, data BLOB)", diff --git a/MediaBrowser.Server.Mono/MediaBrowser.Server.Mono.csproj b/MediaBrowser.Server.Mono/MediaBrowser.Server.Mono.csproj index 1c369daac..267dfb78a 100644 --- a/MediaBrowser.Server.Mono/MediaBrowser.Server.Mono.csproj +++ b/MediaBrowser.Server.Mono/MediaBrowser.Server.Mono.csproj @@ -10,6 +10,8 @@ MediaBrowser.Server.Mono MediaBrowser.Server.Mono v4.5 + MediaBrowser.Server.Mono.MainClass + ..\MediaBrowser.ServerApplication\Resources\Images\Icon.ico true @@ -43,6 +45,12 @@ + + ..\packages\ServiceStack.Common.3.9.62\lib\net35\ServiceStack.Common.dll + + + ..\packages\ServiceStack.Common.3.9.62\lib\net35\ServiceStack.Interfaces.dll + @@ -50,6 +58,9 @@ + + Properties\SharedVersion.cs + @@ -72,7 +83,6 @@ - @@ -112,8 +122,10 @@ - + + + \ No newline at end of file diff --git a/MediaBrowser.Server.Mono/Native/NativeApp.cs b/MediaBrowser.Server.Mono/Native/NativeApp.cs index bb47f6ea4..4cc2dcebf 100644 --- a/MediaBrowser.Server.Mono/Native/NativeApp.cs +++ b/MediaBrowser.Server.Mono/Native/NativeApp.cs @@ -1,4 +1,5 @@ - +using MediaBrowser.Server.Mono; + namespace MediaBrowser.ServerApplication.Native { /// @@ -11,7 +12,7 @@ namespace MediaBrowser.ServerApplication.Native /// public static void Shutdown() { - + MainClass.Shutdown (); } /// @@ -19,7 +20,7 @@ namespace MediaBrowser.ServerApplication.Native /// public static void Restart() { - + MainClass.Restart (); } } } diff --git a/MediaBrowser.Server.Mono/Native/Sqlite.cs b/MediaBrowser.Server.Mono/Native/Sqlite.cs deleted file mode 100644 index cc20952d7..000000000 --- a/MediaBrowser.Server.Mono/Native/Sqlite.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System.Data; -using System.Data.SQLite; -using System.Threading.Tasks; - -namespace MediaBrowser.ServerApplication.Native -{ - /// - /// Class Sqlite - /// - public static class Sqlite - { - /// - /// Connects to db. - /// - /// The db path. - /// Task{IDbConnection}. - /// dbPath - public static async Task 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.Server.Mono/Program.cs b/MediaBrowser.Server.Mono/Program.cs index 72dee1162..1a3ce414e 100644 --- a/MediaBrowser.Server.Mono/Program.cs +++ b/MediaBrowser.Server.Mono/Program.cs @@ -1,16 +1,188 @@ +using MediaBrowser.Common.Constants; +using MediaBrowser.Common.Implementations.Logging; +using MediaBrowser.Common.Implementations.Updates; +using MediaBrowser.Model.Logging; +using MediaBrowser.Server.Implementations; +using MediaBrowser.ServerApplication; +using Microsoft.Win32; using System; +using System.Diagnostics; +using System.IO; +using System.Threading; +using System.Windows; using Gtk; +using System.Threading.Tasks; namespace MediaBrowser.Server.Mono { - class MainClass + public class MainClass { + private static ApplicationHost _appHost; + + private static Mutex _singleInstanceMutex; + + private static ILogger _logger; + public static void Main (string[] args) { Application.Init (); + + var appPaths = CreateApplicationPaths(); + + var logManager = new NlogManager(appPaths.LogDirectoryPath, "server"); + logManager.ReloadLogger(LogSeverity.Info); + + var logger = _logger = logManager.GetLogger("Main"); + + BeginLog(logger); + + AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException; + + bool createdNew; + + var runningPath = Process.GetCurrentProcess().MainModule.FileName.Replace(Path.DirectorySeparatorChar.ToString(), string.Empty); + + _singleInstanceMutex = new Mutex(true, @"Local\" + runningPath, out createdNew); + + if (!createdNew) + { + _singleInstanceMutex = null; + logger.Info("Shutting down because another instance of Media Browser Server is already running."); + return; + } + + if (PerformUpdateIfNeeded(appPaths, logger)) + { + logger.Info("Exiting to perform application update."); + return; + } + + try + { + RunApplication(appPaths, logManager); + } + finally + { + logger.Info("Shutting down"); + + ReleaseMutex(logger); + + _appHost.Dispose(); + } + } + + private static ServerApplicationPaths CreateApplicationPaths() + { + return new ServerApplicationPaths("D:\\MonoTest"); + } + + private static void RunApplication(ServerApplicationPaths appPaths, ILogManager logManager) + { + // TODO: Show splash here + + SystemEvents.SessionEnding += SystemEvents_SessionEnding; + + _appHost = new ApplicationHost(appPaths, logManager); + + var task = _appHost.Init(); + Task.WaitAll (task); + + task = _appHost.RunStartupTasks(); + Task.WaitAll (task); + + // TODO: Hide splash here MainWindow win = new MainWindow (); + win.Show (); + Application.Run (); } + + /// + /// Handles the SessionEnding event of the SystemEvents control. + /// + /// The source of the event. + /// The instance containing the event data. + static void SystemEvents_SessionEnding(object sender, SessionEndingEventArgs e) + { + if (e.Reason == SessionEndReasons.SystemShutdown) + { + Shutdown(); + } + } + + /// + /// Begins the log. + /// + /// The logger. + private static void BeginLog(ILogger logger) + { + logger.Info("Media Browser Server started"); + logger.Info("Command line: {0}", string.Join(" ", Environment.GetCommandLineArgs())); + + logger.Info("Server: {0}", Environment.MachineName); + logger.Info("Operating system: {0}", Environment.OSVersion.ToString()); + } + + /// + /// Handles the UnhandledException event of the CurrentDomain control. + /// + /// The source of the event. + /// The instance containing the event data. + static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e) + { + var exception = (Exception)e.ExceptionObject; + + _logger.ErrorException("UnhandledException", exception); + + if (!Debugger.IsAttached) + { + Environment.Exit(System.Runtime.InteropServices.Marshal.GetHRForException(exception)); + } + } + + /// + /// Releases the mutex. + /// + internal static void ReleaseMutex(ILogger logger) + { + if (_singleInstanceMutex == null) + { + return; + } + + logger.Debug("Releasing mutex"); + + _singleInstanceMutex.ReleaseMutex(); + _singleInstanceMutex.Close(); + _singleInstanceMutex.Dispose(); + _singleInstanceMutex = null; + } + + /// + /// Performs the update if needed. + /// + /// The app paths. + /// The logger. + /// true if XXXX, false otherwise + private static bool PerformUpdateIfNeeded(ServerApplicationPaths appPaths, ILogger logger) + { + return false; + } + + public static void Shutdown() + { + Application.Quit (); + } + + public static void Restart() + { + // Second instance will start first, so release the mutex and dispose the http server ahead of time + ReleaseMutex (_logger); + + _appHost.Dispose(); + + Application.Quit (); + } } } diff --git a/MediaBrowser.Server.Mono/Properties/AssemblyInfo.cs b/MediaBrowser.Server.Mono/Properties/AssemblyInfo.cs index 0a2e93220..3d6ac0bc1 100644 --- a/MediaBrowser.Server.Mono/Properties/AssemblyInfo.cs +++ b/MediaBrowser.Server.Mono/Properties/AssemblyInfo.cs @@ -10,13 +10,4 @@ using System.Runtime.CompilerServices; [assembly: AssemblyProduct ("")] [assembly: AssemblyCopyright ("Luke")] [assembly: AssemblyTrademark ("")] -[assembly: AssemblyCulture ("")] -// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}". -// The form "{Major}.{Minor}.*" will automatically update the build and revision, -// and "{Major}.{Minor}.{Build}.*" will update just the revision. -[assembly: AssemblyVersion ("1.0.*")] -// The following attributes are used to specify the signing key for the assembly, -// if desired. See the Mono documentation for more information about signing. -//[assembly: AssemblyDelaySign(false)] -//[assembly: AssemblyKeyFile("")] - +[assembly: AssemblyCulture ("")] \ No newline at end of file diff --git a/MediaBrowser.Server.Mono/app.config b/MediaBrowser.Server.Mono/app.config new file mode 100644 index 000000000..0f0042497 --- /dev/null +++ b/MediaBrowser.Server.Mono/app.config @@ -0,0 +1,14 @@ + + + +
+ + + + + + + + + + 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; } /// @@ -329,13 +328,9 @@ namespace MediaBrowser.ServerApplication private async Task GetUserRepository() { - var dbFile = Path.Combine(ApplicationPaths.DataPath, "users.db"); + var repo = new SqliteUserRepository(JsonSerializer, LogManager, ApplicationPaths); - var connection = await ConnectToDb(dbFile).ConfigureAwait(false); - - var repo = new SqliteUserRepository(connection, JsonSerializer, LogManager); - - repo.Initialize(); + await repo.Initialize().ConfigureAwait(false); return repo; } @@ -346,13 +341,9 @@ namespace MediaBrowser.ServerApplication /// Task. private async Task ConfigureNotificationsRepository() { - var dbFile = Path.Combine(ApplicationPaths.DataPath, "notifications.db"); + var repo = new SqliteNotificationsRepository(LogManager, ApplicationPaths); - var connection = await ConnectToDb(dbFile).ConfigureAwait(false); - - var repo = new SqliteNotificationsRepository(connection, LogManager); - - repo.Initialize(); + await repo.Initialize().ConfigureAwait(false); NotificationsRepository = repo; @@ -388,22 +379,6 @@ namespace MediaBrowser.ServerApplication return UserDataRepository.Initialize(); } - /// - /// Connects to db. - /// - /// The db path. - /// Task{IDbConnection}. - /// dbPath - private static Task ConnectToDb(string dbPath) - { - if (string.IsNullOrEmpty(dbPath)) - { - throw new ArgumentNullException("dbPath"); - } - - return Sqlite.OpenDatabase(dbPath); - } - /// /// Dirty hacks /// @@ -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 @@ - - False - ..\packages\System.Data.SQLite.x86.1.0.88.0\lib\net45\System.Data.SQLite.dll - - - False - ..\packages\System.Data.SQLite.x86.1.0.88.0\lib\net45\System.Data.SQLite.Linq.dll - @@ -212,7 +204,6 @@ Component - SplashWindow.xaml 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 -{ - /// - /// Class Sqlite - /// - public static class Sqlite - { - /// - /// Connects to db. - /// - /// The db path. - /// Task{IDbConnection}. - /// dbPath - public static async Task 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 @@ - \ No newline at end of file