initial commit based on sampleplugin
This commit is contained in:
65
MareSynchronos/Plugin.cs
Normal file
65
MareSynchronos/Plugin.cs
Normal file
@@ -0,0 +1,65 @@
|
||||
using Dalamud.Game.Command;
|
||||
using Dalamud.IoC;
|
||||
using Dalamud.Plugin;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
//using System.Data.SQLite;
|
||||
|
||||
namespace SamplePlugin
|
||||
{
|
||||
public sealed class Plugin : IDalamudPlugin
|
||||
{
|
||||
public string Name => "Mare Synchronos";
|
||||
|
||||
private const string commandName = "/pscan";
|
||||
|
||||
private DalamudPluginInterface PluginInterface { get; init; }
|
||||
private CommandManager CommandManager { get; init; }
|
||||
private Configuration Configuration { get; init; }
|
||||
private PluginUI PluginUi { get; init; }
|
||||
|
||||
public Plugin(
|
||||
[RequiredVersion("1.0")] DalamudPluginInterface pluginInterface,
|
||||
[RequiredVersion("1.0")] CommandManager commandManager)
|
||||
{
|
||||
this.PluginInterface = pluginInterface;
|
||||
this.CommandManager = commandManager;
|
||||
|
||||
this.Configuration = this.PluginInterface.GetPluginConfig() as Configuration ?? new Configuration();
|
||||
this.Configuration.Initialize(this.PluginInterface);
|
||||
|
||||
// you might normally want to embed resources and load them from the manifest stream
|
||||
this.PluginUi = new PluginUI(this.Configuration);
|
||||
|
||||
this.CommandManager.AddHandler(commandName, new CommandInfo(OnCommand)
|
||||
{
|
||||
HelpMessage = "A useful message to display in /xlhelp"
|
||||
});
|
||||
|
||||
this.PluginInterface.UiBuilder.Draw += DrawUI;
|
||||
this.PluginInterface.UiBuilder.OpenConfigUi += DrawConfigUI;
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
this.PluginUi.Dispose();
|
||||
this.CommandManager.RemoveHandler(commandName);
|
||||
}
|
||||
|
||||
private void OnCommand(string command, string args)
|
||||
{
|
||||
//using var connection = new SQLiteConnection("Data Source=penumbracache.db");
|
||||
//connection.Open();
|
||||
}
|
||||
|
||||
private void DrawUI()
|
||||
{
|
||||
this.PluginUi.Draw();
|
||||
}
|
||||
|
||||
private void DrawConfigUI()
|
||||
{
|
||||
this.PluginUi.SettingsVisible = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user