Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Dalamud.CorePlugin/Dalamud.CorePlugin.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
<ProduceReferenceAssembly>false</ProduceReferenceAssembly>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<NoWarn>IDE0003</NoWarn>
<Nullable>enable</Nullable>
</PropertyGroup>

<PropertyGroup Label="Documentation">
Expand Down
47 changes: 20 additions & 27 deletions Dalamud.CorePlugin/PluginImpl.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using System.Diagnostics.CodeAnalysis;
using System.IO;

using Dalamud.Configuration.Internal;
Expand All @@ -7,6 +8,7 @@
using Dalamud.Plugin;
using Dalamud.Plugin.Services;
using Dalamud.Utility;

using Serilog;

namespace Dalamud.CorePlugin
Expand All @@ -28,6 +30,7 @@ namespace Dalamud.CorePlugin
/// </remarks>
public sealed class PluginImpl : IDalamudPlugin
{
private readonly IChatGui chatGui;
#if !DEBUG

/// <summary>
Expand All @@ -46,7 +49,6 @@ public void Dispose()
#else

private readonly WindowSystem windowSystem = new("Dalamud.CorePlugin");
private Localization localization;

private IPluginLog pluginLog;

Expand All @@ -55,14 +57,17 @@ public void Dispose()
/// </summary>
/// <param name="pluginInterface">Dalamud plugin interface.</param>
/// <param name="log">Logging service.</param>
public PluginImpl(IDalamudPluginInterface pluginInterface, IPluginLog log)
/// <param name="commandManager">Command manager.</param>
/// <param name="chatGui">Chat GUI.</param>
[Experimental("Dalamud001")]
public PluginImpl(IDalamudPluginInterface pluginInterface, IPluginLog log, ICommandManager commandManager, IChatGui chatGui)
{
this.chatGui = chatGui;
this.Interface = pluginInterface;
this.pluginLog = log;

try
{
// this.InitLoc();
this.Interface = pluginInterface;
this.pluginLog = log;

this.windowSystem.AddWindow(new PluginWindow());

this.Interface.UiBuilder.Draw += this.OnDraw;
Expand All @@ -73,7 +78,8 @@ public PluginImpl(IDalamudPluginInterface pluginInterface, IPluginLog log)
Log.Information($"CorePlugin : DefaultFontHandle.ImFontChanged called {fc}");
};

Service<CommandManager>.Get().AddHandler("/coreplug", new CommandInfo(this.OnCommand) { HelpMessage = "Access the plugin." });
commandManager.AddHandler("/coreplug", new CommandInfo(this.OnCommand) { HelpMessage = "Access the plugin." });
commandManager.AddCommand("/coreplugnew", "Access the plugin.", this.OnCommandNew);

log.Information("CorePlugin ctor!");
}
Expand All @@ -98,25 +104,6 @@ public void Dispose()
this.windowSystem.RemoveAllWindows();
}

/// <summary>
/// CheapLoc needs to be reinitialized here because it tracks the setup by assembly name. New assembly, new setup.
/// </summary>
public void InitLoc()
{
var dalamud = Service<Dalamud>.Get();
var dalamudConfig = Service<DalamudConfiguration>.Get();

this.localization = new Localization(Path.Combine(dalamud.AssetDirectory.FullName, "UIRes", "loc", "dalamud"), "dalamud_");
if (!dalamudConfig.LanguageOverride.IsNullOrEmpty())
{
this.localization.SetupWithLangCode(dalamudConfig.LanguageOverride);
}
else
{
this.localization.SetupWithUiCulture();
}
}

/// <summary>
/// Draw the window system.
/// </summary>
Expand All @@ -134,11 +121,17 @@ private void OnDraw()

private void OnCommand(string command, string args)
{
this.pluginLog.Information("Command called!");
this.chatGui.Print("Command called!");

// this.window.IsOpen = true;
}

private bool OnCommandNew(bool var1, int var2, string? var3)
{
this.chatGui.Print($"CorePlugin: Command called! var1: {var1}, var2: {var2}, var3: {var3}");
return true;
}

private void OnOpenConfigUi()
{
// this.window.IsOpen = true;
Expand Down
10 changes: 8 additions & 2 deletions Dalamud/Console/ConsoleEntry.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,19 @@ public interface IConsoleEntry
/// Gets the name of the entry.
/// </summary>
public string Name { get; }

/// <summary>
/// Gets the description of the entry.
/// </summary>
public string Description { get; }

/// <summary>
/// Get a string representation of the usage of this entry, detailing the expected arguments.
/// </summary>
/// <returns>The usage string.</returns>
public string GetUsageString();
}

/// <summary>
/// Interface representing a command in the console.
/// </summary>
Expand Down
Loading
Loading