we are free of linting errors

This commit is contained in:
Zynh0722 2024-02-07 16:31:05 -08:00
parent 9abcc3bf0f
commit ccaf9e11ca
3 changed files with 74 additions and 72 deletions

View file

@ -1,12 +1,11 @@
using System;
using System.IO;
using CommandReference.Windows;
using Dalamud.Game.Command;
using Dalamud.Interface.Windowing;
using Dalamud.IoC;
using Dalamud.Plugin;
using Dalamud.Plugin.Services;
using Dalamud.Utility;
using CommandReference.Windows;
namespace CommandReference
{
@ -72,7 +71,7 @@ namespace CommandReference
{
windowSystem.RemoveAllWindows();
ConfigWindow.Dispose();
((IDisposable)ConfigWindow).Dispose();
MainWindow.Dispose();
_ = commandManager.RemoveHandler(CommandName);

View file

@ -3,11 +3,11 @@ using System.Numerics;
using Dalamud.Interface.Windowing;
using ImGuiNET;
namespace CommandReference.Windows;
namespace CommandReference.Windows
{
public class ConfigWindow : Window, IDisposable
{
private Configuration Configuration;
private readonly Configuration configuration;
public ConfigWindow(Plugin plugin)
: base(
@ -18,23 +18,27 @@ public class ConfigWindow : Window, IDisposable
| ImGuiWindowFlags.NoScrollWithMouse
)
{
this.Size = new Vector2(232, 75);
this.SizeCondition = ImGuiCond.Always;
Size = new Vector2(232, 75);
SizeCondition = ImGuiCond.Always;
this.Configuration = plugin.configuration;
configuration = plugin.configuration;
}
public void Dispose() { }
public void Dispose()
{
GC.SuppressFinalize(this);
}
public override void Draw()
{
// can't ref a property, so use a local copy
var configValue = this.Configuration.SomePropertyToBeSavedAndWithADefault;
var configValue = configuration.SomePropertyToBeSavedAndWithADefault;
if (ImGui.Checkbox("Random Config Bool", ref configValue))
{
this.Configuration.SomePropertyToBeSavedAndWithADefault = configValue;
configuration.SomePropertyToBeSavedAndWithADefault = configValue;
// can save immediately on change, if you don't want to provide a "Save and Close" button
this.Configuration.Save();
configuration.Save();
}
}
}
}

View file

@ -4,12 +4,12 @@ using Dalamud.Interface.Internal;
using Dalamud.Interface.Windowing;
using ImGuiNET;
namespace CommandReference.Windows;
namespace CommandReference.Windows
{
public class MainWindow : Window, IDisposable
{
private IDalamudTextureWrap GoatImage;
private Plugin Plugin;
private readonly IDalamudTextureWrap goatImage;
private readonly Plugin plugin;
public MainWindow(Plugin plugin, IDalamudTextureWrap goatImage)
: base(
@ -17,40 +17,39 @@ public class MainWindow : Window, IDisposable
ImGuiWindowFlags.NoScrollbar | ImGuiWindowFlags.NoScrollWithMouse
)
{
this.SizeConstraints = new WindowSizeConstraints
SizeConstraints = new WindowSizeConstraints
{
MinimumSize = new Vector2(375, 330),
MaximumSize = new Vector2(float.MaxValue, float.MaxValue)
};
this.GoatImage = goatImage;
this.Plugin = plugin;
this.goatImage = goatImage;
this.plugin = plugin;
}
public void Dispose()
{
this.GoatImage.Dispose();
goatImage.Dispose();
GC.SuppressFinalize(this);
}
public override void Draw()
{
ImGui.Text(
$"The random config bool is {this.Plugin.configuration.SomePropertyToBeSavedAndWithADefault}"
$"The random config bool is {plugin.configuration.SomePropertyToBeSavedAndWithADefault}"
);
if (ImGui.Button("Show Settings"))
{
this.Plugin.DrawConfigUI();
plugin.DrawConfigUI();
}
ImGui.Spacing();
ImGui.Text("Have a goat:");
ImGui.Indent(55);
ImGui.Image(
this.GoatImage.ImGuiHandle,
new Vector2(this.GoatImage.Width, this.GoatImage.Height)
);
ImGui.Image(goatImage.ImGuiHandle, new Vector2(goatImage.Width, goatImage.Height));
ImGui.Unindent(55);
}
}
}