Merge pull request #788 from Bond-009/warnings

Fix more warnings
This commit is contained in:
Andrew Rabert 2019-02-02 14:21:03 -05:00 committed by GitHub
commit 42d5a48491
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 31 additions and 25 deletions

View File

@ -601,20 +601,26 @@ namespace Emby.Server.Implementations.IO
/// </summary>
public void Dispose()
{
_disposed = true;
Dispose(true);
}
/// <summary>
/// Releases unmanaged and - optionally - managed resources.
/// </summary>
/// <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)
/// <param name="disposing"><c>true</c> to release both managed and unmanaged resources; <c>false</c> to release only unmanaged resources.</param>
protected virtual void Dispose(bool disposing)
{
if (dispose)
if (_disposed)
{
return;
}
if (disposing)
{
Stop();
}
_disposed = true;
}
}

View File

@ -35,7 +35,6 @@ using MediaBrowser.Model.Providers;
using MediaBrowser.Model.Querying;
using MediaBrowser.Model.Reflection;
using MediaBrowser.Model.Serialization;
using MediaBrowser.Model.System;
using MediaBrowser.Model.Threading;
using Microsoft.Extensions.Logging;
@ -275,7 +274,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
foreach (var timer in seriesTimers)
{
await UpdateTimersForSeriesTimer(timer, false, true).ConfigureAwait(false);
UpdateTimersForSeriesTimer(timer, false, true);
}
}
@ -763,12 +762,12 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
_timerProvider.AddOrUpdate(timer, false);
}
await UpdateTimersForSeriesTimer(info, true, false).ConfigureAwait(false);
UpdateTimersForSeriesTimer(info, true, false);
return info.Id;
}
public async Task UpdateSeriesTimerAsync(SeriesTimerInfo info, CancellationToken cancellationToken)
public Task UpdateSeriesTimerAsync(SeriesTimerInfo info, CancellationToken cancellationToken)
{
var instance = _seriesTimerProvider.GetAll().FirstOrDefault(i => string.Equals(i.Id, info.Id, StringComparison.OrdinalIgnoreCase));
@ -792,8 +791,10 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
_seriesTimerProvider.Update(instance);
await UpdateTimersForSeriesTimer(instance, true, true).ConfigureAwait(false);
UpdateTimersForSeriesTimer(instance, true, true);
}
return Task.CompletedTask;
}
public Task UpdateTimerAsync(TimerInfo updatedTimer, CancellationToken cancellationToken)
@ -2346,10 +2347,9 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
}
}
private async Task UpdateTimersForSeriesTimer(SeriesTimerInfo seriesTimer, bool updateTimerSettings, bool deleteInvalidTimers)
private void UpdateTimersForSeriesTimer(SeriesTimerInfo seriesTimer, bool updateTimerSettings, bool deleteInvalidTimers)
{
var allTimers = GetTimersForSeries(seriesTimer)
.ToList();
var allTimers = GetTimersForSeries(seriesTimer).ToList();
var enabledTimersForSeries = new List<TimerInfo>();

View File

@ -94,7 +94,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts
var now = DateTime.UtcNow;
StartStreaming(response, taskCompletionSource, LiveStreamCancellationTokenSource.Token);
var _ = StartStreaming(response, taskCompletionSource, LiveStreamCancellationTokenSource.Token);
//OpenedMediaSource.Protocol = MediaProtocol.File;
//OpenedMediaSource.Path = tempFile;

View File

@ -164,7 +164,7 @@ namespace Emby.Server.Implementations.Updates
/// Gets all available packages.
/// </summary>
/// <returns>Task{List{PackageInfo}}.</returns>
public async Task<List<PackageInfo>> GetAvailablePackages(CancellationToken cancellationToken,
public Task<List<PackageInfo>> GetAvailablePackages(CancellationToken cancellationToken,
bool withRegistration = true,
string packageType = null,
Version applicationVersion = null)
@ -172,7 +172,7 @@ namespace Emby.Server.Implementations.Updates
// TODO cvium: when plugins get back this would need to be fixed
// var packages = await GetAvailablePackagesWithoutRegistrationInfo(cancellationToken).ConfigureAwait(false);
return new List<PackageInfo>(); //FilterPackages(packages, packageType, applicationVersion);
return Task.FromResult(new List<PackageInfo>()); //FilterPackages(packages, packageType, applicationVersion);
}
/// <summary>

View File

@ -62,7 +62,7 @@ namespace Jellyfin.Server
// $JELLYFIN_LOG_DIR needs to be set for the logger configuration manager
Environment.SetEnvironmentVariable("JELLYFIN_LOG_DIR", appPaths.LogDirectoryPath);
await createLogger(appPaths);
await CreateLogger(appPaths);
_logger = _loggerFactory.CreateLogger("Main");
AppDomain.CurrentDomain.UnhandledException += (sender, e)
@ -95,7 +95,7 @@ namespace Jellyfin.Server
_logger.LogInformation("Jellyfin version: {Version}", Assembly.GetEntryAssembly().GetName().Version);
EnvironmentInfo environmentInfo = new EnvironmentInfo(getOperatingSystem());
EnvironmentInfo environmentInfo = new EnvironmentInfo(GetOperatingSystem());
ApplicationHost.LogEnvironmentInfo(_logger, appPaths, environmentInfo);
SQLitePCL.Batteries_V2.Init();
@ -251,7 +251,7 @@ namespace Jellyfin.Server
return new ServerApplicationPaths(programDataPath, appPath, appPath, logDir, configDir, cacheDir);
}
private static async Task createLogger(IApplicationPaths appPaths)
private static async Task CreateLogger(IApplicationPaths appPaths)
{
try
{
@ -311,7 +311,7 @@ namespace Jellyfin.Server
return new NullImageEncoder();
}
private static MediaBrowser.Model.System.OperatingSystem getOperatingSystem()
private static MediaBrowser.Model.System.OperatingSystem GetOperatingSystem()
{
switch (Environment.OSVersion.Platform)
{

View File

@ -197,7 +197,7 @@ namespace MediaBrowser.Api
throw new ResourceNotFoundException(string.Format("Package not found: {0}", request.Name));
}
Task.Run(() => _installationManager.InstallPackage(package, true, new SimpleProgress<double>(), CancellationToken.None));
await _installationManager.InstallPackage(package, true, new SimpleProgress<double>(), CancellationToken.None);
}
/// <summary>

View File

@ -247,14 +247,14 @@ namespace MediaBrowser.Api.UserLibrary
/// Posts the specified request.
/// </summary>
/// <param name="request">The request.</param>
public async Task<object> Post(MarkPlayedItem request)
public object Post(MarkPlayedItem request)
{
var result = await MarkPlayed(request).ConfigureAwait(false);
var result = MarkPlayed(request);
return ToOptimizedResult(result);
}
private async Task<UserItemDataDto> MarkPlayed(MarkPlayedItem request)
private UserItemDataDto MarkPlayed(MarkPlayedItem request)
{
var user = _userManager.GetUserById(request.UserId);
@ -403,10 +403,10 @@ namespace MediaBrowser.Api.UserLibrary
{
var task = MarkUnplayed(request);
return ToOptimizedResult(task.Result);
return ToOptimizedResult(task);
}
private async Task<UserItemDataDto> MarkUnplayed(MarkUnplayedItem request)
private UserItemDataDto MarkUnplayed(MarkUnplayedItem request)
{
var user = _userManager.GetUserById(request.UserId);