2023-09-21 10:53:01 -04:00
|
|
|
|
using SPTInstaller.Helpers;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
|
|
|
|
namespace SPTInstaller.Models.Mirrors.Downloaders;
|
|
|
|
|
public class HttpMirrorDownloader : MirrorDownloaderBase
|
|
|
|
|
{
|
2024-04-27 14:51:54 -04:00
|
|
|
|
public HttpMirrorDownloader(PatchInfoMirror mirror) : base(mirror)
|
2023-09-21 10:53:01 -04:00
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override async Task<FileInfo?> Download(IProgress<double> progress)
|
|
|
|
|
{
|
2024-03-23 14:15:48 -04:00
|
|
|
|
var file = await DownloadCacheHelper.DownloadFileAsync("patcher", MirrorInfo.Link, progress);
|
2023-09-21 18:51:20 -04:00
|
|
|
|
|
|
|
|
|
if (file == null)
|
|
|
|
|
return null;
|
|
|
|
|
|
|
|
|
|
return FileHashHelper.CheckHash(file, MirrorInfo.Hash) ? file : null;
|
2023-09-21 10:53:01 -04:00
|
|
|
|
}
|
|
|
|
|
}
|