Merge branch 'net7' of ssh://github.com/goatcorp/Dalamud into net7

This commit is contained in:
goaaats 2023-01-07 22:24:47 +01:00
commit bb745fc23e
No known key found for this signature in database
GPG key ID: 49E2AA8C6A76498B

View file

@ -10,7 +10,9 @@ using Dalamud.Interface.Internal.Notifications;
using Dalamud.Interface.Windowing; using Dalamud.Interface.Windowing;
using Dalamud.Plugin.Internal; using Dalamud.Plugin.Internal;
using Dalamud.Plugin.Internal.Types; using Dalamud.Plugin.Internal.Types;
using Dalamud.Utility;
using ImGuiNET; using ImGuiNET;
using Serilog;
namespace Dalamud.Interface.Internal.Windows; namespace Dalamud.Interface.Internal.Windows;
@ -20,6 +22,7 @@ namespace Dalamud.Interface.Internal.Windows;
internal class PluginStatWindow : Window internal class PluginStatWindow : Window
{ {
private bool showDalamudHooks; private bool showDalamudHooks;
private string hookSearchText = string.Empty;
/// <summary> /// <summary>
/// Initializes a new instance of the <see cref="PluginStatWindow"/> class. /// Initializes a new instance of the <see cref="PluginStatWindow"/> class.
@ -211,6 +214,12 @@ internal class PluginStatWindow : Window
{ {
ImGui.Checkbox("Show Dalamud Hooks", ref this.showDalamudHooks); ImGui.Checkbox("Show Dalamud Hooks", ref this.showDalamudHooks);
ImGui.InputTextWithHint(
"###PluginStatWindow_HookSearch",
"Search",
ref this.hookSearchText,
500);
if (ImGui.BeginTable( if (ImGui.BeginTable(
"##PluginStatsHooks", "##PluginStatsHooks",
4, 4,
@ -238,6 +247,13 @@ internal class PluginStatWindow : Window
if (!this.showDalamudHooks && trackedHook.Assembly == Assembly.GetExecutingAssembly()) if (!this.showDalamudHooks && trackedHook.Assembly == Assembly.GetExecutingAssembly())
continue; continue;
if (!this.hookSearchText.IsNullOrEmpty())
{
if ((trackedHook.Delegate.Target == null || !trackedHook.Delegate.Target.ToString().Contains(this.hookSearchText, StringComparison.OrdinalIgnoreCase))
&& !trackedHook.Delegate.Method.Name.Contains(this.hookSearchText, StringComparison.OrdinalIgnoreCase))
continue;
}
ImGui.TableNextRow(); ImGui.TableNextRow();
ImGui.TableNextColumn(); ImGui.TableNextColumn();
@ -281,7 +297,7 @@ internal class PluginStatWindow : Window
} }
catch (Exception ex) catch (Exception ex)
{ {
ImGui.Text(ex.Message); Log.Error(ex, "Error drawing hooks in plugin stats");
} }
} }