Drunk programming isn't necessarily a good idea
This commit is contained in:
parent
854e02dd0d
commit
4eec201547
2 changed files with 7 additions and 15 deletions
|
@ -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)
|
private async void refreshbtn_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
CheckIfPatched(); //Set from placeholder
|
CheckIfPatched(); //Set from placeholder
|
||||||
lastGameUpdateTime = GetLastGameUpdateTime();
|
lastGameUpdateTime = await GetLastGameUpdateTime();
|
||||||
var mods = GetInstalledMods();
|
var mods = GetInstalledMods();
|
||||||
await GetAvailableMods();
|
await GetAvailableMods();
|
||||||
CheckUninstalledMods(mods);
|
CheckUninstalledMods(mods);
|
||||||
|
|
|
@ -161,25 +161,17 @@ namespace GCMM
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public DateTime GetLastGameUpdateTime()
|
public async Task<DateTime> GetLastGameUpdateTime()
|
||||||
{
|
{
|
||||||
if (GetExe() == null)
|
using (var client = GetClient())
|
||||||
return default;
|
|
||||||
foreach (var line in File.ReadAllLines(GamePath(@"\..\..\appmanifest_1078000.acf")))
|
|
||||||
{
|
{
|
||||||
var regex = new Regex("\\t\"LastUpdated\"\\t\\t\"(\\d+)\"");
|
string html = await client.DownloadStringTaskAsync("https://steamdb.info/app/1078000/depots/?branch=public");
|
||||||
var match = regex.Match(line);
|
var regex = new Regex("<i>timeupdated:</i>[^<]*<b>([^<]*)</b>");
|
||||||
|
var match = regex.Match(html);
|
||||||
if (!match.Success)
|
if (!match.Success)
|
||||||
continue;
|
|
||||||
string updated = match.Groups[1].Value;
|
|
||||||
if (string.IsNullOrWhiteSpace(updated))
|
|
||||||
return default;
|
return default;
|
||||||
var updatedTime = new DateTime(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc);
|
return new DateTime(1970, 1, 1).AddSeconds(long.Parse(match.Groups[1].Value));
|
||||||
updatedTime = updatedTime.AddSeconds(double.Parse(updated)).ToLocalTime();
|
|
||||||
return updatedTime;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
return default;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue