Merge pull request #336 from Noggog/steam-handler-hotfix

Steam handler hotfix
This commit is contained in:
Timothy Baldridge 2020-01-03 19:28:06 -08:00 committed by GitHub
commit b46b6b2ba0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 15 deletions

View File

@ -131,7 +131,7 @@ namespace Wabbajack.Common.StoreHandlers
Directory.EnumerateFiles(u, "*.acf", SearchOption.TopDirectoryOnly).Where(File.Exists).Do(f =>
{
var game = new SteamGame();
var valid = false;
var gotID = false;
File.ReadAllLines(f).Do(l =>
{
@ -140,6 +140,7 @@ namespace Wabbajack.Common.StoreHandlers
if (!int.TryParse(GetVdfValue(l), out var id))
return;
game.ID = id;
gotID = true;
}
if (l.Contains("\"name\""))
@ -149,21 +150,19 @@ namespace Wabbajack.Common.StoreHandlers
{
var path = Path.Combine(u, "common", GetVdfValue(l));
if (Directory.Exists(path))
{
game.Path = path;
else
return;
}
}
valid = true;
});
if (!valid) return;
if (!gotID || !Directory.Exists(game.Path)) return;
var gameMeta = GameRegistry.Games.Values.FirstOrDefault(g =>
g.SteamIDs.Contains(game.ID)
&&
g.RequiredFiles.TrueForAll(file =>
File.Exists(Path.Combine(game.Path, file))));
var gameMeta = GameRegistry.Games.Values.FirstOrDefault(g =>
{
return (g.SteamIDs?.Contains(game.ID) ?? false)
&& (g.RequiredFiles?.TrueForAll(file => File.Exists(Path.Combine(game.Path, file))) ?? true);
});
if (gameMeta == null)
return;

View File

@ -335,11 +335,9 @@ namespace Wabbajack
}
}
catch (Exception ex)
{
{
Utils.Error(ex, $"Encountered error, can't continue");
while (ex.InnerException != null) ex = ex.InnerException;
Utils.Log(ex.StackTrace);
Utils.Log(ex.ToString());
Utils.Log($"{ex.Message} - Can't continue");
Completed = ErrorResponse.Fail(ex);
}
});