diff --git a/Dalamud/Interface/DalamudInterface.cs b/Dalamud/Interface/DalamudInterface.cs
index a98604798..6afbcffb5 100644
--- a/Dalamud/Interface/DalamudInterface.cs
+++ b/Dalamud/Interface/DalamudInterface.cs
@@ -1,16 +1,11 @@
using System;
-using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Runtime.InteropServices;
-using System.Text;
-using System.Threading.Tasks;
+
using CheapLoc;
-using Dalamud.Game.ClientState;
-using Dalamud.Game.Command;
-using Dalamud.Game.Internal;
using Dalamud.Plugin;
using ImGuiNET;
using Serilog;
@@ -18,19 +13,15 @@ using Serilog.Events;
namespace Dalamud.Interface
{
+ ///
+ /// Class handling Dalamud core interface.
+ ///
internal class DalamudInterface
{
private readonly Dalamud dalamud;
private ulong frameCount = 0;
- public DalamudInterface(Dalamud dalamud) {
- this.dalamud = dalamud;
- if (dalamud.Configuration.LogOpenAtStartup) {
- OpenLog();
- }
- }
-
private bool isImguiDrawDemoWindow = false;
#if DEBUG
@@ -39,12 +30,6 @@ namespace Dalamud.Interface
private bool isImguiDrawDevMenu = false;
#endif
- public bool IsDevMenu
- {
- get => this.isImguiDrawDevMenu;
- set => this.isImguiDrawDevMenu = value;
- }
-
private bool isImguiDrawLogWindow = false;
private bool isImguiDrawDataWindow = false;
private bool isImguiDrawPluginWindow = false;
@@ -61,6 +46,29 @@ namespace Dalamud.Interface
private DalamudPluginStatWindow pluginStatWindow;
private DalamudChangelogWindow changelogWindow;
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// The Dalamud instance to register to.
+ public DalamudInterface(Dalamud dalamud)
+ {
+ this.dalamud = dalamud;
+ if (dalamud.Configuration.LogOpenAtStartup)
+ this.OpenLog();
+ }
+
+ ///
+ /// Gets or sets a value indicating whether the Dalamud dev menu is drawing.
+ ///
+ public bool IsDevMenu
+ {
+ get => this.isImguiDrawDevMenu;
+ set => this.isImguiDrawDevMenu = value;
+ }
+
+ ///
+ /// Draw the Dalamud core interface via ImGui.
+ ///
public void Draw()
{
this.frameCount++;
@@ -96,18 +104,21 @@ namespace Dalamud.Interface
{
if (ImGui.BeginMenu("Dalamud"))
{
- ImGui.MenuItem("Draw Dalamud dev menu", "", ref this.isImguiDrawDevMenu);
+ ImGui.MenuItem("Draw Dalamud dev menu", string.Empty, ref this.isImguiDrawDevMenu);
+
ImGui.Separator();
+
if (ImGui.MenuItem("Open Log window"))
{
this.logWindow = new DalamudLogWindow(this.dalamud.CommandManager, this.dalamud.Configuration);
this.isImguiDrawLogWindow = true;
}
+
if (ImGui.BeginMenu("Set log level..."))
{
foreach (var logLevel in Enum.GetValues(typeof(LogEventLevel)).Cast())
{
- if (ImGui.MenuItem(logLevel + "##logLevelSwitch", "", this.dalamud.LogLevelSwitch.MinimumLevel == logLevel))
+ if (ImGui.MenuItem(logLevel + "##logLevelSwitch", string.Empty, this.dalamud.LogLevelSwitch.MinimumLevel == logLevel))
{
this.dalamud.LogLevelSwitch.MinimumLevel = logLevel;
}
@@ -115,52 +126,66 @@ namespace Dalamud.Interface
ImGui.EndMenu();
}
+
if (ImGui.MenuItem("Enable AntiDebug", null, this.dalamud.AntiDebug.IsEnabled))
{
this.dalamud.AntiDebug.Enable();
}
+
ImGui.Separator();
+
if (ImGui.MenuItem("Open Data window"))
{
this.dataWindow = new DalamudDataWindow(this.dalamud);
this.isImguiDrawDataWindow = true;
}
+
if (ImGui.MenuItem("Open Credits window"))
{
- OpenCredits();
- }
- if (ImGui.MenuItem("Open Settings window"))
- {
- OpenSettings();
- }
- if (ImGui.MenuItem("Open Changelog window"))
- {
- OpenChangelog();
+ this.OpenCredits();
}
- if (this.dalamud.Fools != null) {
- ImGui.MenuItem("Draw Tippy", "", ref this.dalamud.Fools.IsEnabled);
+ if (ImGui.MenuItem("Open Settings window"))
+ {
+ this.OpenSettings();
}
-
- ImGui.MenuItem("Draw ImGui demo", "", ref this.isImguiDrawDemoWindow);
+
+ if (ImGui.MenuItem("Open Changelog window"))
+ {
+ this.OpenChangelog();
+ }
+
+ if (this.dalamud.Fools != null)
+ {
+ ImGui.MenuItem("Draw Tippy", string.Empty, ref this.dalamud.Fools.IsEnabled);
+ }
+
+ ImGui.MenuItem("Draw ImGui demo", string.Empty, ref this.isImguiDrawDemoWindow);
+
ImGui.Separator();
+
if (ImGui.MenuItem("Unload Dalamud"))
{
this.dalamud.Unload();
}
+
if (ImGui.MenuItem("Kill game"))
{
Process.GetCurrentProcess().Kill();
}
+
if (ImGui.MenuItem("Cause AccessViolation"))
{
var a = Marshal.ReadByte(IntPtr.Zero);
}
+
ImGui.Separator();
- if (ImGui.MenuItem("Enable Dalamud testing", "", this.dalamud.Configuration.DoDalamudTest)) {
+ if (ImGui.MenuItem("Enable Dalamud testing", string.Empty, this.dalamud.Configuration.DoDalamudTest))
+ {
this.dalamud.Configuration.DoDalamudTest = !this.dalamud.Configuration.DoDalamudTest;
this.dalamud.Configuration.Save();
}
+
ImGui.MenuItem(Util.AssemblyVersion, false);
ImGui.MenuItem(this.dalamud.StartInfo.GameVersion, false);
@@ -184,7 +209,9 @@ namespace Dalamud.Interface
this.pluginWindow = new PluginInstallerWindow(this.dalamud, this.dalamud.StartInfo.GameVersion);
this.isImguiDrawPluginWindow = true;
}
+
ImGui.Separator();
+
if (ImGui.MenuItem("Open Plugin Stats"))
{
if (!this.isImguiDrawPluginStatWindow)
@@ -193,6 +220,7 @@ namespace Dalamud.Interface
this.isImguiDrawPluginStatWindow = true;
}
}
+
if (ImGui.MenuItem("Print plugin info"))
{
foreach (var plugin in this.dalamud.PluginManager.Plugins)
@@ -201,6 +229,7 @@ namespace Dalamud.Interface
Log.Information($"{plugin.Plugin.Name}");
}
}
+
if (ImGui.MenuItem("Reload plugins"))
{
try
@@ -249,6 +278,7 @@ namespace Dalamud.Interface
ImGui.EndMenu();
}
+
ImGui.EndMenu();
}
@@ -323,33 +353,48 @@ namespace Dalamud.Interface
this.isImguiDrawChangelogWindow = this.changelogWindow != null && this.changelogWindow.Draw();
}
}
+
+ ///
+ /// Open the Plugin Installer window.
+ ///
internal void OpenPluginInstaller()
{
- if (this.pluginWindow == null)
- {
- this.pluginWindow = new PluginInstallerWindow(this.dalamud, this.dalamud.StartInfo.GameVersion);
- }
+ this.pluginWindow ??= new PluginInstallerWindow(this.dalamud, this.dalamud.StartInfo.GameVersion);
this.isImguiDrawPluginWindow ^= true;
}
+ ///
+ /// Open the changelog window.
+ ///
internal void OpenChangelog()
{
this.changelogWindow = new DalamudChangelogWindow(this.dalamud);
this.isImguiDrawChangelogWindow = true;
}
+ ///
+ /// Open the settings window.
+ ///
internal void OpenSettings()
{
this.settingsWindow = new DalamudSettingsWindow(this.dalamud);
this.isImguiDrawSettingsWindow ^= true;
}
- public void OpenLog() {
+ ///
+ /// Open the log window.
+ ///
+ internal void OpenLog()
+ {
this.logWindow = new DalamudLogWindow(this.dalamud.CommandManager, this.dalamud.Configuration);
this.isImguiDrawLogWindow = true;
}
- public void OpenCredits() {
+ ///
+ /// Open the credits window.
+ ///
+ internal void OpenCredits()
+ {
var logoGraphic =
this.dalamud.InterfaceManager.LoadImage(
Path.Combine(this.dalamud.AssetDirectory.FullName, "UIRes", "logo.png"));