more mucking about

main
Zynh0722 2024-02-06 23:58:16 -08:00
parent e3267f5499
commit 973ddb478f
2 changed files with 27 additions and 6 deletions

View File

@ -1,13 +1,13 @@
using System;
using Dalamud.Configuration;
using Dalamud.Plugin;
using System;
namespace SamplePlugin
{
[Serializable]
public class Configuration : IPluginConfiguration
{
public int Version { get; set; } = 0;
public int Version { get; set; }
public bool SomePropertyToBeSavedAndWithADefault { get; set; } = true;
@ -22,7 +22,7 @@ namespace SamplePlugin
public void Save()
{
this.pluginInterface!.SavePluginConfig(this);
pluginInterface!.SavePluginConfig(this);
}
}
}

View File

@ -1,19 +1,22 @@
using System;
using System.IO;
using Dalamud.Game.Command;
using Dalamud.Interface.Windowing;
using Dalamud.IoC;
using Dalamud.Plugin;
using Dalamud.Plugin.Services;
using Dalamud.Utility;
using SamplePlugin.Windows;
namespace SamplePlugin
{
public sealed class Plugin : IDalamudPlugin
{
public string Name => "Sample Plugin";
public static string Name => "Sample Plugin";
private const string CommandName = "/pmycommand";
private DalamudPluginInterface pluginInterface { get; init; }
[PluginService]
private DalamudPluginInterface pluginInterface { get; set; } = null!;
private ICommandManager commandManager { get; init; }
public Configuration configuration { get; init; }
internal WindowSystem windowSystem = new("SamplePlugin");
@ -23,12 +26,30 @@ namespace SamplePlugin
public Plugin(
[RequiredVersion("1.0")] DalamudPluginInterface pluginInterface,
[RequiredVersion("1.0")] ICommandManager commandManager
[RequiredVersion("1.0")] ICommandManager commandManager,
[RequiredVersion("1.0")] IPluginLog log
)
{
this.pluginInterface = pluginInterface;
this.commandManager = commandManager;
var pluginList = pluginInterface.InstalledPlugins;
foreach (var plugin in pluginList)
{
var assemblyName = plugin.GetType().Assembly.GetName().Name;
if (
!assemblyName.IsNullOrWhitespace()
&& !assemblyName.Equals(plugin.InternalName, StringComparison.Ordinal)
)
{
log.Warning(
"Miss-match: Name: {plugin} AssName: {assemblyName}",
plugin.Name,
assemblyName
);
}
}
configuration =
pluginInterface.GetPluginConfig() as Configuration ?? new Configuration();
configuration.Initialize(this.pluginInterface);