mirror of
https://github.com/Sonarr/Sonarr.git
synced 2024-12-16 11:37:58 +02:00
38 lines
911 B
C#
38 lines
911 B
C#
using NLog;
|
|
using NzbDrone.Common.EnvironmentInfo;
|
|
|
|
namespace NzbDrone.Core.Update
|
|
{
|
|
public interface ICheckUpdateService
|
|
{
|
|
UpdatePackage AvailableUpdate();
|
|
}
|
|
|
|
|
|
public class CheckUpdateService : ICheckUpdateService
|
|
{
|
|
private readonly IUpdatePackageProvider _updatePackageProvider;
|
|
|
|
private readonly Logger _logger;
|
|
|
|
|
|
public CheckUpdateService(IUpdatePackageProvider updatePackageProvider, Logger logger)
|
|
{
|
|
_updatePackageProvider = updatePackageProvider;
|
|
_logger = logger;
|
|
}
|
|
|
|
public UpdatePackage AvailableUpdate()
|
|
{
|
|
var latestAvailable = _updatePackageProvider.GetLatestUpdate();
|
|
|
|
if (latestAvailable == null)
|
|
{
|
|
_logger.Debug("No update available.");
|
|
return null;
|
|
}
|
|
|
|
return latestAvailable;
|
|
}
|
|
}
|
|
} |