Skip to content

Commit

Permalink
fix logger not counting properly. also added if condition if there ar…
Browse files Browse the repository at this point in the history
…e no common folder in extension data, this fixed previous bug where dlc unlocking not working.
  • Loading branch information
turusudiro committed Sep 15, 2023
1 parent 9a45b2d commit a3065c2
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions Services/SteamService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ namespace SteamEmuUtility.Services
{
public interface ISteamService
{
Task GetDLCStore(Game game, GlobalProgressActionArgs a);
Task<bool> GetDLCStore(Game game, GlobalProgressActionArgs a);
}
public class SteamService : ISteamService
{
Expand All @@ -26,7 +26,7 @@ public SteamService(SteamEmuUtility plugin, ILogger logger)
this.plugin = plugin;
CommonPath = Path.Combine(plugin.GetPluginUserDataPath(), "Common");
}
public async Task GetDLCStore(Game game, GlobalProgressActionArgs a)
public async Task<bool> GetDLCStore(Game game, GlobalProgressActionArgs a)
{
using (HttpClient client = new HttpClient())
{
Expand All @@ -39,11 +39,23 @@ public async Task GetDLCStore(Game game, GlobalProgressActionArgs a)
appDetails = json[json.Keys.First()];
if (appDetails.data.dlc != null)
{
logger.Info($"Found {appDetails.data.dlc} DLC");
logger.Info($"Found {appDetails.data.dlc.Count} DLC");
string[] dlc = appDetails.data.dlc.Select(i => i.ToString()).ToArray();
if (!Directory.Exists(CommonPath))
{
Directory.CreateDirectory(CommonPath);
}
File.WriteAllLines($"{CommonPath}\\{game.GameId}.txt", dlc);
return true;
}

else
{
return false;
}
}
else
{
return false;
}
}
}
Expand Down

0 comments on commit a3065c2

Please sign in to comment.