ExpandedSearchInfo/ExpandedSearchInfo/Plugin.cs

62 lines
1.9 KiB
C#
Raw Permalink Normal View History

2021-08-24 05:43:09 +00:00
using Dalamud.Game;
using Dalamud.Game.Command;
using Dalamud.IoC;
using Dalamud.Plugin;
2023-09-29 01:09:50 +00:00
using Dalamud.Plugin.Services;
2021-02-18 20:20:40 +00:00
2023-09-29 01:09:50 +00:00
namespace ExpandedSearchInfo;
2021-02-18 20:20:40 +00:00
2023-09-29 01:09:50 +00:00
// ReSharper disable once ClassNeverInstantiated.Global
public class Plugin : IDalamudPlugin {
internal static string Name => "Expanded Search Info";
2021-02-18 20:20:40 +00:00
2023-09-29 01:09:50 +00:00
[PluginService]
internal static IPluginLog Log { get; private set; } = null!;
2021-02-18 20:20:40 +00:00
2023-09-29 01:09:50 +00:00
[PluginService]
internal DalamudPluginInterface Interface { get; init; } = null!;
2021-08-24 05:43:09 +00:00
2023-09-29 01:09:50 +00:00
[PluginService]
internal ICommandManager CommandManager { get; init; } = null!;
2021-08-24 05:43:09 +00:00
2023-09-29 01:09:50 +00:00
[PluginService]
internal IGameGui GameGui { get; init; } = null!;
2021-08-24 05:43:09 +00:00
2023-09-29 01:09:50 +00:00
[PluginService]
internal IObjectTable ObjectTable { get; init; } = null!;
2021-08-24 05:43:09 +00:00
2023-09-29 01:09:50 +00:00
[PluginService]
internal ISigScanner SigScanner { get; init; } = null!;
2023-09-29 01:09:50 +00:00
[PluginService]
internal IGameInteropProvider GameInteropProvider { get; init; } = null!;
2023-09-29 01:09:50 +00:00
internal PluginConfiguration Config { get; }
internal GameFunctions Functions { get; }
internal SearchInfoRepository Repository { get; }
private PluginUi Ui { get; }
2021-02-18 20:20:40 +00:00
2023-09-29 01:09:50 +00:00
public Plugin() {
this.Config = (PluginConfiguration?) this.Interface.GetPluginConfig() ?? new PluginConfiguration();
this.Config.Initialise(this);
2023-09-29 01:09:50 +00:00
this.Functions = new GameFunctions(this);
this.Repository = new SearchInfoRepository(this);
this.Ui = new PluginUi(this);
this.CommandManager.AddHandler("/esi", new CommandInfo(this.OnCommand) {
HelpMessage = "Toggles Expanded Search Info's configuration window",
});
}
public void Dispose() {
this.CommandManager.RemoveHandler("/esi");
this.Ui.Dispose();
this.Repository.Dispose();
this.Functions.Dispose();
}
private void OnCommand(string command, string arguments) {
this.Ui.ConfigVisible = !this.Ui.ConfigVisible;
2021-02-18 20:20:40 +00:00
}
2023-09-29 01:09:50 +00:00
}