From ad6f398fcf547853be31cb9d411b27ce7627e011 Mon Sep 17 00:00:00 2001 From: Justin Swanson Date: Sat, 4 Jan 2020 18:36:43 -0600 Subject: [PATCH 1/2] Fix for steam handler contains being case sensitive --- Wabbajack.Common/Extensions/StringExt.cs | 14 ++++++++++++++ Wabbajack.Common/StoreHandlers/SteamHandler.cs | 16 ++++++++-------- 2 files changed, 22 insertions(+), 8 deletions(-) create mode 100644 Wabbajack.Common/Extensions/StringExt.cs diff --git a/Wabbajack.Common/Extensions/StringExt.cs b/Wabbajack.Common/Extensions/StringExt.cs new file mode 100644 index 00000000..672036b9 --- /dev/null +++ b/Wabbajack.Common/Extensions/StringExt.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace Wabbajack +{ + public static class StringExt + { + public static bool ContainsCaseInsensitive(this string str, string value) + { + return str.IndexOf(value, StringComparison.OrdinalIgnoreCase) >= 0; + } + } +} diff --git a/Wabbajack.Common/StoreHandlers/SteamHandler.cs b/Wabbajack.Common/StoreHandlers/SteamHandler.cs index ed769015..0f7a52f2 100644 --- a/Wabbajack.Common/StoreHandlers/SteamHandler.cs +++ b/Wabbajack.Common/StoreHandlers/SteamHandler.cs @@ -92,7 +92,7 @@ namespace Wabbajack.Common.StoreHandlers File.ReadAllLines(SteamConfig).Do(l => { - if (!l.Contains("BaseInstallFolder_")) return; + if (!l.ContainsCaseInsensitive("BaseInstallFolder_")) return; var s = GetVdfValue(l); s = Path.Combine(s, "steamapps"); if (!Directory.Exists(s)) @@ -137,7 +137,7 @@ namespace Wabbajack.Common.StoreHandlers File.ReadAllLines(f).Do(l => { - if (l.Contains("\"appid\"")) + if (l.ContainsCaseInsensitive("\"appid\"")) { if (!int.TryParse(GetVdfValue(l), out var id)) return; @@ -145,10 +145,10 @@ namespace Wabbajack.Common.StoreHandlers gotID = true; } - if (l.Contains("\"name\"")) + if (l.ContainsCaseInsensitive("\"name\"")) game.Name = GetVdfValue(l); - if (!l.Contains("\"installdir\"")) + if (!l.ContainsCaseInsensitive("\"installdir\"")) return; var path = Path.Combine(u, "common", GetVdfValue(l)); @@ -220,7 +220,7 @@ namespace Wabbajack.Common.StoreHandlers currentItem = new SteamWorkshopItem(); var currentLine = lines.IndexOf(l); - if (l.Contains("\"appid\"") && !foundAppID) + if (l.ContainsCaseInsensitive("\"appid\"") && !foundAppID) { if (!int.TryParse(GetVdfValue(l), out var appID)) return; @@ -234,7 +234,7 @@ namespace Wabbajack.Common.StoreHandlers if (!foundAppID) return; - if (l.Contains("\"SizeOnDisk\"")) + if (l.ContainsCaseInsensitive("\"SizeOnDisk\"")) { if (!int.TryParse(GetVdfValue(l), out var sizeOnDisk)) return; @@ -242,10 +242,10 @@ namespace Wabbajack.Common.StoreHandlers game.WorkshopItemsSize += sizeOnDisk; } - if (l.Contains("\"WorkshopItemsInstalled\"")) + if (l.ContainsCaseInsensitive("\"WorkshopItemsInstalled\"")) workshopItemsInstalled = currentLine; - if (l.Contains("\"WorkshopItemDetails\"")) + if (l.ContainsCaseInsensitive("\"WorkshopItemDetails\"")) workshopItemDetails = currentLine; if (workshopItemsInstalled == 0) From d4a7bc5ae479027cda6426182d670b39aeaf860e Mon Sep 17 00:00:00 2001 From: Justin Swanson Date: Sat, 4 Jan 2020 18:38:16 -0600 Subject: [PATCH 2/2] Fix for GOG handler checking steam IDs instead of GOG IDs --- Wabbajack.Common/StoreHandlers/GOGHandler.cs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/Wabbajack.Common/StoreHandlers/GOGHandler.cs b/Wabbajack.Common/StoreHandlers/GOGHandler.cs index 40686969..233db86e 100644 --- a/Wabbajack.Common/StoreHandlers/GOGHandler.cs +++ b/Wabbajack.Common/StoreHandlers/GOGHandler.cs @@ -106,12 +106,10 @@ namespace Wabbajack.Common.StoreHandlers var gameMeta = GameRegistry.Games.Values.FirstOrDefault(g => { - return g.GOGIDs != null - && (g.SteamIDs?.Contains(gameID) ?? false) - && (g.RequiredFiles?.TrueForAll(file => File.Exists(Path.Combine(game.Path, file))) ?? - true); + return (g.GOGIDs?.Contains(gameID) ?? false) + && (g.RequiredFiles?.TrueForAll(file => File.Exists(Path.Combine(game.Path, file))) ?? true); }); - + if (gameMeta == null) { Utils.Log($"GOG Game \"{gameName}\"({gameID}) is not supported, skipping");