2019-10-07 17:33:34 +00:00
|
|
|
|
using System.Linq;
|
2019-10-03 04:35:29 +00:00
|
|
|
|
using Wabbajack.Common;
|
|
|
|
|
|
2019-10-16 03:10:34 +00:00
|
|
|
|
namespace Wabbajack.Lib.Updater
|
2019-10-03 04:35:29 +00:00
|
|
|
|
{
|
|
|
|
|
public class CheckForUpdates
|
|
|
|
|
{
|
|
|
|
|
private ModList _modlist;
|
|
|
|
|
private string _modlistPath;
|
|
|
|
|
|
|
|
|
|
public CheckForUpdates(string path)
|
|
|
|
|
{
|
|
|
|
|
_modlistPath = path;
|
|
|
|
|
_modlist = Installer.LoadFromFile(path);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public bool FindOutdatedMods()
|
|
|
|
|
{
|
|
|
|
|
var installer = new Installer(_modlistPath, _modlist, "");
|
|
|
|
|
Utils.Log($"Checking links for {_modlist.Archives.Count} archives");
|
|
|
|
|
|
|
|
|
|
var results = _modlist.Archives.PMap(f =>
|
|
|
|
|
{
|
|
|
|
|
var result = installer.DownloadArchive(f, false);
|
|
|
|
|
if (result) return false;
|
|
|
|
|
Utils.Log($"Unable to resolve link for {f.Name}. If this is hosted on the Nexus the file may have been removed.");
|
|
|
|
|
return true;
|
|
|
|
|
|
|
|
|
|
}).ToList();
|
|
|
|
|
|
|
|
|
|
return results.Any();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|