moved dependencies for mono

pull/702/head
Luke Pulverenti 11 years ago
parent 7e7b8043f4
commit f98b611deb

@ -11,7 +11,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Threading;
namespace MediaBrowser.ServerApplication.EntryPoints
namespace MediaBrowser.Server.Implementations.EntryPoints
{
public class LibraryChangedNotifier : IServerEntryPoint
{
@ -48,12 +48,13 @@ namespace MediaBrowser.ServerApplication.EntryPoints
/// </summary>
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;
_sessionManager = sessionManager;
_serverManager = serverManager;
_userManager = userManager;
_logger = logger;
}
public void Run()

@ -3,7 +3,7 @@ using MediaBrowser.Controller.Plugins;
using MediaBrowser.Model.Logging;
using System;
namespace MediaBrowser.ServerApplication.EntryPoints
namespace MediaBrowser.Server.Implementations.EntryPoints
{
/// <summary>
/// Class LoadRegistrations

@ -2,7 +2,7 @@
using MediaBrowser.Controller.Plugins;
using System.Threading;
namespace MediaBrowser.ServerApplication.EntryPoints
namespace MediaBrowser.Server.Implementations.EntryPoints
{
/// <summary>
/// Class RefreshUsersMetadata

@ -13,7 +13,7 @@ using MediaBrowser.Model.Tasks;
using MediaBrowser.Model.Updates;
using System;
namespace MediaBrowser.ServerApplication.EntryPoints
namespace MediaBrowser.Server.Implementations.EntryPoints
{
/// <summary>
/// Class WebSocketEvents

@ -64,12 +64,6 @@
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\ServiceStack.Common.3.9.54\lib\net35\ServiceStack.Interfaces.dll</HintPath>
</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">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\ServiceStack.OrmLite.SqlServer.3.9.43\lib\ServiceStack.OrmLite.SqlServer.dll</HintPath>
@ -115,6 +109,10 @@
</Compile>
<Compile Include="BdInfo\BdInfoExaminer.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\HttpServer.cs" />
<Compile Include="HttpServer\NativeWebSocket.cs" />

@ -1,11 +1,9 @@
using MediaBrowser.Common.Configuration;
using MediaBrowser.Model.Entities;
using MediaBrowser.Model.Logging;
using MediaBrowser.Model.Serialization;
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SQLite;
using System.IO;
using System.Threading;
using System.Threading.Tasks;
@ -14,7 +12,7 @@ namespace MediaBrowser.Server.Implementations.Persistence
{
public class SqliteChapterRepository
{
private SQLiteConnection _connection;
private IDbConnection _connection;
private readonly ILogger _logger;
@ -23,8 +21,8 @@ namespace MediaBrowser.Server.Implementations.Persistence
/// </summary>
private readonly IApplicationPaths _appPaths;
private SQLiteCommand _deleteChaptersCommand;
private SQLiteCommand _saveChapterCommand;
private IDbCommand _deleteChaptersCommand;
private IDbCommand _saveChapterCommand;
/// <summary>
/// Initializes a new instance of the <see cref="SqliteItemRepository" /> class.
@ -80,23 +78,18 @@ namespace MediaBrowser.Server.Implementations.Persistence
/// </summary>
private void PrepareStatements()
{
_deleteChaptersCommand = new SQLiteCommand
{
CommandText = "delete from chapters where ItemId=@ItemId"
};
_deleteChaptersCommand.Parameters.Add(new SQLiteParameter("@ItemId"));
_saveChapterCommand = new SQLiteCommand
{
CommandText = "replace into chapters (ItemId, ChapterIndex, StartPositionTicks, Name, ImagePath) values (@ItemId, @ChapterIndex, @StartPositionTicks, @Name, @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"));
_deleteChaptersCommand = _connection.CreateCommand();
_deleteChaptersCommand.CommandText = "delete from chapters where ItemId=@ItemId";
_deleteChaptersCommand.Parameters.Add(_deleteChaptersCommand, "@ItemId");
_saveChapterCommand = _connection.CreateCommand();
_saveChapterCommand.CommandText = "replace into chapters (ItemId, ChapterIndex, StartPositionTicks, Name, ImagePath) values (@ItemId, @ChapterIndex, @StartPositionTicks, @Name, @ImagePath)";
_saveChapterCommand.Parameters.Add(_saveChapterCommand, "@ItemId");
_saveChapterCommand.Parameters.Add(_saveChapterCommand, "@ChapterIndex");
_saveChapterCommand.Parameters.Add(_saveChapterCommand, "@StartPositionTicks");
_saveChapterCommand.Parameters.Add(_saveChapterCommand, "@Name");
_saveChapterCommand.Parameters.Add(_saveChapterCommand, "@ImagePath");
}
/// <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.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))
{
@ -161,8 +154,8 @@ namespace MediaBrowser.Server.Implementations.Persistence
{
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("@ChapterIndex", DbType.Int32).Value = index;
cmd.Parameters.Add(cmd, "@ItemId", DbType.Guid).Value = id;
cmd.Parameters.Add(cmd, "@ChapterIndex", DbType.Int32).Value = index;
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);
SQLiteTransaction transaction = null;
IDbTransaction transaction = null;
try
{
transaction = _connection.BeginTransaction();
// First delete chapters
_deleteChaptersCommand.Parameters[0].Value = id;
_deleteChaptersCommand.GetParameter(0).Value = id;
_deleteChaptersCommand.Transaction = transaction;
await _deleteChaptersCommand.ExecuteNonQueryAsync(cancellationToken);
_deleteChaptersCommand.ExecuteNonQuery();
var index = 0;
@ -232,15 +227,15 @@ namespace MediaBrowser.Server.Implementations.Persistence
{
cancellationToken.ThrowIfCancellationRequested();
_saveChapterCommand.Parameters[0].Value = id;
_saveChapterCommand.Parameters[1].Value = index;
_saveChapterCommand.Parameters[2].Value = chapter.StartPositionTicks;
_saveChapterCommand.Parameters[3].Value = chapter.Name;
_saveChapterCommand.Parameters[4].Value = chapter.ImagePath;
_saveChapterCommand.GetParameter(0).Value = id;
_saveChapterCommand.GetParameter(1).Value = index;
_saveChapterCommand.GetParameter(2).Value = chapter.StartPositionTicks;
_saveChapterCommand.GetParameter(3).Value = chapter.Name;
_saveChapterCommand.GetParameter(4).Value = chapter.ImagePath;
_saveChapterCommand.Transaction = transaction;
await _saveChapterCommand.ExecuteNonQueryAsync(cancellationToken);
_saveChapterCommand.ExecuteNonQuery();
index++;
}

@ -56,11 +56,40 @@ namespace MediaBrowser.Server.Implementations.Persistence
/// </summary>
/// <param name="conn">The conn.</param>
/// <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;
}
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>
/// Gets a stream from a DataReader at a given ordinal
/// </summary>

@ -10,7 +10,6 @@
<package id="ServiceStack" 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.OrmLite.Sqlite32" version="3.9.54" 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.Text" version="3.9.54" targetFramework="net45" />

@ -191,12 +191,8 @@
<Reference Include="PresentationFramework" />
</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\UdpServerEntryPoint.cs" />
<Compile Include="EntryPoints\WebSocketEvents.cs" />
<Compile Include="Splash\SplashWindow.xaml.cs">
<DependentUpon>SplashWindow.xaml</DependentUpon>
</Compile>

Loading…
Cancel
Save