diff --git a/Dalamud/Interface/Internal/DalamudInterface.cs b/Dalamud/Interface/Internal/DalamudInterface.cs
index ba65b9bfe..47225e815 100644
--- a/Dalamud/Interface/Internal/DalamudInterface.cs
+++ b/Dalamud/Interface/Internal/DalamudInterface.cs
@@ -60,7 +60,7 @@ namespace Dalamud.Interface.Internal
this.creditsWindow = new CreditsWindow(dalamud) { IsOpen = false };
this.dataWindow = new DataWindow(dalamud) { IsOpen = false };
this.gamepadModeNotifierWindow = new GamepadModeNotifierWindow();
- this.consoleWindow = new ConsoleWindow { IsOpen = this.dalamud.Configuration.LogOpenAtStartup };
+ this.consoleWindow = new ConsoleWindow(dalamud) { IsOpen = this.dalamud.Configuration.LogOpenAtStartup };
this.pluginStatWindow = new PluginStatWindow(dalamud) { IsOpen = false };
this.pluginWindow = new PluginInstallerWindow(dalamud) { IsOpen = false };
this.scratchpadWindow = new ScratchpadWindow(dalamud) { IsOpen = false };
@@ -155,7 +155,7 @@ namespace Dalamud.Interface.Internal
public void OpenGamepadModeNotifierWindow() => this.gamepadModeNotifierWindow.IsOpen = true;
///
- /// Opens the .
+ /// Opens the .
///
public void OpenLogWindow() => this.consoleWindow.IsOpen = true;
@@ -227,7 +227,7 @@ namespace Dalamud.Interface.Internal
public void ToggleGamepadModeNotifierWindow() => this.gamepadModeNotifierWindow.Toggle();
///
- /// Toggles the .
+ /// Toggles the .
///
public void ToggleLogWindow() => this.consoleWindow.Toggle();
diff --git a/Dalamud/Interface/Internal/Windows/ConsoleWindow.cs b/Dalamud/Interface/Internal/Windows/ConsoleWindow.cs
index 2f1529650..523d9fb64 100644
--- a/Dalamud/Interface/Internal/Windows/ConsoleWindow.cs
+++ b/Dalamud/Interface/Internal/Windows/ConsoleWindow.cs
@@ -20,6 +20,8 @@ namespace Dalamud.Interface.Internal.Windows
///
internal class ConsoleWindow : Window, IDisposable
{
+ private readonly Dalamud dalamud;
+
private readonly List logText = new();
private readonly object renderLock = new();
@@ -44,11 +46,13 @@ namespace Dalamud.Interface.Internal.Windows
/// Initializes a new instance of the class.
///
/// The Dalamud instance.
- public ConsoleWindow()
+ public ConsoleWindow(Dalamud dalamud)
: base("Dalamud Console")
{
- this.autoScroll = Dalamud.Instance.Configuration.LogAutoScroll;
- this.openAtStartup = Dalamud.Instance.Configuration.LogOpenAtStartup;
+ this.dalamud = dalamud;
+
+ this.autoScroll = this.dalamud.Configuration.LogAutoScroll;
+ this.openAtStartup = this.dalamud.Configuration.LogOpenAtStartup;
SerilogEventSink.Instance.OnLogLine += this.OnLogLine;
this.Size = new Vector2(500, 400);
@@ -110,22 +114,22 @@ namespace Dalamud.Interface.Internal.Windows
{
if (ImGui.Checkbox("Auto-scroll", ref this.autoScroll))
{
- Dalamud.Instance.Configuration.LogAutoScroll = this.autoScroll;
- Dalamud.Instance.Configuration.Save();
+ this.dalamud.Configuration.LogAutoScroll = this.autoScroll;
+ this.dalamud.Configuration.Save();
}
if (ImGui.Checkbox("Open at startup", ref this.openAtStartup))
{
- Dalamud.Instance.Configuration.LogOpenAtStartup = this.openAtStartup;
- Dalamud.Instance.Configuration.Save();
+ this.dalamud.Configuration.LogOpenAtStartup = this.openAtStartup;
+ this.dalamud.Configuration.Save();
}
- var prevLevel = (int)Dalamud.Instance.LogLevelSwitch.MinimumLevel;
+ var prevLevel = (int)this.dalamud.LogLevelSwitch.MinimumLevel;
if (ImGui.Combo("Log Level", ref prevLevel, Enum.GetValues(typeof(LogEventLevel)).Cast().Select(x => x.ToString()).ToArray(), 6))
{
- Dalamud.Instance.LogLevelSwitch.MinimumLevel = (LogEventLevel)prevLevel;
- Dalamud.Instance.Configuration.LogLevel = (LogEventLevel)prevLevel;
- Dalamud.Instance.Configuration.Save();
+ this.dalamud.LogLevelSwitch.MinimumLevel = (LogEventLevel)prevLevel;
+ this.dalamud.Configuration.LogLevel = (LogEventLevel)prevLevel;
+ this.dalamud.Configuration.Save();
}
/* TEST */
@@ -321,7 +325,6 @@ namespace Dalamud.Interface.Internal.Windows
if (getFocus)
ImGui.SetKeyboardFocusHere(-1); // Auto focus previous widget
-
if (hadColor)
ImGui.PopStyleColor();
@@ -353,10 +356,10 @@ namespace Dalamud.Interface.Internal.Windows
return;
}
- this.lastCmdSuccess = Dalamud.Instance.CommandManager.ProcessCommand("/" + this.commandText);
+ this.lastCmdSuccess = this.dalamud.CommandManager.ProcessCommand("/" + this.commandText);
this.commandText = string.Empty;
- //TODO: Force scroll to bottom
+ // TODO: Force scroll to bottom
}
catch (Exception ex)
{
@@ -384,7 +387,7 @@ namespace Dalamud.Interface.Internal.Windows
// TODO: Improve this, add partial completion
// https://github.com/ocornut/imgui/blob/master/imgui_demo.cpp#L6443-L6484
- var candidates = Dalamud.Instance.CommandManager.Commands.Where(x => x.Key.Contains("/" + words[0])).ToList();
+ var candidates = this.dalamud.CommandManager.Commands.Where(x => x.Key.Contains("/" + words[0])).ToList();
if (candidates.Count > 0)
{
ptr.DeleteChars(0, ptr.BufTextLen);