moved dependencies for mono
This commit is contained in:
parent
7e7b8043f4
commit
f98b611deb
|
@ -11,7 +11,7 @@ using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
|
|
||||||
namespace MediaBrowser.ServerApplication.EntryPoints
|
namespace MediaBrowser.Server.Implementations.EntryPoints
|
||||||
{
|
{
|
||||||
public class LibraryChangedNotifier : IServerEntryPoint
|
public class LibraryChangedNotifier : IServerEntryPoint
|
||||||
{
|
{
|
||||||
|
@ -48,12 +48,13 @@ namespace MediaBrowser.ServerApplication.EntryPoints
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private const int LibraryUpdateDuration = 60000;
|
private const int LibraryUpdateDuration = 60000;
|
||||||
|
|
||||||
public LibraryChangedNotifier(ILibraryManager libraryManager, ISessionManager sessionManager, IServerManager serverManager, IUserManager userManager)
|
public LibraryChangedNotifier(ILibraryManager libraryManager, ISessionManager sessionManager, IServerManager serverManager, IUserManager userManager, ILogger logger)
|
||||||
{
|
{
|
||||||
_libraryManager = libraryManager;
|
_libraryManager = libraryManager;
|
||||||
_sessionManager = sessionManager;
|
_sessionManager = sessionManager;
|
||||||
_serverManager = serverManager;
|
_serverManager = serverManager;
|
||||||
_userManager = userManager;
|
_userManager = userManager;
|
||||||
|
_logger = logger;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Run()
|
public void Run()
|
|
@ -3,7 +3,7 @@ using MediaBrowser.Controller.Plugins;
|
||||||
using MediaBrowser.Model.Logging;
|
using MediaBrowser.Model.Logging;
|
||||||
using System;
|
using System;
|
||||||
|
|
||||||
namespace MediaBrowser.ServerApplication.EntryPoints
|
namespace MediaBrowser.Server.Implementations.EntryPoints
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Class LoadRegistrations
|
/// Class LoadRegistrations
|
|
@ -2,7 +2,7 @@
|
||||||
using MediaBrowser.Controller.Plugins;
|
using MediaBrowser.Controller.Plugins;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
|
|
||||||
namespace MediaBrowser.ServerApplication.EntryPoints
|
namespace MediaBrowser.Server.Implementations.EntryPoints
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Class RefreshUsersMetadata
|
/// Class RefreshUsersMetadata
|
|
@ -13,7 +13,7 @@ using MediaBrowser.Model.Tasks;
|
||||||
using MediaBrowser.Model.Updates;
|
using MediaBrowser.Model.Updates;
|
||||||
using System;
|
using System;
|
||||||
|
|
||||||
namespace MediaBrowser.ServerApplication.EntryPoints
|
namespace MediaBrowser.Server.Implementations.EntryPoints
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Class WebSocketEvents
|
/// Class WebSocketEvents
|
|
@ -64,12 +64,6 @@
|
||||||
<SpecificVersion>False</SpecificVersion>
|
<SpecificVersion>False</SpecificVersion>
|
||||||
<HintPath>..\packages\ServiceStack.Common.3.9.54\lib\net35\ServiceStack.Interfaces.dll</HintPath>
|
<HintPath>..\packages\ServiceStack.Common.3.9.54\lib\net35\ServiceStack.Interfaces.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="ServiceStack.OrmLite">
|
|
||||||
<HintPath>..\packages\ServiceStack.OrmLite.Sqlite32.3.9.54\lib\net40\ServiceStack.OrmLite.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="ServiceStack.OrmLite.SqliteNET">
|
|
||||||
<HintPath>..\packages\ServiceStack.OrmLite.Sqlite32.3.9.54\lib\net40\ServiceStack.OrmLite.SqliteNET.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="ServiceStack.OrmLite.SqlServer, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
<Reference Include="ServiceStack.OrmLite.SqlServer, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||||
<SpecificVersion>False</SpecificVersion>
|
<SpecificVersion>False</SpecificVersion>
|
||||||
<HintPath>..\packages\ServiceStack.OrmLite.SqlServer.3.9.43\lib\ServiceStack.OrmLite.SqlServer.dll</HintPath>
|
<HintPath>..\packages\ServiceStack.OrmLite.SqlServer.3.9.43\lib\ServiceStack.OrmLite.SqlServer.dll</HintPath>
|
||||||
|
@ -115,6 +109,10 @@
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="BdInfo\BdInfoExaminer.cs" />
|
<Compile Include="BdInfo\BdInfoExaminer.cs" />
|
||||||
<Compile Include="Configuration\ServerConfigurationManager.cs" />
|
<Compile Include="Configuration\ServerConfigurationManager.cs" />
|
||||||
|
<Compile Include="EntryPoints\LibraryChangedNotifier.cs" />
|
||||||
|
<Compile Include="EntryPoints\LoadRegistrations.cs" />
|
||||||
|
<Compile Include="EntryPoints\RefreshUsersMetadata.cs" />
|
||||||
|
<Compile Include="EntryPoints\WebSocketEvents.cs" />
|
||||||
<Compile Include="HttpServer\HttpResultFactory.cs" />
|
<Compile Include="HttpServer\HttpResultFactory.cs" />
|
||||||
<Compile Include="HttpServer\HttpServer.cs" />
|
<Compile Include="HttpServer\HttpServer.cs" />
|
||||||
<Compile Include="HttpServer\NativeWebSocket.cs" />
|
<Compile Include="HttpServer\NativeWebSocket.cs" />
|
||||||
|
|
|
@ -1,11 +1,9 @@
|
||||||
using MediaBrowser.Common.Configuration;
|
using MediaBrowser.Common.Configuration;
|
||||||
using MediaBrowser.Model.Entities;
|
using MediaBrowser.Model.Entities;
|
||||||
using MediaBrowser.Model.Logging;
|
using MediaBrowser.Model.Logging;
|
||||||
using MediaBrowser.Model.Serialization;
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Data;
|
using System.Data;
|
||||||
using System.Data.SQLite;
|
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
@ -14,7 +12,7 @@ namespace MediaBrowser.Server.Implementations.Persistence
|
||||||
{
|
{
|
||||||
public class SqliteChapterRepository
|
public class SqliteChapterRepository
|
||||||
{
|
{
|
||||||
private SQLiteConnection _connection;
|
private IDbConnection _connection;
|
||||||
|
|
||||||
private readonly ILogger _logger;
|
private readonly ILogger _logger;
|
||||||
|
|
||||||
|
@ -23,8 +21,8 @@ namespace MediaBrowser.Server.Implementations.Persistence
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private readonly IApplicationPaths _appPaths;
|
private readonly IApplicationPaths _appPaths;
|
||||||
|
|
||||||
private SQLiteCommand _deleteChaptersCommand;
|
private IDbCommand _deleteChaptersCommand;
|
||||||
private SQLiteCommand _saveChapterCommand;
|
private IDbCommand _saveChapterCommand;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of the <see cref="SqliteItemRepository" /> class.
|
/// Initializes a new instance of the <see cref="SqliteItemRepository" /> class.
|
||||||
|
@ -80,23 +78,18 @@ namespace MediaBrowser.Server.Implementations.Persistence
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private void PrepareStatements()
|
private void PrepareStatements()
|
||||||
{
|
{
|
||||||
_deleteChaptersCommand = new SQLiteCommand
|
_deleteChaptersCommand = _connection.CreateCommand();
|
||||||
{
|
_deleteChaptersCommand.CommandText = "delete from chapters where ItemId=@ItemId";
|
||||||
CommandText = "delete from chapters where ItemId=@ItemId"
|
_deleteChaptersCommand.Parameters.Add(_deleteChaptersCommand, "@ItemId");
|
||||||
};
|
|
||||||
|
|
||||||
_deleteChaptersCommand.Parameters.Add(new SQLiteParameter("@ItemId"));
|
_saveChapterCommand = _connection.CreateCommand();
|
||||||
|
_saveChapterCommand.CommandText = "replace into chapters (ItemId, ChapterIndex, StartPositionTicks, Name, ImagePath) values (@ItemId, @ChapterIndex, @StartPositionTicks, @Name, @ImagePath)";
|
||||||
|
|
||||||
_saveChapterCommand = new SQLiteCommand
|
_saveChapterCommand.Parameters.Add(_saveChapterCommand, "@ItemId");
|
||||||
{
|
_saveChapterCommand.Parameters.Add(_saveChapterCommand, "@ChapterIndex");
|
||||||
CommandText = "replace into chapters (ItemId, ChapterIndex, StartPositionTicks, Name, ImagePath) values (@ItemId, @ChapterIndex, @StartPositionTicks, @Name, @ImagePath)"
|
_saveChapterCommand.Parameters.Add(_saveChapterCommand, "@StartPositionTicks");
|
||||||
};
|
_saveChapterCommand.Parameters.Add(_saveChapterCommand, "@Name");
|
||||||
|
_saveChapterCommand.Parameters.Add(_saveChapterCommand, "@ImagePath");
|
||||||
_saveChapterCommand.Parameters.Add(new SQLiteParameter("@ItemId"));
|
|
||||||
_saveChapterCommand.Parameters.Add(new SQLiteParameter("@ChapterIndex"));
|
|
||||||
_saveChapterCommand.Parameters.Add(new SQLiteParameter("@StartPositionTicks"));
|
|
||||||
_saveChapterCommand.Parameters.Add(new SQLiteParameter("@Name"));
|
|
||||||
_saveChapterCommand.Parameters.Add(new SQLiteParameter("@ImagePath"));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -116,7 +109,7 @@ namespace MediaBrowser.Server.Implementations.Persistence
|
||||||
{
|
{
|
||||||
cmd.CommandText = "select StartPositionTicks,Name,ImagePath from Chapters where ItemId = @ItemId order by ChapterIndex asc";
|
cmd.CommandText = "select StartPositionTicks,Name,ImagePath from Chapters where ItemId = @ItemId order by ChapterIndex asc";
|
||||||
|
|
||||||
cmd.Parameters.Add("@ItemId", DbType.Guid).Value = id;
|
cmd.Parameters.Add(cmd, "@ItemId", DbType.Guid).Value = id;
|
||||||
|
|
||||||
using (var reader = cmd.ExecuteReader(CommandBehavior.SequentialAccess | CommandBehavior.SingleResult))
|
using (var reader = cmd.ExecuteReader(CommandBehavior.SequentialAccess | CommandBehavior.SingleResult))
|
||||||
{
|
{
|
||||||
|
@ -161,8 +154,8 @@ namespace MediaBrowser.Server.Implementations.Persistence
|
||||||
{
|
{
|
||||||
cmd.CommandText = "select StartPositionTicks,Name,ImagePath from Chapters where ItemId = @ItemId and ChapterIndex=@ChapterIndex";
|
cmd.CommandText = "select StartPositionTicks,Name,ImagePath from Chapters where ItemId = @ItemId and ChapterIndex=@ChapterIndex";
|
||||||
|
|
||||||
cmd.Parameters.Add("@ItemId", DbType.Guid).Value = id;
|
cmd.Parameters.Add(cmd, "@ItemId", DbType.Guid).Value = id;
|
||||||
cmd.Parameters.Add("@ChapterIndex", DbType.Int32).Value = index;
|
cmd.Parameters.Add(cmd, "@ChapterIndex", DbType.Int32).Value = index;
|
||||||
|
|
||||||
using (var reader = cmd.ExecuteReader(CommandBehavior.SequentialAccess | CommandBehavior.SingleResult | CommandBehavior.SingleRow))
|
using (var reader = cmd.ExecuteReader(CommandBehavior.SequentialAccess | CommandBehavior.SingleResult | CommandBehavior.SingleRow))
|
||||||
{
|
{
|
||||||
|
@ -215,16 +208,18 @@ namespace MediaBrowser.Server.Implementations.Persistence
|
||||||
|
|
||||||
await _writeLock.WaitAsync(cancellationToken).ConfigureAwait(false);
|
await _writeLock.WaitAsync(cancellationToken).ConfigureAwait(false);
|
||||||
|
|
||||||
SQLiteTransaction transaction = null;
|
IDbTransaction transaction = null;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
transaction = _connection.BeginTransaction();
|
transaction = _connection.BeginTransaction();
|
||||||
|
|
||||||
// First delete chapters
|
// First delete chapters
|
||||||
_deleteChaptersCommand.Parameters[0].Value = id;
|
_deleteChaptersCommand.GetParameter(0).Value = id;
|
||||||
|
|
||||||
_deleteChaptersCommand.Transaction = transaction;
|
_deleteChaptersCommand.Transaction = transaction;
|
||||||
await _deleteChaptersCommand.ExecuteNonQueryAsync(cancellationToken);
|
|
||||||
|
_deleteChaptersCommand.ExecuteNonQuery();
|
||||||
|
|
||||||
var index = 0;
|
var index = 0;
|
||||||
|
|
||||||
|
@ -232,15 +227,15 @@ namespace MediaBrowser.Server.Implementations.Persistence
|
||||||
{
|
{
|
||||||
cancellationToken.ThrowIfCancellationRequested();
|
cancellationToken.ThrowIfCancellationRequested();
|
||||||
|
|
||||||
_saveChapterCommand.Parameters[0].Value = id;
|
_saveChapterCommand.GetParameter(0).Value = id;
|
||||||
_saveChapterCommand.Parameters[1].Value = index;
|
_saveChapterCommand.GetParameter(1).Value = index;
|
||||||
_saveChapterCommand.Parameters[2].Value = chapter.StartPositionTicks;
|
_saveChapterCommand.GetParameter(2).Value = chapter.StartPositionTicks;
|
||||||
_saveChapterCommand.Parameters[3].Value = chapter.Name;
|
_saveChapterCommand.GetParameter(3).Value = chapter.Name;
|
||||||
_saveChapterCommand.Parameters[4].Value = chapter.ImagePath;
|
_saveChapterCommand.GetParameter(4).Value = chapter.ImagePath;
|
||||||
|
|
||||||
_saveChapterCommand.Transaction = transaction;
|
_saveChapterCommand.Transaction = transaction;
|
||||||
|
|
||||||
await _saveChapterCommand.ExecuteNonQueryAsync(cancellationToken);
|
_saveChapterCommand.ExecuteNonQuery();
|
||||||
|
|
||||||
index++;
|
index++;
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,11 +56,40 @@ namespace MediaBrowser.Server.Implementations.Persistence
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="conn">The conn.</param>
|
/// <param name="conn">The conn.</param>
|
||||||
/// <returns><c>true</c> if the specified conn is open; otherwise, <c>false</c>.</returns>
|
/// <returns><c>true</c> if the specified conn is open; otherwise, <c>false</c>.</returns>
|
||||||
public static bool IsOpen(this SQLiteConnection conn)
|
public static bool IsOpen(this IDbConnection conn)
|
||||||
{
|
{
|
||||||
return conn.State == ConnectionState.Open;
|
return conn.State == ConnectionState.Open;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static IDataParameter GetParameter(this IDbCommand cmd, int index)
|
||||||
|
{
|
||||||
|
return (IDataParameter)cmd.Parameters[index];
|
||||||
|
}
|
||||||
|
|
||||||
|
public static IDataParameter Add(this IDataParameterCollection paramCollection, IDbCommand cmd, string name, DbType type)
|
||||||
|
{
|
||||||
|
var param = cmd.CreateParameter();
|
||||||
|
|
||||||
|
param.ParameterName = name;
|
||||||
|
param.DbType = type;
|
||||||
|
|
||||||
|
paramCollection.Add(param);
|
||||||
|
|
||||||
|
return param;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static IDataParameter Add(this IDataParameterCollection paramCollection, IDbCommand cmd, string name)
|
||||||
|
{
|
||||||
|
var param = cmd.CreateParameter();
|
||||||
|
|
||||||
|
param.ParameterName = name;
|
||||||
|
|
||||||
|
paramCollection.Add(param);
|
||||||
|
|
||||||
|
return param;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets a stream from a DataReader at a given ordinal
|
/// Gets a stream from a DataReader at a given ordinal
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -10,7 +10,6 @@
|
||||||
<package id="ServiceStack" version="3.9.54" targetFramework="net45" />
|
<package id="ServiceStack" version="3.9.54" targetFramework="net45" />
|
||||||
<package id="ServiceStack.Api.Swagger" version="3.9.54" targetFramework="net45" />
|
<package id="ServiceStack.Api.Swagger" version="3.9.54" targetFramework="net45" />
|
||||||
<package id="ServiceStack.Common" version="3.9.54" targetFramework="net45" />
|
<package id="ServiceStack.Common" version="3.9.54" targetFramework="net45" />
|
||||||
<package id="ServiceStack.OrmLite.Sqlite32" version="3.9.54" targetFramework="net45" />
|
|
||||||
<package id="ServiceStack.OrmLite.SqlServer" version="3.9.43" targetFramework="net45" />
|
<package id="ServiceStack.OrmLite.SqlServer" version="3.9.43" targetFramework="net45" />
|
||||||
<package id="ServiceStack.Redis" version="3.9.43" targetFramework="net45" />
|
<package id="ServiceStack.Redis" version="3.9.43" targetFramework="net45" />
|
||||||
<package id="ServiceStack.Text" version="3.9.54" targetFramework="net45" />
|
<package id="ServiceStack.Text" version="3.9.54" targetFramework="net45" />
|
||||||
|
|
|
@ -191,12 +191,8 @@
|
||||||
<Reference Include="PresentationFramework" />
|
<Reference Include="PresentationFramework" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="EntryPoints\LibraryChangedNotifier.cs" />
|
|
||||||
<Compile Include="EntryPoints\LoadRegistrations.cs" />
|
|
||||||
<Compile Include="EntryPoints\RefreshUsersMetadata.cs" />
|
|
||||||
<Compile Include="EntryPoints\StartupWizard.cs" />
|
<Compile Include="EntryPoints\StartupWizard.cs" />
|
||||||
<Compile Include="EntryPoints\UdpServerEntryPoint.cs" />
|
<Compile Include="EntryPoints\UdpServerEntryPoint.cs" />
|
||||||
<Compile Include="EntryPoints\WebSocketEvents.cs" />
|
|
||||||
<Compile Include="Splash\SplashWindow.xaml.cs">
|
<Compile Include="Splash\SplashWindow.xaml.cs">
|
||||||
<DependentUpon>SplashWindow.xaml</DependentUpon>
|
<DependentUpon>SplashWindow.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user