mirror of
https://github.com/wabbajack-tools/wabbajack.git
synced 2024-08-30 18:42:17 +00:00
Merge pull request #249 from wabbajack-tools/multiple-steam-folders
Multiple steam folders
This commit is contained in:
commit
02803c84e2
Compression.BSA.Test
Wabbajack.Common
Wabbajack.Lib
Wabbajack.Test
@ -73,7 +73,7 @@ namespace Compression.BSA.Test
|
||||
var state = new NexusDownloader.State
|
||||
{
|
||||
ModID = info.Item2.ToString(),
|
||||
GameName = GameRegistry.Games[info.Item1].NexusName,
|
||||
GameName = info.Item1.MetaData().NexusName,
|
||||
FileID = file.file_id.ToString()
|
||||
};
|
||||
state.Download(src);
|
||||
|
@ -67,12 +67,13 @@ namespace Wabbajack.Common
|
||||
public List<string> RequiredFiles { get; internal set; }
|
||||
public bool Disabled { get; internal set; }
|
||||
|
||||
public string GameLocation(bool steam)
|
||||
public string GameLocation()
|
||||
{
|
||||
if (Consts.TestMode)
|
||||
return Directory.GetCurrentDirectory();
|
||||
|
||||
return steam ? SteamHandler.Instance.Games.FirstOrDefault(g => g.Game == Game)?.InstallDir : GOGHandler.Instance.Games.FirstOrDefault(g => g.Game == Game)?.Path;
|
||||
return SteamHandler.Instance.Games.FirstOrDefault(g => g.Game == Game)?.InstallDir ??
|
||||
GOGHandler.Instance.Games.FirstOrDefault(g => g.Game == Game)?.Path;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -95,6 +95,9 @@ namespace Wabbajack.Common
|
||||
paths.Add(s);
|
||||
});
|
||||
|
||||
// Default path in the Steam folder isn't in the configs
|
||||
paths.Add(Path.Combine(SteamPath, "steamapps"));
|
||||
|
||||
InstallFolders = paths;
|
||||
}
|
||||
|
||||
|
@ -38,10 +38,10 @@ namespace Wabbajack.Lib
|
||||
protected override bool _Begin()
|
||||
{
|
||||
ConfigureProcessor(18, RecommendQueueSize());
|
||||
var game = GameRegistry.Games[ModList.GameType];
|
||||
var game = ModList.GameType.MetaData();
|
||||
|
||||
if (GameFolder == null)
|
||||
GameFolder = game.GameLocation(SteamHandler.Instance.Games.Any(g => g.Game == game.Game));
|
||||
GameFolder = game.GameLocation();
|
||||
|
||||
if (GameFolder == null)
|
||||
{
|
||||
|
@ -322,13 +322,13 @@ namespace Wabbajack.Lib.NexusApi
|
||||
|
||||
public GetModFilesResponse GetModFiles(Game game, int modid)
|
||||
{
|
||||
var url = $"https://api.nexusmods.com/v1/games/{GameRegistry.Games[game].NexusName}/mods/{modid}/files.json";
|
||||
var url = $"https://api.nexusmods.com/v1/games/{game.MetaData().NexusName}/mods/{modid}/files.json";
|
||||
return GetCached<GetModFilesResponse>(url);
|
||||
}
|
||||
|
||||
public List<MD5Response> GetModInfoFromMD5(Game game, string md5Hash)
|
||||
{
|
||||
var url = $"https://api.nexusmods.com/v1/games/{GameRegistry.Games[game].NexusName}/mods/md5_search/{md5Hash}.json";
|
||||
var url = $"https://api.nexusmods.com/v1/games/{game.MetaData().NexusName}/mods/md5_search/{md5Hash}.json";
|
||||
return Get<List<MD5Response>>(url);
|
||||
}
|
||||
|
||||
|
@ -14,7 +14,7 @@ namespace Wabbajack.Lib.NexusApi
|
||||
|
||||
public static string GetModURL(Game game, string argModId)
|
||||
{
|
||||
return $"https://nexusmods.com/{GameRegistry.Games[game].NexusName}/mods/{argModId}";
|
||||
return $"https://nexusmods.com/{game.MetaData().NexusName}/mods/{argModId}";
|
||||
}
|
||||
|
||||
public static string FixupSummary(string argSummary)
|
||||
|
@ -140,7 +140,7 @@ namespace Wabbajack.Lib.Validation
|
||||
}
|
||||
});
|
||||
|
||||
var nexus = NexusApi.NexusApiUtils.ConvertGameName(GameRegistry.Games[modlist.GameType].NexusName);
|
||||
var nexus = NexusApi.NexusApiUtils.ConvertGameName(modlist.GameType.MetaData().NexusName);
|
||||
|
||||
modlist.Archives
|
||||
.Where(a => a.State is NexusDownloader.State)
|
||||
|
@ -50,7 +50,7 @@ namespace Wabbajack.Lib
|
||||
Game = game;
|
||||
|
||||
GamePath = gamePath;
|
||||
GameName = GameRegistry.Games[game].NexusName;
|
||||
GameName = game.MetaData().NexusName;
|
||||
VortexFolder = vortexFolder;
|
||||
DownloadsFolder = downloadsFolder;
|
||||
StagingFolder = stagingFolder;
|
||||
@ -261,7 +261,7 @@ namespace Wabbajack.Lib
|
||||
Directory.EnumerateFiles(GamePath, "vortex.deployment.json", SearchOption.AllDirectories)
|
||||
.Where(File.Exists)
|
||||
.Do(f => deploymentFile = f);
|
||||
var currentGame = GameRegistry.Games[Game];
|
||||
var currentGame = Game.MetaData();
|
||||
if (currentGame.AdditionalFolders != null && currentGame.AdditionalFolders.Count != 0)
|
||||
currentGame.AdditionalFolders.Do(f => Directory.EnumerateFiles(f, "vortex.deployment.json", SearchOption.AllDirectories)
|
||||
.Where(File.Exists)
|
||||
@ -300,7 +300,7 @@ namespace Wabbajack.Lib
|
||||
/// </summary>
|
||||
private void AddExternalFolder()
|
||||
{
|
||||
var currentGame = GameRegistry.Games[Game];
|
||||
var currentGame = Game.MetaData();
|
||||
if (currentGame.AdditionalFolders == null || currentGame.AdditionalFolders.Count == 0) return;
|
||||
currentGame.AdditionalFolders.Do(f =>
|
||||
{
|
||||
@ -472,13 +472,13 @@ namespace Wabbajack.Lib
|
||||
public static string RetrieveDownloadLocation(Game game, string vortexFolderPath = null)
|
||||
{
|
||||
vortexFolderPath = vortexFolderPath ?? TypicalVortexFolder();
|
||||
return Path.Combine(vortexFolderPath, "downloads", GameRegistry.Games[game].NexusName);
|
||||
return Path.Combine(vortexFolderPath, "downloads", game.MetaData().NexusName);
|
||||
}
|
||||
|
||||
public static string RetrieveStagingLocation(Game game, string vortexFolderPath = null)
|
||||
{
|
||||
vortexFolderPath = vortexFolderPath ?? TypicalVortexFolder();
|
||||
var gameName = GameRegistry.Games[game].NexusName;
|
||||
var gameName = game.MetaData().NexusName;
|
||||
return Path.Combine(vortexFolderPath, gameName, "mods");
|
||||
}
|
||||
|
||||
@ -508,7 +508,7 @@ namespace Wabbajack.Lib
|
||||
|
||||
public static bool IsActiveVortexGame(Game g)
|
||||
{
|
||||
return GameRegistry.Games[g].SupportedModManager == ModManager.Vortex && !GameRegistry.Games[g].Disabled;
|
||||
return g.MetaData().SupportedModManager == ModManager.Vortex && !GameRegistry.Games[g].Disabled;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -29,7 +29,7 @@ namespace Wabbajack.Lib
|
||||
IgnoreMissingFiles = true;
|
||||
#endif
|
||||
|
||||
GameInfo = GameRegistry.Games[ModList.GameType];
|
||||
GameInfo = ModList.GameType.MetaData();
|
||||
}
|
||||
|
||||
protected override bool _Begin()
|
||||
@ -85,7 +85,7 @@ namespace Wabbajack.Lib
|
||||
|
||||
var manualFilesDir = Path.Combine(OutputFolder, Consts.ManualGameFilesDir);
|
||||
|
||||
var gameFolder = GameInfo.GameLocation(SteamHandler.Instance.Games.Any(g => g.Game == GameInfo.Game));
|
||||
var gameFolder = GameInfo.GameLocation();
|
||||
|
||||
Info($"Copying files from {manualFilesDir} " +
|
||||
$"to the game folder at {gameFolder}");
|
||||
|
@ -112,7 +112,7 @@ namespace Wabbajack.Test
|
||||
new List<string>
|
||||
{
|
||||
"[General]",
|
||||
$"gameName={GameRegistry.Games[game].MO2ArchiveName}",
|
||||
$"gameName={game.MetaData().MO2ArchiveName}",
|
||||
$"modID={modid}",
|
||||
$"fileID={file.file_id}"
|
||||
});
|
||||
|
@ -46,7 +46,7 @@ namespace Wabbajack.Test
|
||||
File.WriteAllLines(Path.Combine(MO2Folder, "ModOrganizer.ini"), new []
|
||||
{
|
||||
"[General]",
|
||||
$"gameName={GameRegistry.Games[Game].MO2Name}",
|
||||
$"gameName={Game.MetaData().MO2Name}",
|
||||
$"gamePath={GameFolder.Replace("\\", "\\\\")}",
|
||||
$"download_directory={DownloadsFolder}"
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user