2013-06-28 03:04:52 +03:00
|
|
|
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();
|
|
|
|
|
2013-08-24 05:21:12 +03:00
|
|
|
if (latestAvailable == null)
|
2013-06-28 03:04:52 +03:00
|
|
|
{
|
|
|
|
_logger.Debug("No update available.");
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
return latestAvailable;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|