Skip to content
This repository has been archived by the owner on Nov 29, 2020. It is now read-only.

Commit

Permalink
Improved modpack import to no longer download mods that are already i…
Browse files Browse the repository at this point in the history
…nstalled.
  • Loading branch information
Artentus committed Oct 12, 2018
1 parent a811ca6 commit 479fd0a
Showing 1 changed file with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,13 @@ private FileSystemInfo GetIncludedFileOrDirectory(ModExportTemplate modTemplate,

private async Task DownloadModRelease(ModExportTemplate modTemplate, ModRelease release, DirectoryInfo fileLocation, IProgress<double> progress, CancellationToken cancellationToken)
{
var installedMod = Mods.FindByFactorioVersion(modTemplate.Name, release.InfoFile.FactorioVersion);
if ((installedMod != null) && (installedMod.Version >= release.Version))
{
modTemplate.Mod = installedMod;
return;
}

string token;
GlobalCredentials.Instance.LogIn(Window, out token);

Expand Down Expand Up @@ -205,7 +212,7 @@ private async Task ImportModpackFileV2(ExportTemplate template, DirectoryInfo fi
var progressWindow = new ProgressWindow() { Owner = Window };
var progressViewModel = (ProgressViewModel)progressWindow.ViewModel;
progressViewModel.ActionName = App.Instance.GetLocalizedResourceString("ImportingAction");
progressViewModel.ProgressDescription = App.Instance.GetLocalizedResourceString("Downloading mods");
progressViewModel.ProgressDescription = App.Instance.GetLocalizedResourceString("ImportingDownloadingDescription");

var progress = new Progress<double>(p => progressViewModel.Progress = p);

Expand Down Expand Up @@ -251,7 +258,8 @@ private async Task ImportModpackFileV2(ExportTemplate template, DirectoryInfo fi
{
foreach (var modTemplate in template.Mods)
{
await AddMod(modTemplate, fileLocation);
if (modTemplate.Mod == null)
await AddMod(modTemplate, fileLocation);
}

foreach (var modpackTemplate in template.Modpacks)
Expand Down

0 comments on commit 479fd0a

Please sign in to comment.