Skip to content

Commit

Permalink
rename PluginConfiguration to Configuration, trim comments
Browse files Browse the repository at this point in the history
  • Loading branch information
karashiiro committed Oct 10, 2020
1 parent 2892e28 commit 3765609
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 13 deletions.
2 changes: 1 addition & 1 deletion PluginConfiguration.cs → Configuration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace DalamudPluginProjectTemplate
{
public class PluginConfiguration : IPluginConfiguration
public class Configuration : IPluginConfiguration
{
public int Version { get; set; }

Expand Down
20 changes: 8 additions & 12 deletions Plugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ public class Plugin : IDalamudPlugin
{
private DalamudPluginInterface pluginInterface;
private PluginCommandManager<Plugin> commandManager;
private PluginConfiguration config;
private Configuration config;
private PluginUI ui;

public string Name => "Your Plugin's Display Name";
Expand All @@ -17,11 +17,9 @@ public void Initialize(DalamudPluginInterface pluginInterface)
{
this.pluginInterface = pluginInterface;

// If your plugin doesn't need a configuration, you can safely remove all references to this variable and class.
this.config = (PluginConfiguration)this.pluginInterface.GetPluginConfig() ?? new PluginConfiguration();
this.config = (Configuration)this.pluginInterface.GetPluginConfig() ?? new Configuration();
this.config.Initialize(this.pluginInterface);

// Likewise here.
this.ui = new PluginUI();
this.pluginInterface.UiBuilder.OnBuildUi += this.ui.Draw;

Expand All @@ -43,17 +41,15 @@ public void ExampleCommand1(string command, string args)
#region IDisposable Support
protected virtual void Dispose(bool disposing)
{
if (disposing)
{
this.commandManager.Dispose();
if (!disposing) return;

// You may not want to save a configuration until after you're done tweaking the class layout.
//this.pluginInterface.SavePluginConfig(this.config);
this.commandManager.Dispose();

this.pluginInterface.UiBuilder.OnBuildUi -= this.ui.Draw;
this.pluginInterface.SavePluginConfig(this.config);

this.pluginInterface.Dispose();
}
this.pluginInterface.UiBuilder.OnBuildUi -= this.ui.Draw;

this.pluginInterface.Dispose();
}

public void Dispose()
Expand Down

0 comments on commit 3765609

Please sign in to comment.