fix first install includes ALL updates

This commit is contained in:
2024-12-05 06:56:45 +01:00
parent e50d5f4874
commit a83d109f24

View File

@@ -59,7 +59,7 @@ public class ModpackInstaller(ModpackConfig updateConfig, ModpackInfo modpackInf
} }
installInfos = await DownloadInstallInfos(); installInfos = await DownloadInstallInfos();
result.CurrentVersion = modpackInfo.Version ?? new Version("0.0.0.0"); result.CurrentVersion = modpackInfo.Version ?? installInfos.Version;
var curVersion = result.CurrentVersion; var curVersion = result.CurrentVersion;
// Check install actions // Check install actions
@@ -222,6 +222,8 @@ public class ModpackInstaller(ModpackConfig updateConfig, ModpackInfo modpackInf
Directory.CreateDirectory(Path.GetDirectoryName(destFilePath)); Directory.CreateDirectory(Path.GetDirectoryName(destFilePath));
if (!isZip || localZipCache.FirstOrDefault(n => n.DownloadUrl == sourceUrl) is not LocalZipCacheEntry cachedZipInfo) if (!isZip || localZipCache.FirstOrDefault(n => n.DownloadUrl == sourceUrl) is not LocalZipCacheEntry cachedZipInfo)
{
try
{ {
// Download // Download
var fsDestinationPath = isZip ? Path.Combine(Path.GetTempPath(), $"mc_update_file_{DateTime.Now.ToBinary()}.zip") : destFilePath; var fsDestinationPath = isZip ? Path.Combine(Path.GetTempPath(), $"mc_update_file_{DateTime.Now.ToBinary()}.zip") : destFilePath;
@@ -253,6 +255,11 @@ public class ModpackInstaller(ModpackConfig updateConfig, ModpackInfo modpackInf
else else
cachedZipInfo = null; cachedZipInfo = null;
} }
catch (HttpRequestException ex)
{
throw;
}
}
// Handle zip file content // Handle zip file content
if (cachedZipInfo != null) if (cachedZipInfo != null)