diff --git a/GCMM/MainForm.cs b/GCMM/MainForm.cs index 976139f..0551dab 100644 --- a/GCMM/MainForm.cs +++ b/GCMM/MainForm.cs @@ -240,7 +240,7 @@ You may also want to verify the game's files by right clicking the game in Steam private async void refreshbtn_Click(object sender, EventArgs e) { CheckIfPatched(); //Set from placeholder - lastGameUpdateTime = GetLastGameUpdateTime(); + lastGameUpdateTime = await GetLastGameUpdateTime(); var mods = GetInstalledMods(); await GetAvailableMods(); CheckUninstalledMods(mods); diff --git a/GCMM/MainUtils.cs b/GCMM/MainUtils.cs index 83867ba..021ec46 100644 --- a/GCMM/MainUtils.cs +++ b/GCMM/MainUtils.cs @@ -161,25 +161,17 @@ namespace GCMM return false; } - public DateTime GetLastGameUpdateTime() + public async Task GetLastGameUpdateTime() { - if (GetExe() == null) - return default; - foreach (var line in File.ReadAllLines(GamePath(@"\..\..\appmanifest_1078000.acf"))) + using (var client = GetClient()) { - var regex = new Regex("\\t\"LastUpdated\"\\t\\t\"(\\d+)\""); - var match = regex.Match(line); + string html = await client.DownloadStringTaskAsync("https://steamdb.info/app/1078000/depots/?branch=public"); + var regex = new Regex("timeupdated:[^<]*([^<]*)"); + var match = regex.Match(html); if (!match.Success) - continue; - string updated = match.Groups[1].Value; - if (string.IsNullOrWhiteSpace(updated)) return default; - var updatedTime = new DateTime(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc); - updatedTime = updatedTime.AddSeconds(double.Parse(updated)).ToLocalTime(); - return updatedTime; - + return new DateTime(1970, 1, 1).AddSeconds(long.Parse(match.Groups[1].Value)); } - return default; } } }