Skip to content

Commit

Permalink
disabling asset downloader during 'download all' shouldn't effect man…
Browse files Browse the repository at this point in the history
…ually running the downloader (#308)
  • Loading branch information
mattpannella authored May 29, 2024
1 parent fd3fa75 commit a14f63a
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions src/services/CoresService.Download.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public void DownloadCoreAssets(List<Core> cores)

WriteMessage(core.identifier);

var results = this.DownloadAssets(core);
var results = this.DownloadAssets(core, true);

installedAssets.AddRange((List<string>)results["installed"]);
skippedAssets.AddRange((List<string>)results["skipped"]);
Expand Down Expand Up @@ -80,14 +80,23 @@ public void DownloadCoreAssets(List<Core> cores)
OnUpdateProcessComplete(args);
}

public Dictionary<string, object> DownloadAssets(Core core)
public Dictionary<string, object> DownloadAssets(Core core, bool ignoreGlobalSetting = false)
{
List<string> installed = new List<string>();
List<string> skipped = new List<string>();
bool missingBetaKey = false;
bool run = false;

//run if:
//globaloverride is on and core specific is on
//or
//globaloverride is off, global setting is on, and core specific is on
if ((ignoreGlobalSetting && this.settingsService.GetCoreSettings(core.identifier).download_assets)
|| (!ignoreGlobalSetting && this.settingsService.GetConfig().download_assets && this.settingsService.GetCoreSettings(core.identifier).download_assets)) {
run = true;
}

if (!this.settingsService.GetConfig().download_assets ||
!this.settingsService.GetCoreSettings(core.identifier).download_assets)
if (!run)
{
return new Dictionary<string, object>
{
Expand All @@ -96,7 +105,7 @@ public Dictionary<string, object> DownloadAssets(Core core)
{ "missingBetaKey", false }
};
}

WriteMessage("Looking for Assets...");
Archive archive = this.archiveService.GetArchive(core.identifier);
AnalogueCore info = this.ReadCoreJson(core.identifier);
Expand Down

0 comments on commit a14f63a

Please sign in to comment.