mirror of
https://github.com/Readarr/Readarr
synced 2025-12-20 23:35:13 +01:00
banner-35.jpg (height) banner-70.jpg fanart-180.jpg (height) fanart-360.jpg poster-170.jpg (width) poster-340.jpg
30 lines
806 B
C#
30 lines
806 B
C#
using System;
|
|
using NzbDrone.Common.Disk;
|
|
|
|
namespace NzbDrone.Core.Update
|
|
{
|
|
public interface IVerifyUpdates
|
|
{
|
|
Boolean Verify(UpdatePackage updatePackage, String packagePath);
|
|
}
|
|
|
|
public class UpdateVerification : IVerifyUpdates
|
|
{
|
|
private readonly IDiskProvider _diskProvider;
|
|
|
|
public UpdateVerification(IDiskProvider diskProvider)
|
|
{
|
|
_diskProvider = diskProvider;
|
|
}
|
|
|
|
public Boolean Verify(UpdatePackage updatePackage, String packagePath)
|
|
{
|
|
using (var fileStream = _diskProvider.OpenReadStream(packagePath))
|
|
{
|
|
var hash = fileStream.SHA256Hash();
|
|
|
|
return hash.Equals(updatePackage.Hash, StringComparison.CurrentCultureIgnoreCase);
|
|
}
|
|
}
|
|
}
|
|
}
|