From 8fd65da1910a8dd8e77ce2f01e5d9f899f6c6fa6 Mon Sep 17 00:00:00 2001 From: erri120 Date: Sun, 1 Dec 2019 15:44:01 +0100 Subject: [PATCH] Fixed NexusDownloader.Verify to work with non MO2 games --- Wabbajack.Lib/Downloaders/NexusDownloader.cs | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/Wabbajack.Lib/Downloaders/NexusDownloader.cs b/Wabbajack.Lib/Downloaders/NexusDownloader.cs index bacb18e4..b925852e 100644 --- a/Wabbajack.Lib/Downloaders/NexusDownloader.cs +++ b/Wabbajack.Lib/Downloaders/NexusDownloader.cs @@ -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)