refactor: move to net5

This commit is contained in:
Anna 2021-08-29 13:49:52 -04:00
parent f797ad8968
commit 4592d66c60
6 changed files with 26 additions and 24 deletions

View File

@ -10,13 +10,13 @@ namespace TextBoxStyler {
internal Commands(Plugin plugin) { internal Commands(Plugin plugin) {
this.Plugin = plugin; this.Plugin = plugin;
this.Plugin.Interface.CommandManager.AddHandler(CommandName, new CommandInfo(this.OnCommand) { this.Plugin.CommandManager.AddHandler(CommandName, new CommandInfo(this.OnCommand) {
HelpMessage = $"Opens the settings for {this.Plugin.Name}", HelpMessage = $"Opens the settings for {this.Plugin.Name}",
}); });
} }
public void Dispose() { public void Dispose() {
this.Plugin.Interface.CommandManager.RemoveHandler(CommandName); this.Plugin.CommandManager.RemoveHandler(CommandName);
} }
private void OnCommand(string command, string args) { private void OnCommand(string command, string args) {

View File

@ -1,3 +0,0 @@
<Weavers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FodyWeavers.xsd">
<ILMerge/>
</Weavers>

View File

@ -1,19 +1,24 @@
using Dalamud.Plugin; using Dalamud.Game.Command;
using Dalamud.IoC;
using Dalamud.Plugin;
namespace TextBoxStyler { namespace TextBoxStyler {
// ReSharper disable once ClassNeverInstantiated.Global // ReSharper disable once ClassNeverInstantiated.Global
public class Plugin : IDalamudPlugin { public class Plugin : IDalamudPlugin {
public string Name => "Text Box Styler"; public string Name => "Text Box Styler";
internal DalamudPluginInterface Interface { get; private set; } = null!; [PluginService]
internal PluginConfiguration Config { get; private set; } = null!; internal DalamudPluginInterface Interface { get; private init; } = null!;
internal PluginUi Ui { get; private set; } = null!;
private Styler Styler { get; set; } = null!;
private Commands Commands { get; set; } = null!;
public void Initialize(DalamudPluginInterface pluginInterface) { [PluginService]
this.Interface = pluginInterface; internal CommandManager CommandManager { get; private init; } = null!;
internal PluginConfiguration Config { get; }
internal PluginUi Ui { get; }
private Styler Styler { get; }
private Commands Commands { get; }
public Plugin() {
this.Config = this.Interface.GetPluginConfig() as PluginConfiguration ?? new PluginConfiguration(); this.Config = this.Interface.GetPluginConfig() as PluginConfiguration ?? new PluginConfiguration();
this.Config.Initialise(this); this.Config.Initialise(this);

View File

@ -18,16 +18,16 @@ namespace TextBoxStyler {
internal PluginUi(Plugin plugin) { internal PluginUi(Plugin plugin) {
this.Plugin = plugin; this.Plugin = plugin;
this.Plugin.Interface.UiBuilder.OnBuildUi += this.Draw; this.Plugin.Interface.UiBuilder.Draw += this.Draw;
this.Plugin.Interface.UiBuilder.OnOpenConfigUi += this.ToggleConfig; this.Plugin.Interface.UiBuilder.OpenConfigUi += this.ToggleConfig;
} }
public void Dispose() { public void Dispose() {
this.Plugin.Interface.UiBuilder.OnOpenConfigUi -= this.ToggleConfig; this.Plugin.Interface.UiBuilder.OpenConfigUi -= this.ToggleConfig;
this.Plugin.Interface.UiBuilder.OnBuildUi -= this.Draw; this.Plugin.Interface.UiBuilder.Draw -= this.Draw;
} }
internal void ToggleConfig(object? sender = null, EventArgs? e = null) { internal void ToggleConfig() {
this.DrawUi = !this.DrawUi; this.DrawUi = !this.DrawUi;
} }

View File

@ -10,7 +10,7 @@ namespace TextBoxStyler {
public Styler(Plugin plugin) { public Styler(Plugin plugin) {
this.Plugin = plugin; this.Plugin = plugin;
this.Common = new XivCommonBase(this.Plugin.Interface, Hooks.Talk | Hooks.BattleTalk); this.Common = new XivCommonBase(Hooks.Talk | Hooks.BattleTalk);
this.Common.Functions.Talk.OnTalk += this.StyleTalk; this.Common.Functions.Talk.OnTalk += this.StyleTalk;
this.Common.Functions.BattleTalk.OnBattleTalk += this.StyleBattleTalk; this.Common.Functions.BattleTalk.OnBattleTalk += this.StyleBattleTalk;

View File

@ -1,10 +1,12 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFramework>net48</TargetFramework> <TargetFramework>net5-windows</TargetFramework>
<Version>1.1.0</Version> <Version>1.1.0</Version>
<LangVersion>latest</LangVersion> <LangVersion>latest</LangVersion>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
<ProduceReferenceAssembly>false</ProduceReferenceAssembly>
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
@ -23,10 +25,8 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="DalamudPackager" Version="1.2.1" /> <PackageReference Include="DalamudPackager" Version="2.1.2" />
<PackageReference Include="Fody" Version="6.5.1" PrivateAssets="all" /> <PackageReference Include="XivCommon" Version="3.0.1" />
<PackageReference Include="ILMerge.Fody" Version="1.16.0" PrivateAssets="all" />
<PackageReference Include="XivCommon" Version="1.4.0" />
</ItemGroup> </ItemGroup>
</Project> </Project>