Add text about outdated mods, refactor that bit
This commit is contained in:
parent
4eec201547
commit
890a650093
2 changed files with 19 additions and 13 deletions
|
@ -109,21 +109,26 @@ You may also want to verify the game's files by right clicking the game in Steam
|
|||
UpdateButton(installbtn, false);
|
||||
UpdateButton(uninstallbtn, false);
|
||||
bool install = false, update = false;
|
||||
Action<string, Color> addText = (txt, color) =>
|
||||
{
|
||||
int start = modinfobox.Text.Length;
|
||||
modinfobox.AppendText(txt + Environment.NewLine + Environment.NewLine);
|
||||
modinfobox.Select(start, txt.Length);
|
||||
modinfobox.SelectionColor = color;
|
||||
modinfobox.DeselectAll();
|
||||
modinfobox.SelectionColor = modinfobox.ForeColor;
|
||||
};
|
||||
foreach (ListViewItem item in modlist.SelectedItems)
|
||||
{
|
||||
var mod = mods[item.Name];
|
||||
if (modlist.SelectedItems.Count == 1)
|
||||
{
|
||||
bool up = mod.Updatable;
|
||||
modinfobox.Text = ((up ? "New version available! " + mod.UpdateDetails + "\n\n"
|
||||
: "") + mod.Description).Replace("\n", Environment.NewLine);
|
||||
if(up)
|
||||
{
|
||||
modinfobox.Select(0, "New version available!".Length);
|
||||
modinfobox.SelectionColor = Color.Aqua;
|
||||
modinfobox.DeselectAll();
|
||||
modinfobox.SelectionColor = modinfobox.ForeColor;
|
||||
}
|
||||
if (mod.Updatable)
|
||||
addText("New version available! " + mod.UpdateDetails, Color.Aqua);
|
||||
if (mod.LastUpdated < lastGameUpdateTime)
|
||||
addText("Outdated mod! It may not work properly on the latest version of the game.", Color.DarkOrange);
|
||||
if (mod.Description != null)
|
||||
modinfobox.AppendText(mod.Description.Replace("\n", Environment.NewLine));
|
||||
}
|
||||
else
|
||||
modinfobox.Text = modlist.SelectedItems.Count + " mods selected";
|
||||
|
|
|
@ -163,15 +163,16 @@ namespace GCMM
|
|||
|
||||
public async Task<DateTime> GetLastGameUpdateTime()
|
||||
{
|
||||
using (var client = GetClient())
|
||||
/*using (var client = GetClient())
|
||||
{
|
||||
string html = await client.DownloadStringTaskAsync("https://steamdb.info/app/1078000/depots/?branch=public");
|
||||
string html = await client.DownloadStringTaskAsync("https://api.steamcmd.net/v1/info/1078000");
|
||||
var regex = new Regex("<i>timeupdated:</i>[^<]*<b>([^<]*)</b>");
|
||||
var match = regex.Match(html);
|
||||
if (!match.Success)
|
||||
return default;
|
||||
return new DateTime(1970, 1, 1).AddSeconds(long.Parse(match.Groups[1].Value));
|
||||
}
|
||||
}*/
|
||||
return new DateTime(2020, 12, 28);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue