|
|
@@ -161,25 +161,17 @@ namespace GCMM |
|
|
|
return false; |
|
|
|
} |
|
|
|
|
|
|
|
public DateTime GetLastGameUpdateTime() |
|
|
|
public async Task<DateTime> 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("<i>timeupdated:</i>[^<]*<b>([^<]*)</b>"); |
|
|
|
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; |
|
|
|
} |
|
|
|
} |
|
|
|
} |