From 3352ce5e31c0cbbad7890b2a3b889211ca2c51d0 Mon Sep 17 00:00:00 2001 From: "waffle.lord" Date: Sat, 23 Mar 2024 15:54:59 -0400 Subject: [PATCH] use downladofileasync instead of downloadasync. This seems to give better performance --- .../Mirrors/Downloaders/MegaMirrorDownloader.cs | 11 +++++++---- SPTInstaller/SPTInstaller.csproj | 4 ++-- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/SPTInstaller/Models/Mirrors/Downloaders/MegaMirrorDownloader.cs b/SPTInstaller/Models/Mirrors/Downloaders/MegaMirrorDownloader.cs index bf1e343..5d4f949 100644 --- a/SPTInstaller/Models/Mirrors/Downloaders/MegaMirrorDownloader.cs +++ b/SPTInstaller/Models/Mirrors/Downloaders/MegaMirrorDownloader.cs @@ -21,11 +21,14 @@ public class MegaMirrorDownloader : MirrorDownloaderBase try { - using var megaDownloadStream = await megaClient.DownloadAsync(new Uri(MirrorInfo.Link), progress); + var file = new FileInfo(Path.Join(DownloadCacheHelper.CachePath, "patcher")); + + await megaClient.DownloadFileAsync(new Uri(MirrorInfo.Link), + file.FullName, progress); + + file.Refresh(); - var file = await DownloadCacheHelper.DownloadFileAsync("patcher", megaDownloadStream); - - if (file == null) + if (!file.Exists) return null; return FileHashHelper.CheckHash(file, MirrorInfo.Hash) ? file : null; diff --git a/SPTInstaller/SPTInstaller.csproj b/SPTInstaller/SPTInstaller.csproj index 6122a87..92cd3ea 100644 --- a/SPTInstaller/SPTInstaller.csproj +++ b/SPTInstaller/SPTInstaller.csproj @@ -9,8 +9,8 @@ icon.ico Assets\icon.ico Debug;Release;TEST - 2.42 - 2.42 + 2.43 + 2.43 SPT-AKI