diff --git a/Generic/MetadataUtilities/Actions/AfterMetadataUpdateAction.cs b/Generic/MetadataUtilities/Actions/AfterMetadataUpdateAction.cs index cfa31f7d9..7e9d0ee9f 100644 --- a/Generic/MetadataUtilities/Actions/AfterMetadataUpdateAction.cs +++ b/Generic/MetadataUtilities/Actions/AfterMetadataUpdateAction.cs @@ -1,4 +1,5 @@ -using MetadataUtilities.Enums; +using KNARZhelper; +using MetadataUtilities.Enums; using MetadataUtilities.Models; using Playnite.SDK; @@ -20,6 +21,14 @@ private AfterMetadataUpdateAction(Settings settings) : base(settings) public override bool Execute(MyGame game, ActionModifierType actionModifier = ActionModifierType.None, object item = null, bool isBulkAction = true) { + if (Settings.WriteDebugLog) + { + Log.Debug($"===> Game \"{game.Game.Name}\" ======================================="); + Log.Debug($"ExecuteRemoveUnwanted: {game.ExecuteRemoveUnwanted}"); + Log.Debug($"ExecuteMergeRules: {game.ExecuteMergeRules}"); + Log.Debug($"ExecuteConditionalActions: {game.ExecuteConditionalActions}"); + } + if (!base.Execute(game, actionModifier, item, isBulkAction)) { return false; @@ -69,6 +78,13 @@ public override void FollowUp(ActionModifierType actionModifier = ActionModifier public override bool Prepare(ActionModifierType actionModifier = ActionModifierType.None, object item = null, bool isBulkAction = true) { + if (Settings.WriteDebugLog) + { + Log.Debug($"===> preparing AfterMetadataUpdate ======================="); + Log.Debug($"RemoveUnwantedOnMetadataUpdate: {Settings.RemoveUnwantedOnMetadataUpdate}"); + Log.Debug($"MergeMetadataOnMetadataUpdate: {Settings.MergeMetadataOnMetadataUpdate}"); + } + if (!base.Prepare(ActionModifierType.IsCombi, item, isBulkAction)) { return false; diff --git a/Generic/MetadataUtilities/MetadataFunctions.cs b/Generic/MetadataUtilities/MetadataFunctions.cs index 1685cb116..ee1016483 100644 --- a/Generic/MetadataUtilities/MetadataFunctions.cs +++ b/Generic/MetadataUtilities/MetadataFunctions.cs @@ -12,6 +12,7 @@ using System.Linq; using System.Windows; using System.Windows.Forms; +using MergeAction = MetadataUtilities.Actions.MergeAction; namespace MetadataUtilities { @@ -22,6 +23,11 @@ public static void DoForAll(MetadataUtilities plugin, List games, IBaseA { plugin.IsUpdating = true; + if (plugin.Settings.Settings.WriteDebugLog) + { + Log.Debug($"===> Started {action.GetType()} for {games.Count} games. ======================="); + } + Cursor.Current = Cursors.WaitCursor; try { @@ -84,6 +90,11 @@ public static void DoForAll(MetadataUtilities plugin, List games, IBaseA }, globalProgressOptions); } + if (plugin.Settings.Settings.WriteDebugLog) + { + Log.Debug($"===> Finished {action.GetType()} with {gamesAffected} games affected. ======================="); + } + // Shows a dialog with the number of games actually affected. if (!showDialog) { @@ -355,6 +366,11 @@ public static void UpdateGames(List games) } } + if (MergeAction.Instance(null).Settings?.WriteDebugLog ?? false) + { + Log.Debug($"Updating {gamesToUpdate.Count} games:\n{string.Join("\n", gamesToUpdate.Select(g => g.Name))}"); + } + if (gamesToUpdate.Count == 0) { return; diff --git a/Generic/MetadataUtilities/MetadataUtilities.cs b/Generic/MetadataUtilities/MetadataUtilities.cs index 72ea01694..f22baed48 100644 --- a/Generic/MetadataUtilities/MetadataUtilities.cs +++ b/Generic/MetadataUtilities/MetadataUtilities.cs @@ -67,6 +67,11 @@ public MetadataUtilities(IPlayniteAPI api) : base(api) public void Games_ItemUpdated(object sender, ItemUpdatedEventArgs args) { + if (Settings.Settings.WriteDebugLog) + { + Log.Debug($"IsUpdating: {IsUpdating}"); + } + if (IsUpdating) { return;