mirror of
https://github.com/wabbajack-tools/wabbajack.git
synced 2024-08-30 18:42:17 +00:00
Merge pull request #347 from Noggog/game-handler-fixes
Game handler fixes
This commit is contained in:
commit
5957ce669f
14
Wabbajack.Common/Extensions/StringExt.cs
Normal file
14
Wabbajack.Common/Extensions/StringExt.cs
Normal file
@ -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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -106,12 +106,10 @@ namespace Wabbajack.Common.StoreHandlers
|
|||||||
|
|
||||||
var gameMeta = GameRegistry.Games.Values.FirstOrDefault(g =>
|
var gameMeta = GameRegistry.Games.Values.FirstOrDefault(g =>
|
||||||
{
|
{
|
||||||
return g.GOGIDs != null
|
return (g.GOGIDs?.Contains(gameID) ?? false)
|
||||||
&& (g.SteamIDs?.Contains(gameID) ?? false)
|
&& (g.RequiredFiles?.TrueForAll(file => File.Exists(Path.Combine(game.Path, file))) ?? true);
|
||||||
&& (g.RequiredFiles?.TrueForAll(file => File.Exists(Path.Combine(game.Path, file))) ??
|
|
||||||
true);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
if (gameMeta == null)
|
if (gameMeta == null)
|
||||||
{
|
{
|
||||||
Utils.Log($"GOG Game \"{gameName}\"({gameID}) is not supported, skipping");
|
Utils.Log($"GOG Game \"{gameName}\"({gameID}) is not supported, skipping");
|
||||||
|
@ -92,7 +92,7 @@ namespace Wabbajack.Common.StoreHandlers
|
|||||||
|
|
||||||
File.ReadAllLines(SteamConfig).Do(l =>
|
File.ReadAllLines(SteamConfig).Do(l =>
|
||||||
{
|
{
|
||||||
if (!l.Contains("BaseInstallFolder_")) return;
|
if (!l.ContainsCaseInsensitive("BaseInstallFolder_")) return;
|
||||||
var s = GetVdfValue(l);
|
var s = GetVdfValue(l);
|
||||||
s = Path.Combine(s, "steamapps");
|
s = Path.Combine(s, "steamapps");
|
||||||
if (!Directory.Exists(s))
|
if (!Directory.Exists(s))
|
||||||
@ -137,7 +137,7 @@ namespace Wabbajack.Common.StoreHandlers
|
|||||||
|
|
||||||
File.ReadAllLines(f).Do(l =>
|
File.ReadAllLines(f).Do(l =>
|
||||||
{
|
{
|
||||||
if (l.Contains("\"appid\""))
|
if (l.ContainsCaseInsensitive("\"appid\""))
|
||||||
{
|
{
|
||||||
if (!int.TryParse(GetVdfValue(l), out var id))
|
if (!int.TryParse(GetVdfValue(l), out var id))
|
||||||
return;
|
return;
|
||||||
@ -145,10 +145,10 @@ namespace Wabbajack.Common.StoreHandlers
|
|||||||
gotID = true;
|
gotID = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (l.Contains("\"name\""))
|
if (l.ContainsCaseInsensitive("\"name\""))
|
||||||
game.Name = GetVdfValue(l);
|
game.Name = GetVdfValue(l);
|
||||||
|
|
||||||
if (!l.Contains("\"installdir\""))
|
if (!l.ContainsCaseInsensitive("\"installdir\""))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var path = Path.Combine(u, "common", GetVdfValue(l));
|
var path = Path.Combine(u, "common", GetVdfValue(l));
|
||||||
@ -220,7 +220,7 @@ namespace Wabbajack.Common.StoreHandlers
|
|||||||
currentItem = new SteamWorkshopItem();
|
currentItem = new SteamWorkshopItem();
|
||||||
|
|
||||||
var currentLine = lines.IndexOf(l);
|
var currentLine = lines.IndexOf(l);
|
||||||
if (l.Contains("\"appid\"") && !foundAppID)
|
if (l.ContainsCaseInsensitive("\"appid\"") && !foundAppID)
|
||||||
{
|
{
|
||||||
if (!int.TryParse(GetVdfValue(l), out var appID))
|
if (!int.TryParse(GetVdfValue(l), out var appID))
|
||||||
return;
|
return;
|
||||||
@ -234,7 +234,7 @@ namespace Wabbajack.Common.StoreHandlers
|
|||||||
if (!foundAppID)
|
if (!foundAppID)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (l.Contains("\"SizeOnDisk\""))
|
if (l.ContainsCaseInsensitive("\"SizeOnDisk\""))
|
||||||
{
|
{
|
||||||
if (!int.TryParse(GetVdfValue(l), out var sizeOnDisk))
|
if (!int.TryParse(GetVdfValue(l), out var sizeOnDisk))
|
||||||
return;
|
return;
|
||||||
@ -242,10 +242,10 @@ namespace Wabbajack.Common.StoreHandlers
|
|||||||
game.WorkshopItemsSize += sizeOnDisk;
|
game.WorkshopItemsSize += sizeOnDisk;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (l.Contains("\"WorkshopItemsInstalled\""))
|
if (l.ContainsCaseInsensitive("\"WorkshopItemsInstalled\""))
|
||||||
workshopItemsInstalled = currentLine;
|
workshopItemsInstalled = currentLine;
|
||||||
|
|
||||||
if (l.Contains("\"WorkshopItemDetails\""))
|
if (l.ContainsCaseInsensitive("\"WorkshopItemDetails\""))
|
||||||
workshopItemDetails = currentLine;
|
workshopItemDetails = currentLine;
|
||||||
|
|
||||||
if (workshopItemsInstalled == 0)
|
if (workshopItemsInstalled == 0)
|
||||||
|
Loading…
Reference in New Issue
Block a user