wabbajack/Wabbajack.Common/GameMetaData.cs

208 lines
7.8 KiB
C#
Raw Normal View History

2019-11-09 13:51:51 +00:00
using System.Collections.Generic;
2019-09-29 00:22:25 +00:00
using System.Linq;
using Alphaleonis.Win32.Filesystem;
2019-09-29 00:22:25 +00:00
using Microsoft.Win32;
namespace Wabbajack.Common
{
public enum Game {
//MO2 GAMES
Morrowind,
2019-09-29 00:22:25 +00:00
Oblivion,
Fallout3,
FalloutNewVegas,
Skyrim,
SkyrimSpecialEdition,
Fallout4,
SkyrimVR,
//VORTEX GAMES
DarkestDungeon,
DivinityOriginalSins2,
DivinityOriginalSins2DE //definitive edition has its own nexus page but same Steam/GOG ids
2019-09-29 00:22:25 +00:00
}
public class GameMetaData
{
public ModManager SupportedModManager { get; internal set; }
2019-09-29 00:22:25 +00:00
public string MO2ArchiveName { get; internal set; }
public Game Game { get; internal set; }
public string NexusName { get; internal set; }
public string MO2Name { get; internal set; }
public string GameLocationRegistryKey { get; internal set; }
2019-11-05 13:10:42 +00:00
public List<int> SteamIDs { get; internal set; }
2019-11-05 14:51:52 +00:00
public int GOGID { get; internal set; }
2019-11-09 20:34:44 +00:00
public List<string> AdditionalFolders { get; internal set; }
2019-09-29 00:22:25 +00:00
public string GameLocation
{
get
{
if (Consts.TestMode)
return Directory.GetCurrentDirectory();
return (string) Registry.GetValue(GameLocationRegistryKey, "installed path", null)
??
(string) Registry.GetValue(
GameLocationRegistryKey.Replace(@"HKEY_LOCAL_MACHINE\SOFTWARE\",
@"HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\"), "installed path", null);
}
}
2019-09-29 00:22:25 +00:00
}
public class GameRegistry
{
public static GameMetaData GetByMO2ArchiveName(string gameName)
{
var gamename = gameName.ToLower();
return Games.Values.FirstOrDefault(g => g.MO2ArchiveName?.ToLower() == gamename);
2019-09-29 00:22:25 +00:00
}
public static GameMetaData GetByNexusName(string gameName)
{
return Games.Values.FirstOrDefault(g => g.NexusName == gameName.ToLower());
}
2019-09-29 00:22:25 +00:00
public static Dictionary<Game, GameMetaData> Games = new Dictionary<Game, GameMetaData>
{
2019-11-09 14:40:14 +00:00
/*{
Game.Morrowind, new GameMetaData()
2019-11-09 14:40:14 +00:00
},*/
2019-09-29 00:22:25 +00:00
{
Game.Oblivion, new GameMetaData
{
SupportedModManager = ModManager.MO2,
2019-09-29 00:22:25 +00:00
Game = Game.Oblivion,
NexusName = "oblivion",
MO2Name = "Oblivion",
MO2ArchiveName = "oblivion",
2019-11-05 13:10:42 +00:00
GameLocationRegistryKey = @"HKEY_LOCAL_MACHINE\SOFTWARE\Bethesda Softworks\Oblivion",
SteamIDs = new List<int> {22330}
2019-09-29 00:22:25 +00:00
}
},
{
Game.Fallout3, new GameMetaData
{
SupportedModManager = ModManager.MO2,
2019-09-29 00:22:25 +00:00
Game = Game.Fallout3,
NexusName = "fallout3",
MO2Name = "fallout3",
MO2ArchiveName = "fallout3",
2019-11-05 13:10:42 +00:00
GameLocationRegistryKey = @"HKEY_LOCAL_MACHINE\SOFTWARE\Bethesda Softworks\Fallout3",
SteamIDs = new List<int> {22300, 22370} // base game and GotY
2019-09-29 00:22:25 +00:00
}
},
{
Game.FalloutNewVegas, new GameMetaData
{
SupportedModManager = ModManager.MO2,
2019-09-29 00:22:25 +00:00
Game = Game.FalloutNewVegas,
NexusName = "newvegas",
MO2Name = "New Vegas",
MO2ArchiveName = "falloutnv",
2019-11-05 13:10:42 +00:00
GameLocationRegistryKey = @"HKEY_LOCAL_MACHINE\SOFTWARE\Bethesda Softworks\falloutnv",
SteamIDs = new List<int> {22380}
2019-09-29 00:22:25 +00:00
}
},
{
Game.Skyrim, new GameMetaData
{
SupportedModManager = ModManager.MO2,
2019-09-29 00:22:25 +00:00
Game = Game.Skyrim,
NexusName = "skyrim",
MO2Name = "Skyrim",
MO2ArchiveName = "skyrim",
2019-11-05 13:10:42 +00:00
GameLocationRegistryKey = @"HKEY_LOCAL_MACHINE\SOFTWARE\Bethesda Softworks\skyrim",
SteamIDs = new List<int> {72850}
2019-09-29 00:22:25 +00:00
}
},
{
Game.SkyrimSpecialEdition, new GameMetaData
{
SupportedModManager = ModManager.MO2,
2019-09-29 00:22:25 +00:00
Game = Game.SkyrimSpecialEdition,
NexusName = "skyrimspecialedition",
MO2Name = "Skyrim Special Edition",
MO2ArchiveName = "skyrimse",
2019-11-05 13:10:42 +00:00
GameLocationRegistryKey = @"HKEY_LOCAL_MACHINE\SOFTWARE\Bethesda Softworks\Skyrim Special Edition",
SteamIDs = new List<int> {489830}
2019-09-29 00:22:25 +00:00
}
},
{
Game.Fallout4, new GameMetaData
{
SupportedModManager = ModManager.MO2,
2019-09-29 00:22:25 +00:00
Game = Game.Fallout4,
NexusName = "fallout4",
MO2Name = "Fallout 4",
MO2ArchiveName = "fallout4",
2019-11-05 13:10:42 +00:00
GameLocationRegistryKey = @"HKEY_LOCAL_MACHINE\SOFTWARE\Bethesda Softworks\Fallout4",
SteamIDs = new List<int> {377160}
2019-09-29 00:22:25 +00:00
}
},
2019-11-05 13:10:42 +00:00
/*{
Game.Fallout4VR, new GameMetaData
{
SupportedModManager = ModManager.MO2,
Game = Game.Fallout4VR,
NexusName = "fallout4",
MO2Name = "Fallout 4",
MO2ArchiveName = "fallout4",
SteamIDs = new List<int>{611660}
}
},*/
{
Game.SkyrimVR, new GameMetaData
{
SupportedModManager = ModManager.MO2,
Game = Game.SkyrimVR,
NexusName = "skyrimspecialedition",
MO2Name = "Skyrim VR",
MO2ArchiveName = "skyrimse",
2019-11-05 13:10:42 +00:00
GameLocationRegistryKey = @"HKEY_LOCAL_MACHINE\SOFTWARE\Bethesda Softworks\Skyrim VR",
SteamIDs = new List<int> {611670}
}
},
{
2019-11-05 14:51:52 +00:00
Game.DarkestDungeon, new GameMetaData
{
SupportedModManager = ModManager.Vortex,
Game = Game.DarkestDungeon,
2019-11-05 13:10:42 +00:00
NexusName = "darkestdungeon",
SteamIDs = new List<int> {262060},
2019-11-05 14:51:52 +00:00
GOGID = 1450711444
}
},
{
Game.DivinityOriginalSins2, new GameMetaData
{
SupportedModManager = ModManager.Vortex,
Game = Game.DivinityOriginalSins2,
NexusName = "divinityoriginalsins2",
SteamIDs = new List<int> {435150},
2019-11-09 20:34:44 +00:00
GOGID = 1584823040,
AdditionalFolders = new List<string>
{
"%documents%\\Larian Studios\\Divinity Original Sin 2\\Mods\\",
}
}
},
{
Game.DivinityOriginalSins2DE, new GameMetaData
{
SupportedModManager = ModManager.Vortex,
Game = Game.DivinityOriginalSins2DE,
NexusName = "divinityoriginalsin2definitiveedition",
SteamIDs = new List<int> {435150},
GOGID = 1584823040,
AdditionalFolders = new List<string>
{
2019-11-09 20:34:44 +00:00
"%documents%\\Larian Studios\\Divinity Original Sin 2 Definitive Edition\\Mods\\"
}
}
2019-09-29 00:22:25 +00:00
}
};
}
}