mirror of
https://github.com/Prowlarr/Prowlarr
synced 2026-04-13 16:30:48 +02:00
Include NzbDrone.Update in mono/osx package Do not ignore certificate warnings for services Check hash before extracting update New: Update support for Linux/OS X - see the wiki for more information
30 lines
802 B
C#
30 lines
802 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.StreamFile(packagePath))
|
|
{
|
|
var hash = fileStream.SHA256Hash();
|
|
|
|
return hash.Equals(updatePackage.Hash, StringComparison.CurrentCultureIgnoreCase);
|
|
}
|
|
}
|
|
}
|
|
}
|