Skip to content

Commit

Permalink
Add game count to EGL
Browse files Browse the repository at this point in the history
  • Loading branch information
suchmememanyskill committed Dec 25, 2023
1 parent 5f5e2df commit d50f353
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 2 additions & 1 deletion LegendaryIntegration/LegendaryGameSource.cs
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ public List<Command> GetGlobalCommands()
commands.Add(new($"Logged in as {auth.StatusResponse.AccountName}"));
if (auth.OfflineLogin)
commands.Add(new("Started in offline mode"));
commands.Add(new($"Loaded {manager?.LastGameCount ?? 0} games"));
}

commands.Add(new());
Expand Down Expand Up @@ -229,7 +230,7 @@ public async Task<string> UrlGet(string url)

public async void Download(LegendaryGame game)
{
if (_sdl_games.ContainsKey(game.InternalName))
if (_sdl_games.ContainsKey(game.InternalName) && !game.IsInstalled)
{
string data = await UrlGet(_sdl_games[game.InternalName]);
Dictionary<string, LegendaryTags> tags =
Expand Down
2 changes: 2 additions & 0 deletions LegendaryIntegration/Service/LegendaryGameManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ public class LegendaryGameManager
public LegendaryAuth Auth { get; private set; }
public Config Config => _storage.Data;
private readonly Storage<Config> _storage;
public int LastGameCount { get; private set; }

public LegendaryGameManager(LegendaryAuth auth, IApp app)
{
Expand Down Expand Up @@ -73,6 +74,7 @@ public async Task<List<LegendaryGame>> GetGames()
games.RemoveAll(x => !x.IsInstalled);

games = games.OrderBy(x => x.Name).ToList();
LastGameCount = games.Count;
_downloads.ForEach(x => games.Find(y => y.InternalName == x.Game.InternalName)?.ReattachDownload(x));
return games;
}
Expand Down

0 comments on commit d50f353

Please sign in to comment.