Fix all warnings

This commit is contained in:
Bond-009 2019-02-02 21:45:29 +01:00
parent 42d5a48491
commit 78e4e2ed92
5 changed files with 31 additions and 45 deletions

View File

@ -261,15 +261,6 @@ namespace Emby.Drawing
return (cacheFilePath, GetMimeType(outputFormat, cacheFilePath), _fileSystem.GetLastWriteTimeUtc(cacheFilePath)); return (cacheFilePath, GetMimeType(outputFormat, cacheFilePath), _fileSystem.GetLastWriteTimeUtc(cacheFilePath));
} }
catch (ArgumentOutOfRangeException ex)
{
// Decoder failed to decode it
#if DEBUG
_logger.LogError(ex, "Error encoding image");
#endif
// Just spit out the original file if all the options are default
return (originalImagePath, MimeTypes.GetMimeType(originalImagePath), dateModified);
}
catch (Exception ex) catch (Exception ex)
{ {
// If it fails for whatever reason, return the original image // If it fails for whatever reason, return the original image

View File

@ -448,30 +448,30 @@ namespace Emby.Server.Implementations.Library
private void UpdateInvalidLoginAttemptCount(User user, int newValue) private void UpdateInvalidLoginAttemptCount(User user, int newValue)
{ {
if (user.Policy.InvalidLoginAttemptCount != newValue || newValue > 0) if (user.Policy.InvalidLoginAttemptCount == newValue || newValue <= 0)
{ {
user.Policy.InvalidLoginAttemptCount = newValue; return;
}
var maxCount = user.Policy.IsAdministrator ? 3 : 5; user.Policy.InvalidLoginAttemptCount = newValue;
// TODO: Fix var maxCount = user.Policy.IsAdministrator ? 3 : 5;
/*
var fireLockout = false;
if (newValue >= maxCount) var fireLockout = false;
{
_logger.LogDebug("Disabling user {0} due to {1} unsuccessful login attempts.", user.Name, newValue.ToString(CultureInfo.InvariantCulture));
user.Policy.IsDisabled = true;
fireLockout = true; if (newValue >= maxCount)
}*/ {
_logger.LogDebug("Disabling user {0} due to {1} unsuccessful login attempts.", user.Name, newValue);
user.Policy.IsDisabled = true;
UpdateUserPolicy(user, user.Policy, false); fireLockout = true;
}
/* if (fireLockout) UpdateUserPolicy(user, user.Policy, false);
{
UserLockedOut?.Invoke(this, new GenericEventArgs<User>(user)); if (fireLockout)
}*/ {
UserLockedOut?.Invoke(this, new GenericEventArgs<User>(user));
} }
} }

View File

@ -64,7 +64,6 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
public static EmbyTV Current; public static EmbyTV Current;
public event EventHandler DataSourceChanged;
public event EventHandler<GenericEventArgs<TimerInfo>> TimerCreated; public event EventHandler<GenericEventArgs<TimerInfo>> TimerCreated;
public event EventHandler<GenericEventArgs<string>> TimerCancelled; public event EventHandler<GenericEventArgs<string>> TimerCancelled;

View File

@ -53,7 +53,7 @@ namespace Emby.Server.Implementations.LiveTv
private readonly LiveTvDtoService _tvDtoService; private readonly LiveTvDtoService _tvDtoService;
private ILiveTvService[] _services = new ILiveTvService[] { }; private ILiveTvService[] _services = Array.Empty<ILiveTvService>();
private ITunerHost[] _tunerHosts = Array.Empty<ITunerHost>(); private ITunerHost[] _tunerHosts = Array.Empty<ITunerHost>();
private IListingsProvider[] _listingProviders = Array.Empty<IListingsProvider>(); private IListingsProvider[] _listingProviders = Array.Empty<IListingsProvider>();
@ -127,8 +127,6 @@ namespace Emby.Server.Implementations.LiveTv
foreach (var service in _services) foreach (var service in _services)
{ {
service.DataSourceChanged += service_DataSourceChanged;
if (service is EmbyTV.EmbyTV embyTv) if (service is EmbyTV.EmbyTV embyTv)
{ {
embyTv.TimerCreated += EmbyTv_TimerCreated; embyTv.TimerCreated += EmbyTv_TimerCreated;
@ -184,14 +182,6 @@ namespace Emby.Server.Implementations.LiveTv
return EmbyTV.EmbyTV.Current.DiscoverTuners(newDevicesOnly, cancellationToken); return EmbyTV.EmbyTV.Current.DiscoverTuners(newDevicesOnly, cancellationToken);
} }
void service_DataSourceChanged(object sender, EventArgs e)
{
if (!_isDisposed)
{
_taskManager.CancelIfRunningAndQueue<RefreshChannelsScheduledTask>();
}
}
public QueryResult<BaseItem> GetInternalChannels(LiveTvChannelQuery query, DtoOptions dtoOptions, CancellationToken cancellationToken) public QueryResult<BaseItem> GetInternalChannels(LiveTvChannelQuery query, DtoOptions dtoOptions, CancellationToken cancellationToken)
{ {
var user = query.UserId.Equals(Guid.Empty) ? null : _userManager.GetUserById(query.UserId); var user = query.UserId.Equals(Guid.Empty) ? null : _userManager.GetUserById(query.UserId);
@ -2153,17 +2143,28 @@ namespace Emby.Server.Implementations.LiveTv
Dispose(true); Dispose(true);
} }
private bool _isDisposed = false; private bool _disposed = false;
/// <summary> /// <summary>
/// Releases unmanaged and - optionally - managed resources. /// Releases unmanaged and - optionally - managed resources.
/// </summary> /// </summary>
/// <param name="dispose"><c>true</c> to release both managed and unmanaged resources; <c>false</c> to release only unmanaged resources.</param> /// <param name="dispose"><c>true</c> to release both managed and unmanaged resources; <c>false</c> to release only unmanaged resources.</param>
protected virtual void Dispose(bool dispose) protected virtual void Dispose(bool dispose)
{ {
if (_disposed)
{
return;
}
if (dispose) if (dispose)
{ {
_isDisposed = true; // TODO: Dispose stuff
} }
_services = null;
_listingProviders = null;
_tunerHosts = null;
_disposed = true;
} }
private LiveTvServiceInfo[] GetServiceInfos() private LiveTvServiceInfo[] GetServiceInfos()

View File

@ -12,11 +12,6 @@ namespace MediaBrowser.Controller.LiveTv
/// </summary> /// </summary>
public interface ILiveTvService public interface ILiveTvService
{ {
/// <summary>
/// Occurs when [data source changed].
/// </summary>
event EventHandler DataSourceChanged;
/// <summary> /// <summary>
/// Gets the name. /// Gets the name.
/// </summary> /// </summary>