Fixed NexusDownloader.Verify to work with non MO2 games

This commit is contained in:
erri120 2019-12-01 15:44:01 +01:00
parent bb2b199d34
commit 8fd65da191
No known key found for this signature in database
GPG Key ID: A8C0A18D8D4D3135

View File

@ -100,10 +100,21 @@ namespace Wabbajack.Lib.Downloaders
{
try
{
var modfiles = new NexusApiClient().GetModFiles(GameRegistry.GetByMO2ArchiveName(GameName).Game, int.Parse(ModID));
var fileid = ulong.Parse(FileID);
var found = modfiles.files
.FirstOrDefault(file => file.file_id == fileid && file.category_name != null);
var gameMeta = GameRegistry.GetByMO2ArchiveName(GameName) ?? GameRegistry.GetByNexusName(GameName);
if (gameMeta == null)
return false;
var game = gameMeta.Game;
if (!int.TryParse(ModID, out var modID))
return false;
var modFiles = new NexusApiClient().GetModFiles(game, modID);
if (!ulong.TryParse(FileID, out var fileID))
return false;
var found = modFiles.files
.FirstOrDefault(file => file.file_id == fileID && file.category_name != null);
return found != null;
}
catch (Exception ex)