Created GetByNexusName function for the GameRegistry

This commit is contained in:
erri120 2019-11-09 15:10:28 +01:00 committed by Timothy Baldridge
parent 233c85b36d
commit 2a92131025
2 changed files with 8 additions and 1 deletions

View File

@ -54,6 +54,11 @@ namespace Wabbajack.Common
return Games.Values.FirstOrDefault(g => g.MO2ArchiveName?.ToLower() == gamename);
}
public static GameMetaData GetByNexusName(string gameName)
{
return Games.Values.FirstOrDefault(g => g.NexusName == gameName.ToLower());
}
public static Dictionary<Game, GameMetaData> Games = new Dictionary<Game, GameMetaData>
{

View File

@ -16,6 +16,7 @@ namespace Wabbajack.Lib
{
public class VortexCompiler : ACompiler
{
public Game Game { get; }
public string GameName { get; }
public string VortexFolder { get; }
@ -35,6 +36,7 @@ namespace Wabbajack.Lib
GamePath = gamePath;
GameName = gameName;
Game = GameRegistry.GetByNexusName(GameName).Game;
// currently only works if staging and downloads folder is in the standard directory
// aka %APPDATADA%\Vortex\
@ -267,7 +269,7 @@ namespace Wabbajack.Lib
hash = BitConverter.ToString(cH).Replace("-", "").ToLowerInvariant();
}
var md5Response = nexusClient.GetModInfoFromMD5(GameName, hash);
var md5Response = nexusClient.GetModInfoFromMD5(game, hash);
var modInfo = md5Response[0].mod;
metaString += $"modID={modInfo.mod_id}\ndescription={NexusApiUtils.FixupSummary(modInfo.summary)}\n" +
$"modName={modInfo.name}\nfileID={md5Response[0].file_details.file_id}";