more mucking about
This commit is contained in:
parent
e3267f5499
commit
973ddb478f
2 changed files with 27 additions and 6 deletions
|
@ -1,13 +1,13 @@
|
||||||
|
using System;
|
||||||
using Dalamud.Configuration;
|
using Dalamud.Configuration;
|
||||||
using Dalamud.Plugin;
|
using Dalamud.Plugin;
|
||||||
using System;
|
|
||||||
|
|
||||||
namespace SamplePlugin
|
namespace SamplePlugin
|
||||||
{
|
{
|
||||||
[Serializable]
|
[Serializable]
|
||||||
public class Configuration : IPluginConfiguration
|
public class Configuration : IPluginConfiguration
|
||||||
{
|
{
|
||||||
public int Version { get; set; } = 0;
|
public int Version { get; set; }
|
||||||
|
|
||||||
public bool SomePropertyToBeSavedAndWithADefault { get; set; } = true;
|
public bool SomePropertyToBeSavedAndWithADefault { get; set; } = true;
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@ namespace SamplePlugin
|
||||||
|
|
||||||
public void Save()
|
public void Save()
|
||||||
{
|
{
|
||||||
this.pluginInterface!.SavePluginConfig(this);
|
pluginInterface!.SavePluginConfig(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,19 +1,22 @@
|
||||||
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using Dalamud.Game.Command;
|
using Dalamud.Game.Command;
|
||||||
using Dalamud.Interface.Windowing;
|
using Dalamud.Interface.Windowing;
|
||||||
using Dalamud.IoC;
|
using Dalamud.IoC;
|
||||||
using Dalamud.Plugin;
|
using Dalamud.Plugin;
|
||||||
using Dalamud.Plugin.Services;
|
using Dalamud.Plugin.Services;
|
||||||
|
using Dalamud.Utility;
|
||||||
using SamplePlugin.Windows;
|
using SamplePlugin.Windows;
|
||||||
|
|
||||||
namespace SamplePlugin
|
namespace SamplePlugin
|
||||||
{
|
{
|
||||||
public sealed class Plugin : IDalamudPlugin
|
public sealed class Plugin : IDalamudPlugin
|
||||||
{
|
{
|
||||||
public string Name => "Sample Plugin";
|
public static string Name => "Sample Plugin";
|
||||||
private const string CommandName = "/pmycommand";
|
private const string CommandName = "/pmycommand";
|
||||||
|
|
||||||
private DalamudPluginInterface pluginInterface { get; init; }
|
[PluginService]
|
||||||
|
private DalamudPluginInterface pluginInterface { get; set; } = null!;
|
||||||
private ICommandManager commandManager { get; init; }
|
private ICommandManager commandManager { get; init; }
|
||||||
public Configuration configuration { get; init; }
|
public Configuration configuration { get; init; }
|
||||||
internal WindowSystem windowSystem = new("SamplePlugin");
|
internal WindowSystem windowSystem = new("SamplePlugin");
|
||||||
|
@ -23,12 +26,30 @@ namespace SamplePlugin
|
||||||
|
|
||||||
public Plugin(
|
public Plugin(
|
||||||
[RequiredVersion("1.0")] DalamudPluginInterface pluginInterface,
|
[RequiredVersion("1.0")] DalamudPluginInterface pluginInterface,
|
||||||
[RequiredVersion("1.0")] ICommandManager commandManager
|
[RequiredVersion("1.0")] ICommandManager commandManager,
|
||||||
|
[RequiredVersion("1.0")] IPluginLog log
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
this.pluginInterface = pluginInterface;
|
this.pluginInterface = pluginInterface;
|
||||||
this.commandManager = commandManager;
|
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 =
|
configuration =
|
||||||
pluginInterface.GetPluginConfig() as Configuration ?? new Configuration();
|
pluginInterface.GetPluginConfig() as Configuration ?? new Configuration();
|
||||||
configuration.Initialize(this.pluginInterface);
|
configuration.Initialize(this.pluginInterface);
|
||||||
|
|
Loading…
Reference in a new issue