Skip to content

Commit

Permalink
Fix problems with updating games with manifest v1
Browse files Browse the repository at this point in the history
  • Loading branch information
hawkeye116477 committed Nov 19, 2024
1 parent 8ec5f09 commit 58cbc78
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 9 deletions.
14 changes: 13 additions & 1 deletion src/GogOssGameController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -605,7 +605,19 @@ public async Task<Dictionary<string, UpdateInfo>> CheckGameUpdates(string gameTi
var newGameInfo = await Gogdl.GetGameInfo(oldGameData, false, true, forceRefreshCache);
if (newGameInfo.buildId != null)
{
if (installedInfo.build_id != newGameInfo.buildId)
bool updateAvailable = false;
if (installedInfo.build_id == newGameInfo.buildId)
{
if (installedInfo.build_id != newGameInfo.builds.items[0].legacy_build_id)
{
updateAvailable = true;
}
}
else
{
updateAvailable = true;
}
if (updateAvailable)
{
var updateSize = await Gogdl.CalculateGameSize(gameId, installedInfo);
DateTimeFormatInfo formatInfo = CultureInfo.CurrentCulture.DateTimeFormat;
Expand Down
7 changes: 6 additions & 1 deletion src/GogOssGameInstallerView.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -581,7 +581,12 @@ private async Task RefreshVersions()
versionNameFirstPart = "";
}
var versionName = $"{versionNameFirstPart}{build.date_published.ToLocalTime().ToString("d", formatInfo)}";
gameVersions.Add(build.build_id, versionName);
var buildId = build.legacy_build_id;
if (buildId.IsNullOrEmpty())
{
buildId = build.build_id;
}
gameVersions.Add(buildId, versionName);
}
}
GameVersionCBo.ItemsSource = gameVersions;
Expand Down
15 changes: 8 additions & 7 deletions src/Models/GogDownloadGameInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ public class GogDownloadGameInfo
public bool errorDisplayed = false;
public Dictionary<string, SizeType> size { get; set; } = new Dictionary<string, SizeType>();
public List<Dlc> dlcs { get; set; } = new List<Dlc>();
public string buildId { get; set; }
public string buildId { get; set; } = "";
public List<string> languages { get; set; } = new List<string>();
public string folder_name { get; set; } = "";
public List<string> dependencies { get; set; } = new List<string>();
public string versionEtag { get; set; }
public string versionName { get; set; }
public string versionName { get; set; } = "";
public List<string> available_branches { get; set; } = new List<string>();
public Builds builds { get; set; } = new Builds();
public GogDownloadRedistManifest.Executable executable { get; set; } = new GogDownloadRedistManifest.Executable();
Expand Down Expand Up @@ -42,13 +42,14 @@ public class Builds

public class Item
{
public string build_id { get; set; }
public string product_id { get; set; }
public string os { get; set; }
public string legacy_build_id { get; set; } = "";
public string build_id { get; set; } = "";
public string product_id { get; set; } = "";
public string os { get; set; } = "";
public string branch { get; set; }
public string version_name { get; set; }
public string version_name { get; set; } = "";
public string[] tags { get; set; }
public bool _public { get; set; }
public bool _public { get; set; } = false;
public DateTime date_published { get; set; }
public int generation { get; set; }
public string link { get; set; }
Expand Down

0 comments on commit 58cbc78

Please sign in to comment.