mono fixes

This commit is contained in:
Luke Pulverenti 2013-10-04 16:08:45 -04:00
parent b40991b28d
commit 54a5d63a61
22 changed files with 31 additions and 124 deletions

View File

@ -66,16 +66,14 @@ namespace MediaBrowser.Api.DefaultTheme
private readonly ILogger _logger;
private readonly ILibraryManager _libraryManager;
private readonly ILocalizationManager _localization;
private readonly IImageProcessor _imageProcessor;
public DefaultThemeService(IUserManager userManager, IDtoService dtoService, ILogger logger, ILibraryManager libraryManager, ILocalizationManager localization, IImageProcessor imageProcessor)
public DefaultThemeService(IUserManager userManager, IDtoService dtoService, ILogger logger, ILibraryManager libraryManager, IImageProcessor imageProcessor)
{
_userManager = userManager;
_dtoService = dtoService;
_logger = logger;
_libraryManager = libraryManager;
_localization = localization;
_imageProcessor = imageProcessor;
}

View File

@ -48,11 +48,6 @@ namespace MediaBrowser.Api.UserLibrary
/// </summary>
public class YearsService : BaseItemsByNameService<Year>
{
/// <summary>
/// The us culture
/// </summary>
private static readonly CultureInfo UsCulture = new CultureInfo("en-US");
public YearsService(IUserManager userManager, ILibraryManager libraryManager, IUserDataManager userDataRepository, IItemRepository itemRepo, IDtoService dtoService)
: base(userManager, libraryManager, userDataRepository, itemRepo, dtoService)
{

View File

@ -555,11 +555,6 @@ namespace MediaBrowser.Common.Implementations.HttpClientManager
{
throw new ArgumentNullException("url");
}
if (cancellationToken == null)
{
throw new ArgumentNullException("cancellationToken");
}
}
/// <summary>

View File

@ -361,11 +361,6 @@ namespace MediaBrowser.Common.Implementations.Updates
throw new ArgumentNullException("progress");
}
if (cancellationToken == null)
{
throw new ArgumentNullException("cancellationToken");
}
var installationInfo = new InstallationInfo
{
Id = Guid.NewGuid(),

View File

@ -1066,7 +1066,7 @@ namespace MediaBrowser.Controller.Entities
/// <returns>IList{BaseItem}.</returns>
public IList<BaseItem> GetRecursiveChildren()
{
return GetRecursiveChildren(null, null, true);
return GetRecursiveChildren(i => true);
}
/// <summary>

View File

@ -130,17 +130,17 @@ namespace MediaBrowser.Controller.Localization
{
value = field.GetValue(stringData) as string;
}
catch (TargetException ex)
catch (TargetException)
{
//Logger.ErrorException("Error getting value for field: {0}", ex, field.Name);
continue;
}
catch (FieldAccessException ex)
catch (FieldAccessException)
{
//Logger.ErrorException("Error getting value for field: {0}", ex, field.Name);
continue;
}
catch (NotSupportedException ex)
catch (NotSupportedException)
{
//Logger.ErrorException("Error getting value for field: {0}", ex, field.Name);
continue;

View File

@ -382,22 +382,23 @@ namespace MediaBrowser.Server.Implementations.HttpServer
/// <returns>Task.</returns>
private async Task ProcessWebSocketRequest(HttpListenerContext ctx)
{
#if __MonoCS__
#else
try
{
var webSocketContext = await ctx.AcceptWebSocketAsync(null).ConfigureAwait(false);
if (WebSocketConnected != null)
{
WebSocketConnected(this, new WebSocketConnectEventArgs { WebSocket = new NativeWebSocket(webSocketContext.WebSocket, _logger), Endpoint = ctx.Request.RemoteEndPoint.ToString() });
}
}
catch (Exception ex)
{
_logger.ErrorException("AcceptWebSocketAsync error", ex);
ctx.Response.StatusCode = 500;
ctx.Response.Close();
}
{
var webSocketContext = await ctx.AcceptWebSocketAsync(null).ConfigureAwait(false);
if (WebSocketConnected != null)
{
WebSocketConnected(this, new WebSocketConnectEventArgs { WebSocket = new NativeWebSocket(webSocketContext.WebSocket, _logger), Endpoint = ctx.Request.RemoteEndPoint.ToString() });
}
}
catch (Exception ex)
{
_logger.ErrorException("AcceptWebSocketAsync error", ex);
ctx.Response.StatusCode = 500;
ctx.Response.Close();
}
#endif
}
/// <summary>
@ -532,7 +533,12 @@ namespace MediaBrowser.Server.Implementations.HttpServer
{
get
{
if (!_supportsNativeWebSocket.HasValue)
#if __MonoCS__
return false;
#else
#endif
if (!_supportsNativeWebSocket.HasValue)
{
try
{

View File

@ -57,10 +57,6 @@ namespace MediaBrowser.Server.Implementations.Library
{
throw new ArgumentNullException("userData");
}
if (cancellationToken == null)
{
throw new ArgumentNullException("cancellationToken");
}
if (userId == Guid.Empty)
{
throw new ArgumentNullException("userId");

View File

@ -15,20 +15,14 @@ namespace MediaBrowser.Server.Implementations.Library.Validators
/// </summary>
private readonly ILibraryManager _libraryManager;
/// <summary>
/// The _user manager
/// </summary>
private readonly IUserManager _userManager;
/// <summary>
/// Initializes a new instance of the <see cref="GameGenresPostScanTask"/> class.
/// </summary>
/// <param name="libraryManager">The library manager.</param>
/// <param name="userManager">The user manager.</param>
public GameGenresPostScanTask(ILibraryManager libraryManager, IUserManager userManager)
public GameGenresPostScanTask(ILibraryManager libraryManager)
{
_libraryManager = libraryManager;
_userManager = userManager;
}
/// <summary>

View File

@ -12,20 +12,14 @@ namespace MediaBrowser.Server.Implementations.Library.Validators
/// </summary>
private readonly ILibraryManager _libraryManager;
/// <summary>
/// The _user manager
/// </summary>
private readonly IUserManager _userManager;
/// <summary>
/// Initializes a new instance of the <see cref="ArtistsPostScanTask" /> class.
/// </summary>
/// <param name="libraryManager">The library manager.</param>
/// <param name="userManager">The user manager.</param>
public GenresPostScanTask(ILibraryManager libraryManager, IUserManager userManager)
public GenresPostScanTask(ILibraryManager libraryManager)
{
_libraryManager = libraryManager;
_userManager = userManager;
}
/// <summary>

View File

@ -15,20 +15,14 @@ namespace MediaBrowser.Server.Implementations.Library.Validators
/// </summary>
private readonly ILibraryManager _libraryManager;
/// <summary>
/// The _user manager
/// </summary>
private readonly IUserManager _userManager;
/// <summary>
/// Initializes a new instance of the <see cref="ArtistsPostScanTask" /> class.
/// </summary>
/// <param name="libraryManager">The library manager.</param>
/// <param name="userManager">The user manager.</param>
public MusicGenresPostScanTask(ILibraryManager libraryManager, IUserManager userManager)
public MusicGenresPostScanTask(ILibraryManager libraryManager)
{
_libraryManager = libraryManager;
_userManager = userManager;
}
/// <summary>

View File

@ -15,20 +15,14 @@ namespace MediaBrowser.Server.Implementations.Library.Validators
/// </summary>
private readonly ILibraryManager _libraryManager;
/// <summary>
/// The _user manager
/// </summary>
private readonly IUserManager _userManager;
/// <summary>
/// Initializes a new instance of the <see cref="ArtistsPostScanTask" /> class.
/// </summary>
/// <param name="libraryManager">The library manager.</param>
/// <param name="userManager">The user manager.</param>
public StudiosPostScanTask(ILibraryManager libraryManager, IUserManager userManager)
public StudiosPostScanTask(ILibraryManager libraryManager)
{
_libraryManager = libraryManager;
_userManager = userManager;
}
/// <summary>

View File

@ -594,11 +594,6 @@ namespace MediaBrowser.Server.Implementations.MediaEncoder
throw new ArgumentNullException("outputPath");
}
if (cancellationToken == null)
{
throw new ArgumentNullException("cancellationToken");
}
var slowSeekParam = offset.TotalSeconds > 0 ? " -ss " + offset.TotalSeconds.ToString(UsCulture) : string.Empty;
var process = new Process

View File

@ -188,11 +188,6 @@ namespace MediaBrowser.Server.Implementations.Persistence
throw new ArgumentNullException("chapters");
}
if (cancellationToken == null)
{
throw new ArgumentNullException("cancellationToken");
}
cancellationToken.ThrowIfCancellationRequested();
await _writeLock.WaitAsync(cancellationToken).ConfigureAwait(false);

View File

@ -112,10 +112,6 @@ namespace MediaBrowser.Server.Implementations.Persistence
{
throw new ArgumentNullException("displayPreferences.Id");
}
if (cancellationToken == null)
{
throw new ArgumentNullException("cancellationToken");
}
cancellationToken.ThrowIfCancellationRequested();

View File

@ -186,11 +186,6 @@ namespace MediaBrowser.Server.Implementations.Persistence
throw new ArgumentNullException("items");
}
if (cancellationToken == null)
{
throw new ArgumentNullException("cancellationToken");
}
cancellationToken.ThrowIfCancellationRequested();
await _writeLock.WaitAsync(cancellationToken).ConfigureAwait(false);
@ -456,11 +451,6 @@ namespace MediaBrowser.Server.Implementations.Persistence
throw new ArgumentNullException("children");
}
if (cancellationToken == null)
{
throw new ArgumentNullException("cancellationToken");
}
cancellationToken.ThrowIfCancellationRequested();
await _writeLock.WaitAsync(cancellationToken).ConfigureAwait(false);

View File

@ -116,10 +116,6 @@ namespace MediaBrowser.Server.Implementations.Persistence
{
throw new ArgumentNullException("userData");
}
if (cancellationToken == null)
{
throw new ArgumentNullException("cancellationToken");
}
if (userId == Guid.Empty)
{
throw new ArgumentNullException("userId");

View File

@ -98,11 +98,6 @@ namespace MediaBrowser.Server.Implementations.Persistence
throw new ArgumentNullException("user");
}
if (cancellationToken == null)
{
throw new ArgumentNullException("cancellationToken");
}
cancellationToken.ThrowIfCancellationRequested();
var serialized = _jsonSerializer.SerializeToBytes(user);
@ -199,11 +194,6 @@ namespace MediaBrowser.Server.Implementations.Persistence
throw new ArgumentNullException("user");
}
if (cancellationToken == null)
{
throw new ArgumentNullException("cancellationToken");
}
cancellationToken.ThrowIfCancellationRequested();
await _writeLock.WaitAsync(cancellationToken).ConfigureAwait(false);

View File

@ -269,10 +269,6 @@ namespace MediaBrowser.Server.Implementations.Providers
{
throw new ArgumentNullException();
}
if (cancellationToken == null)
{
throw new ArgumentNullException();
}
if (cancellationToken.IsCancellationRequested)
{

View File

@ -285,11 +285,6 @@ namespace MediaBrowser.Server.Implementations.ServerManager
throw new ArgumentNullException("dataFunction");
}
if (cancellationToken == null)
{
throw new ArgumentNullException("cancellationToken");
}
cancellationToken.ThrowIfCancellationRequested();
var connectionsList = connections.Where(s => s.State == WebSocketState.Open).ToList();

View File

@ -216,11 +216,6 @@ namespace MediaBrowser.Server.Implementations.ServerManager
throw new ArgumentNullException("buffer");
}
if (cancellationToken == null)
{
throw new ArgumentNullException("cancellationToken");
}
cancellationToken.ThrowIfCancellationRequested();
// Per msdn docs, attempting to send simultaneous messages will result in one failing.

View File

@ -47,8 +47,6 @@ namespace MediaBrowser.Server.Mono
bool createdNew;
var runningPath = Process.GetCurrentProcess().MainModule.FileName.Replace(Path.DirectorySeparatorChar.ToString(), string.Empty);
//_singleInstanceMutex = new Mutex(true, @"Local\" + runningPath, out createdNew);
createdNew = true;