diff --git a/Dalamud/Dalamud.cs b/Dalamud/Dalamud.cs index 332417e77..12cad078d 100644 --- a/Dalamud/Dalamud.cs +++ b/Dalamud/Dalamud.cs @@ -212,7 +212,7 @@ namespace Dalamud { ImGui.Separator(); if (ImGui.MenuItem("Open Log window")) { - this.logWindow = new DalamudLogWindow(); + this.logWindow = new DalamudLogWindow(CommandManager); this.isImguiDrawLogWindow = true; } if (ImGui.BeginMenu("Set log level...")) diff --git a/Dalamud/Game/Command/CommandManager.cs b/Dalamud/Game/Command/CommandManager.cs index 4c5b85f1b..98ca22642 100644 --- a/Dalamud/Game/Command/CommandManager.cs +++ b/Dalamud/Game/Command/CommandManager.cs @@ -69,7 +69,12 @@ namespace Dalamud.Game.Command { } } - private bool ProcessCommand(string content) { + /// + /// Process a command in full. + /// + /// The full command string. + /// True if the command was found and dispatched. + public bool ProcessCommand(string content) { string command; string argument; diff --git a/Dalamud/Game/Internal/Gui/ChatGui.cs b/Dalamud/Game/Internal/Gui/ChatGui.cs index c9eb128c9..b1b94465a 100644 --- a/Dalamud/Game/Internal/Gui/ChatGui.cs +++ b/Dalamud/Game/Internal/Gui/ChatGui.cs @@ -97,6 +97,8 @@ namespace Dalamud.Game.Internal.Gui { var parsedSender = SeString.Parse(sender.RawData); var parsedMessage = SeString.Parse(message.RawData); + Log.Verbose("[CHATGUI][{0}][{1}]", parsedSender.TextValue, parsedMessage.TextValue); + //Log.Debug($"HandlePrintMessageDetour {manager} - [{chattype}] [{BitConverter.ToString(message.RawData).Replace("-", " ")}] {message.Value} from {senderName.Value}"); var originalMessageData = (byte[]) message.RawData.Clone(); @@ -113,7 +115,7 @@ namespace Dalamud.Game.Internal.Gui { Log.Verbose("SeString was edited, taking precedence over StdString edit."); message.RawData = newEdited; } - Log.Debug($"\nOLD: {BitConverter.ToString(originalMessageData)}\nNEW: {BitConverter.ToString(newEdited)}"); + //Log.Debug($"\nOLD: {BitConverter.ToString(originalMessageData)}\nNEW: {BitConverter.ToString(newEdited)}"); var messagePtr = pMessage; OwnedStdString allocatedString = null; @@ -173,12 +175,14 @@ namespace Dalamud.Game.Internal.Gui { } public void Print(string message) { + Log.Verbose("[CHATGUI PRINT]{0}", message); PrintChat(new XivChatEntry { MessageBytes = Encoding.UTF8.GetBytes(message) }); } public void PrintError(string message) { + Log.Verbose("[CHATGUI PRINT ERROR]{0}", message); PrintChat(new XivChatEntry { MessageBytes = Encoding.UTF8.GetBytes(message), Type = XivChatType.Urgent diff --git a/Dalamud/Interface/DalamudLogWindow.cs b/Dalamud/Interface/DalamudLogWindow.cs index 5d49c961a..afd3a349c 100644 --- a/Dalamud/Interface/DalamudLogWindow.cs +++ b/Dalamud/Interface/DalamudLogWindow.cs @@ -4,15 +4,21 @@ using System.Linq; using System.Numerics; using System.Text; using System.Threading.Tasks; +using Dalamud.Game.Command; using ImGuiNET; +using Serilog; namespace Dalamud.Interface { class DalamudLogWindow : IDisposable { + private readonly CommandManager commandManager; private bool autoScroll = true; private string logText = string.Empty; - public DalamudLogWindow() { + private string commandText = string.Empty; + + public DalamudLogWindow(CommandManager commandManager) { + this.commandManager = commandManager; SerilogEventSink.Instance.OnLogLine += Serilog_OnLogLine; } @@ -59,6 +65,18 @@ namespace Dalamud.Interface ImGui.SameLine(); var copy = ImGui.Button("Copy"); + ImGui.Text("Enter command: "); + ImGui.SameLine(); + ImGui.InputText("##commandbox", ref this.commandText, 255); + ImGui.SameLine(); + if (ImGui.Button("Send")) { + if (this.commandManager.ProcessCommand(this.commandText)) { + Log.Information("Command was dispatched."); + } else { + Log.Information("Command {0} not registered.", this.commandText); + } + } + ImGui.BeginChild("scrolling", new Vector2(0, 0), false, ImGuiWindowFlags.HorizontalScrollbar); if (clear)