Skip to content

Commit

Permalink
Added optional debug logging for merging after metadata updates (need…
Browse files Browse the repository at this point in the history
…s to be activated in the addon settings)
  • Loading branch information
HerrKnarz committed Oct 1, 2024
1 parent bb4031f commit add2dbf
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions Generic/MetadataUtilities/Actions/MergeAction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,32 @@ public override bool Execute(MyGame game, ActionModifierType actionModifier = Ac
return false;
}

var types = FieldTypeHelper.GetItemListTypes().ToList();

if (Settings.WriteDebugLog)
{
Log.Debug($"==== Started executing Merge Rules on Game \"{game.Game.Name}\" ======================================");

foreach (var type in types)
{
Log.Debug($"{type.LabelPlural} before: {string.Join(", ", type.LoadGameMetadata(game.Game).Select(x => x.Name))}");
}
}

var result = item is MergeRule singleRule
? singleRule.Merge(game.Game)
: _rules.Aggregate(false, (current, rule) => current | rule.Merge(game.Game));

if (Settings.WriteDebugLog)
{
Log.Debug($"==== Finished executing Merge Rules on Game \"{game.Game.Name}\" ({result}) ============================");

foreach (var type in types)
{
Log.Debug($"{type.LabelPlural} after: {string.Join(", ", type.LoadGameMetadata(game.Game).Select(x => x.Name))}");
}
}

if (result && actionModifier != ActionModifierType.IsCombi)
{
_gamesAffected.Add(game.Game);
Expand Down

0 comments on commit add2dbf

Please sign in to comment.