2019-09-29 00:22:25 +00:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
2019-10-03 03:23:11 +00:00
|
|
|
|
using System.Reflection;
|
2019-09-29 00:22:25 +00:00
|
|
|
|
using System.Security.Cryptography.X509Certificates;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
2019-10-03 03:23:11 +00:00
|
|
|
|
using Alphaleonis.Win32.Filesystem;
|
2019-09-29 00:22:25 +00:00
|
|
|
|
using Microsoft.Win32;
|
|
|
|
|
|
|
|
|
|
namespace Wabbajack.Common
|
|
|
|
|
{
|
|
|
|
|
public enum Game {
|
2019-10-19 10:55:05 +00:00
|
|
|
|
Morrowind,
|
2019-09-29 00:22:25 +00:00
|
|
|
|
Oblivion,
|
|
|
|
|
Fallout3,
|
|
|
|
|
FalloutNewVegas,
|
|
|
|
|
Skyrim,
|
|
|
|
|
SkyrimSpecialEdition,
|
2019-10-01 22:39:25 +00:00
|
|
|
|
Fallout4,
|
|
|
|
|
SkyrimVR
|
2019-09-29 00:22:25 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public class GameMetaData
|
|
|
|
|
{
|
|
|
|
|
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-10-03 03:23:11 +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();
|
2019-11-09 14:25:29 +00:00
|
|
|
|
return Games.Values.FirstOrDefault(g => g.MO2ArchiveName.ToLower() == gamename);
|
2019-09-29 00:22:25 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static Dictionary<Game, GameMetaData> Games = new Dictionary<Game, GameMetaData>
|
|
|
|
|
{
|
2019-10-19 10:55:05 +00:00
|
|
|
|
{
|
|
|
|
|
Game.Morrowind, new GameMetaData()
|
|
|
|
|
},
|
2019-09-29 00:22:25 +00:00
|
|
|
|
{
|
|
|
|
|
Game.Oblivion, new GameMetaData
|
|
|
|
|
{
|
|
|
|
|
Game = Game.Oblivion,
|
|
|
|
|
NexusName = "oblivion",
|
2019-10-02 22:45:42 +00:00
|
|
|
|
MO2Name = "Oblivion",
|
2019-11-09 14:21:31 +00:00
|
|
|
|
MO2ArchiveName = "oblivion",
|
2019-09-29 00:22:25 +00:00
|
|
|
|
GameLocationRegistryKey = @"HKEY_LOCAL_MACHINE\SOFTWARE\Bethesda Softworks\Oblivion"
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
Game.Fallout3, new GameMetaData
|
|
|
|
|
{
|
|
|
|
|
Game = Game.Fallout3,
|
|
|
|
|
NexusName = "fallout3",
|
|
|
|
|
MO2Name = "fallout3",
|
|
|
|
|
MO2ArchiveName = "fallout3",
|
|
|
|
|
GameLocationRegistryKey = @"HKEY_LOCAL_MACHINE\SOFTWARE\Bethesda Softworks\Fallout3"
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
Game.FalloutNewVegas, new GameMetaData
|
|
|
|
|
{
|
|
|
|
|
Game = Game.FalloutNewVegas,
|
|
|
|
|
NexusName = "newvegas",
|
|
|
|
|
MO2Name = "New Vegas",
|
|
|
|
|
MO2ArchiveName = "falloutnv",
|
|
|
|
|
GameLocationRegistryKey = @"HKEY_LOCAL_MACHINE\SOFTWARE\Bethesda Softworks\falloutnv"
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
Game.Skyrim, new GameMetaData
|
|
|
|
|
{
|
|
|
|
|
Game = Game.Skyrim,
|
|
|
|
|
NexusName = "skyrim",
|
|
|
|
|
MO2Name = "Skyrim",
|
|
|
|
|
MO2ArchiveName = "skyrim",
|
|
|
|
|
GameLocationRegistryKey = @"HKEY_LOCAL_MACHINE\SOFTWARE\Bethesda Softworks\skyrim"
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
Game.SkyrimSpecialEdition, new GameMetaData
|
|
|
|
|
{
|
|
|
|
|
Game = Game.SkyrimSpecialEdition,
|
|
|
|
|
NexusName = "skyrimspecialedition",
|
|
|
|
|
MO2Name = "Skyrim Special Edition",
|
|
|
|
|
MO2ArchiveName = "skyrimse",
|
|
|
|
|
GameLocationRegistryKey = @"HKEY_LOCAL_MACHINE\SOFTWARE\Bethesda Softworks\Skyrim Special Edition"
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
Game.Fallout4, new GameMetaData
|
|
|
|
|
{
|
|
|
|
|
Game = Game.Fallout4,
|
|
|
|
|
NexusName = "fallout4",
|
|
|
|
|
MO2Name = "Fallout 4",
|
|
|
|
|
MO2ArchiveName = "fallout4",
|
|
|
|
|
GameLocationRegistryKey = @"HKEY_LOCAL_MACHINE\SOFTWARE\Bethesda Softworks\Fallout4"
|
|
|
|
|
}
|
2019-10-01 22:39:25 +00:00
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
Game.SkyrimVR, new GameMetaData
|
|
|
|
|
{
|
|
|
|
|
Game = Game.SkyrimVR,
|
|
|
|
|
NexusName = "skyrimspecialedition",
|
|
|
|
|
MO2Name = "Skyrim VR",
|
|
|
|
|
MO2ArchiveName = "skyrimse",
|
|
|
|
|
GameLocationRegistryKey = @"HKEY_LOCAL_MACHINE\SOFTWARE\Bethesda Softworks\Skyrim VR"
|
|
|
|
|
}
|
2019-09-29 00:22:25 +00:00
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
}
|