diff --git a/Dalamud/Configuration/PluginConfigurations.cs b/Dalamud/Configuration/PluginConfigurations.cs index fa2969d31..c01ab2af0 100644 --- a/Dalamud/Configuration/PluginConfigurations.cs +++ b/Dalamud/Configuration/PluginConfigurations.cs @@ -11,7 +11,7 @@ namespace Dalamud.Configuration; /// /// Configuration to store settings for a dalamud plugin. /// -[Api13ToDo("Make this a service. We need to be able to dispose it reliably to write configs asynchronously. Maybe also let people write files with vfs.")] +[Api14ToDo("Make this a service. We need to be able to dispose it reliably to write configs asynchronously. Maybe also let people write files with vfs.")] public sealed class PluginConfigurations { private readonly DirectoryInfo configDirectory; diff --git a/Dalamud/Game/Addon/Lifecycle/AddonArgTypes/AddonArgs.cs b/Dalamud/Game/Addon/Lifecycle/AddonArgTypes/AddonArgs.cs index 0b2ae1178..62ca47238 100644 --- a/Dalamud/Game/Addon/Lifecycle/AddonArgTypes/AddonArgs.cs +++ b/Dalamud/Game/Addon/Lifecycle/AddonArgTypes/AddonArgs.cs @@ -33,41 +33,14 @@ public abstract class AddonArgs /// public abstract AddonArgsType Type { get; } - /// - /// Checks if addon name matches the given span of char. - /// - /// The name to check. - /// Whether it is the case. - internal bool IsAddon(string name) - { - if (this.Addon.IsNull) - return false; - - if (name.Length is 0 or > 32) - return false; - - if (string.IsNullOrEmpty(this.Addon.Name)) - return false; - - return name == this.Addon.Name; - } - - /// - /// Clears this AddonArgs values. - /// - internal virtual void Clear() - { - this.addonName = null; - this.Addon = 0; - } - /// /// Helper method for ensuring the name of the addon is valid. /// /// The name of the addon for this object. when invalid. private string GetAddonName() { - if (this.Addon.IsNull) return InvalidAddon; + if (this.Addon.IsNull) + return InvalidAddon; var name = this.Addon.Name; diff --git a/Dalamud/Game/Addon/Lifecycle/AddonArgTypes/AddonDrawArgs.cs b/Dalamud/Game/Addon/Lifecycle/AddonArgTypes/AddonDrawArgs.cs index 7254ba7b3..a834d2983 100644 --- a/Dalamud/Game/Addon/Lifecycle/AddonArgTypes/AddonDrawArgs.cs +++ b/Dalamud/Game/Addon/Lifecycle/AddonArgTypes/AddonDrawArgs.cs @@ -1,15 +1,18 @@ -namespace Dalamud.Game.Addon.Lifecycle.AddonArgTypes; +using Dalamud.Utility; + +namespace Dalamud.Game.Addon.Lifecycle.AddonArgTypes; /// /// Addon argument data for Draw events. /// +[Obsolete("Use AddonGenericArgs instead.")] +[Api15ToDo("Remove this")] public class AddonDrawArgs : AddonArgs { /// /// Initializes a new instance of the class. /// - [Obsolete("Not intended for public construction.", false)] - public AddonDrawArgs() + internal AddonDrawArgs() { } diff --git a/Dalamud/Game/Addon/Lifecycle/AddonArgTypes/AddonFinalizeArgs.cs b/Dalamud/Game/Addon/Lifecycle/AddonArgTypes/AddonFinalizeArgs.cs index 12def3ad3..11d15a081 100644 --- a/Dalamud/Game/Addon/Lifecycle/AddonArgTypes/AddonFinalizeArgs.cs +++ b/Dalamud/Game/Addon/Lifecycle/AddonArgTypes/AddonFinalizeArgs.cs @@ -1,15 +1,18 @@ +using Dalamud.Utility; + namespace Dalamud.Game.Addon.Lifecycle.AddonArgTypes; /// /// Addon argument data for ReceiveEvent events. /// +[Obsolete("Use AddonGenericArgs instead.")] +[Api15ToDo("Remove this")] public class AddonFinalizeArgs : AddonArgs { /// /// Initializes a new instance of the class. /// - [Obsolete("Not intended for public construction.", false)] - public AddonFinalizeArgs() + internal AddonFinalizeArgs() { } diff --git a/Dalamud/Game/Addon/Lifecycle/AddonArgTypes/AddonGenericArgs.cs b/Dalamud/Game/Addon/Lifecycle/AddonArgTypes/AddonGenericArgs.cs index f3078af69..a20e9d23b 100644 --- a/Dalamud/Game/Addon/Lifecycle/AddonArgTypes/AddonGenericArgs.cs +++ b/Dalamud/Game/Addon/Lifecycle/AddonArgTypes/AddonGenericArgs.cs @@ -8,8 +8,7 @@ public class AddonGenericArgs : AddonArgs /// /// Initializes a new instance of the class. /// - [Obsolete("Not intended for public construction.", false)] - public AddonGenericArgs() + internal AddonGenericArgs() { } diff --git a/Dalamud/Game/Addon/Lifecycle/AddonArgTypes/AddonReceiveEventArgs.cs b/Dalamud/Game/Addon/Lifecycle/AddonArgTypes/AddonReceiveEventArgs.cs index 05f51b118..bb8168075 100644 --- a/Dalamud/Game/Addon/Lifecycle/AddonArgTypes/AddonReceiveEventArgs.cs +++ b/Dalamud/Game/Addon/Lifecycle/AddonArgTypes/AddonReceiveEventArgs.cs @@ -1,3 +1,5 @@ +using Dalamud.Utility; + namespace Dalamud.Game.Addon.Lifecycle.AddonArgTypes; /// @@ -8,8 +10,7 @@ public class AddonReceiveEventArgs : AddonArgs /// /// Initializes a new instance of the class. /// - [Obsolete("Not intended for public construction.", false)] - public AddonReceiveEventArgs() + internal AddonReceiveEventArgs() { } @@ -32,17 +33,8 @@ public class AddonReceiveEventArgs : AddonArgs public nint AtkEvent { get; set; } /// - /// Gets or sets the pointer to a block of data for this event message. + /// Gets or sets the pointer to an AtkEventData for this event message. /// + [Api14ToDo("Rename to AtkEventData")] public nint Data { get; set; } - - /// - internal override void Clear() - { - base.Clear(); - this.AtkEventType = 0; - this.EventParam = 0; - this.AtkEvent = 0; - this.Data = 0; - } } diff --git a/Dalamud/Game/Addon/Lifecycle/AddonArgTypes/AddonRefreshArgs.cs b/Dalamud/Game/Addon/Lifecycle/AddonArgTypes/AddonRefreshArgs.cs index c01c065c1..8af017318 100644 --- a/Dalamud/Game/Addon/Lifecycle/AddonArgTypes/AddonRefreshArgs.cs +++ b/Dalamud/Game/Addon/Lifecycle/AddonArgTypes/AddonRefreshArgs.cs @@ -1,3 +1,5 @@ +using Dalamud.Utility; + using FFXIVClientStructs.FFXIV.Component.GUI; namespace Dalamud.Game.Addon.Lifecycle.AddonArgTypes; @@ -10,8 +12,7 @@ public class AddonRefreshArgs : AddonArgs /// /// Initializes a new instance of the class. /// - [Obsolete("Not intended for public construction.", false)] - public AddonRefreshArgs() + internal AddonRefreshArgs() { } @@ -31,13 +32,7 @@ public class AddonRefreshArgs : AddonArgs /// /// Gets the AtkValues in the form of a span. /// + [Obsolete("Pending removal, unsafe to use when using custom ClientStructs")] + [Api15ToDo("Remove this")] public unsafe Span AtkValueSpan => new(this.AtkValues.ToPointer(), (int)this.AtkValueCount); - - /// - internal override void Clear() - { - base.Clear(); - this.AtkValueCount = 0; - this.AtkValues = 0; - } } diff --git a/Dalamud/Game/Addon/Lifecycle/AddonArgTypes/AddonRequestedUpdateArgs.cs b/Dalamud/Game/Addon/Lifecycle/AddonArgTypes/AddonRequestedUpdateArgs.cs index bf00c5d6e..7005b77c2 100644 --- a/Dalamud/Game/Addon/Lifecycle/AddonArgTypes/AddonRequestedUpdateArgs.cs +++ b/Dalamud/Game/Addon/Lifecycle/AddonArgTypes/AddonRequestedUpdateArgs.cs @@ -8,8 +8,7 @@ public class AddonRequestedUpdateArgs : AddonArgs /// /// Initializes a new instance of the class. /// - [Obsolete("Not intended for public construction.", false)] - public AddonRequestedUpdateArgs() + internal AddonRequestedUpdateArgs() { } @@ -25,12 +24,4 @@ public class AddonRequestedUpdateArgs : AddonArgs /// Gets or sets the StringArrayData** for this event. /// public nint StringArrayData { get; set; } - - /// - internal override void Clear() - { - base.Clear(); - this.NumberArrayData = 0; - this.StringArrayData = 0; - } } diff --git a/Dalamud/Game/Addon/Lifecycle/AddonArgTypes/AddonSetupArgs.cs b/Dalamud/Game/Addon/Lifecycle/AddonArgTypes/AddonSetupArgs.cs index 9b7e86a61..9fd7b6dd0 100644 --- a/Dalamud/Game/Addon/Lifecycle/AddonArgTypes/AddonSetupArgs.cs +++ b/Dalamud/Game/Addon/Lifecycle/AddonArgTypes/AddonSetupArgs.cs @@ -1,3 +1,5 @@ +using Dalamud.Utility; + using FFXIVClientStructs.FFXIV.Component.GUI; namespace Dalamud.Game.Addon.Lifecycle.AddonArgTypes; @@ -10,8 +12,7 @@ public class AddonSetupArgs : AddonArgs /// /// Initializes a new instance of the class. /// - [Obsolete("Not intended for public construction.", false)] - public AddonSetupArgs() + internal AddonSetupArgs() { } @@ -31,13 +32,7 @@ public class AddonSetupArgs : AddonArgs /// /// Gets the AtkValues in the form of a span. /// + [Obsolete("Pending removal, unsafe to use when using custom ClientStructs")] + [Api15ToDo("Remove this")] public unsafe Span AtkValueSpan => new(this.AtkValues.ToPointer(), (int)this.AtkValueCount); - - /// - internal override void Clear() - { - base.Clear(); - this.AtkValueCount = 0; - this.AtkValues = 0; - } } diff --git a/Dalamud/Game/Addon/Lifecycle/AddonArgTypes/AddonUpdateArgs.cs b/Dalamud/Game/Addon/Lifecycle/AddonArgTypes/AddonUpdateArgs.cs index bab62fc89..e6147d0eb 100644 --- a/Dalamud/Game/Addon/Lifecycle/AddonArgTypes/AddonUpdateArgs.cs +++ b/Dalamud/Game/Addon/Lifecycle/AddonArgTypes/AddonUpdateArgs.cs @@ -1,39 +1,35 @@ +using Dalamud.Utility; + namespace Dalamud.Game.Addon.Lifecycle.AddonArgTypes; /// /// Addon argument data for Update events. /// +[Obsolete("Use AddonGenericArgs instead.")] +[Api15ToDo("Remove this")] public class AddonUpdateArgs : AddonArgs { /// /// Initializes a new instance of the class. /// - [Obsolete("Not intended for public construction.", false)] - public AddonUpdateArgs() + internal AddonUpdateArgs() { } /// public override AddonArgsType Type => AddonArgsType.Update; - /// - /// Gets the time since the last update. - /// - public float TimeDelta - { - get => this.TimeDeltaInternal; - init => this.TimeDeltaInternal = value; - } - /// /// Gets or sets the time since the last update. /// internal float TimeDeltaInternal { get; set; } - /// - internal override void Clear() + /// + /// Gets the time since the last update. + /// + private float TimeDelta { - base.Clear(); - this.TimeDeltaInternal = 0; + get => this.TimeDeltaInternal; + init => this.TimeDeltaInternal = value; } } diff --git a/Dalamud/Game/Addon/Lifecycle/AddonLifecycleAddressResolver.cs b/Dalamud/Game/Addon/Lifecycle/AddonLifecycleAddressResolver.cs index 9359870a5..2fa3c5b91 100644 --- a/Dalamud/Game/Addon/Lifecycle/AddonLifecycleAddressResolver.cs +++ b/Dalamud/Game/Addon/Lifecycle/AddonLifecycleAddressResolver.cs @@ -5,7 +5,7 @@ namespace Dalamud.Game.Addon.Lifecycle; /// /// AddonLifecycleService memory address resolver. /// -[Api13ToDo("Remove this class entirely, its not used by AddonLifecycle anymore, also need to use something else for HookWidget")] +[Api14ToDo("Remove this class entirely, its not used by AddonLifecycle anymore, also need to use something else for HookWidget")] internal class AddonLifecycleAddressResolver : BaseAddressResolver { /// diff --git a/Dalamud/Game/Addon/Lifecycle/AddonVirtualTable.cs b/Dalamud/Game/Addon/Lifecycle/AddonVirtualTable.cs index d91cd648f..49ffdc7fb 100644 --- a/Dalamud/Game/Addon/Lifecycle/AddonVirtualTable.cs +++ b/Dalamud/Game/Addon/Lifecycle/AddonVirtualTable.cs @@ -26,8 +26,6 @@ internal unsafe class AddonVirtualTable : IDisposable private readonly AddonLifecycle lifecycleService; - // Obsolete warning is only to prevent users from creating their own event objects. -#pragma warning disable CS0618 // Type or member is obsolete private readonly AddonSetupArgs addonSetupArg = new(); private readonly AddonFinalizeArgs addonFinalizeArg = new(); private readonly AddonDrawArgs addonDrawArg = new(); @@ -36,7 +34,6 @@ internal unsafe class AddonVirtualTable : IDisposable private readonly AddonRequestedUpdateArgs addonRequestedUpdateArg = new(); private readonly AddonReceiveEventArgs addonReceiveEventArg = new(); private readonly AddonGenericArgs addonGenericArg = new(); -#pragma warning restore CS0618 // Type or member is obsolete private readonly AtkUnitBase* atkUnitBase; @@ -136,7 +133,6 @@ internal unsafe class AddonVirtualTable : IDisposable { this.LogEvent(EnableLogging); - this.addonSetupArg.Clear(); this.addonSetupArg.Addon = addon; this.addonSetupArg.AtkValueCount = valueCount; this.addonSetupArg.AtkValues = (nint)values; @@ -160,7 +156,6 @@ internal unsafe class AddonVirtualTable : IDisposable { this.LogEvent(EnableLogging); - this.addonFinalizeArg.Clear(); this.addonFinalizeArg.Addon = thisPtr; this.lifecycleService.InvokeListenersSafely(AddonEvent.PreFinalize, this.addonFinalizeArg); @@ -178,7 +173,6 @@ internal unsafe class AddonVirtualTable : IDisposable { this.LogEvent(EnableLogging); - this.addonDrawArg.Clear(); this.addonDrawArg.Addon = addon; this.lifecycleService.InvokeListenersSafely(AddonEvent.PreDraw, this.addonDrawArg); @@ -198,7 +192,6 @@ internal unsafe class AddonVirtualTable : IDisposable { this.LogEvent(EnableLogging); - this.addonUpdateArg.Clear(); this.addonUpdateArg.Addon = addon; this.addonUpdateArg.TimeDeltaInternal = delta; this.lifecycleService.InvokeListenersSafely(AddonEvent.PreUpdate, this.addonUpdateArg); @@ -221,7 +214,6 @@ internal unsafe class AddonVirtualTable : IDisposable var result = false; - this.addonRefreshArg.Clear(); this.addonRefreshArg.Addon = addon; this.addonRefreshArg.AtkValueCount = valueCount; this.addonRefreshArg.AtkValues = (nint)values; @@ -246,7 +238,6 @@ internal unsafe class AddonVirtualTable : IDisposable { this.LogEvent(EnableLogging); - this.addonRequestedUpdateArg.Clear(); this.addonRequestedUpdateArg.Addon = addon; this.addonRequestedUpdateArg.NumberArrayData = (nint)numberArrayData; this.addonRequestedUpdateArg.StringArrayData = (nint)stringArrayData; @@ -270,7 +261,6 @@ internal unsafe class AddonVirtualTable : IDisposable { this.LogEvent(EnableLogging); - this.addonReceiveEventArg.Clear(); this.addonReceiveEventArg.Addon = (nint)addon; this.addonReceiveEventArg.AtkEventType = (byte)eventType; this.addonReceiveEventArg.EventParam = eventParam; @@ -300,7 +290,6 @@ internal unsafe class AddonVirtualTable : IDisposable var result = false; - this.addonGenericArg.Clear(); this.addonGenericArg.Addon = thisPtr; this.lifecycleService.InvokeListenersSafely(AddonEvent.PreOpen, this.addonGenericArg); @@ -324,7 +313,6 @@ internal unsafe class AddonVirtualTable : IDisposable var result = false; - this.addonGenericArg.Clear(); this.addonGenericArg.Addon = thisPtr; this.lifecycleService.InvokeListenersSafely(AddonEvent.PreClose, this.addonGenericArg); @@ -346,7 +334,6 @@ internal unsafe class AddonVirtualTable : IDisposable { this.LogEvent(EnableLogging); - this.addonGenericArg.Clear(); this.addonGenericArg.Addon = thisPtr; this.lifecycleService.InvokeListenersSafely(AddonEvent.PreShow, this.addonGenericArg); @@ -366,7 +353,6 @@ internal unsafe class AddonVirtualTable : IDisposable { this.LogEvent(EnableLogging); - this.addonGenericArg.Clear(); this.addonGenericArg.Addon = thisPtr; this.lifecycleService.InvokeListenersSafely(AddonEvent.PreHide, this.addonGenericArg); diff --git a/Dalamud/Game/Gui/Dtr/DtrBarEntry.cs b/Dalamud/Game/Gui/Dtr/DtrBarEntry.cs index f5b7011fe..af85f9228 100644 --- a/Dalamud/Game/Gui/Dtr/DtrBarEntry.cs +++ b/Dalamud/Game/Gui/Dtr/DtrBarEntry.cs @@ -150,7 +150,7 @@ internal sealed unsafe class DtrBarEntry : IDisposable, IDtrBarEntry } /// - [Api13ToDo("Maybe make this config scoped to internal name?")] + [Api14ToDo("Maybe make this config scoped to internal name?")] public bool UserHidden => this.configuration.DtrIgnore?.Contains(this.Title) ?? false; /// diff --git a/Dalamud/Interface/Animation/Easing.cs b/Dalamud/Interface/Animation/Easing.cs index 0d2057b3b..cc1f48ce7 100644 --- a/Dalamud/Interface/Animation/Easing.cs +++ b/Dalamud/Interface/Animation/Easing.cs @@ -48,7 +48,7 @@ public abstract class Easing /// Gets the current value of the animation, following unclamped logic. /// [Obsolete($"This field has been deprecated. Use either {nameof(ValueClamped)} or {nameof(ValueUnclamped)} instead.", true)] - [Api13ToDo("Map this field to ValueClamped, probably.")] + [Api14ToDo("Map this field to ValueClamped, probably.")] public double Value => this.ValueUnclamped; /// diff --git a/Dalamud/Utility/Api13ToDoAttribute.cs b/Dalamud/Utility/Api14ToDoAttribute.cs similarity index 75% rename from Dalamud/Utility/Api13ToDoAttribute.cs rename to Dalamud/Utility/Api14ToDoAttribute.cs index 576401cda..945b6e4db 100644 --- a/Dalamud/Utility/Api13ToDoAttribute.cs +++ b/Dalamud/Utility/Api14ToDoAttribute.cs @@ -4,7 +4,7 @@ namespace Dalamud.Utility; /// Utility class for marking something to be changed for API 13, for ease of lookup. /// [AttributeUsage(AttributeTargets.All, Inherited = false)] -internal sealed class Api13ToDoAttribute : Attribute +internal sealed class Api14ToDoAttribute : Attribute { /// /// Marks that this should be made internal. @@ -12,11 +12,11 @@ internal sealed class Api13ToDoAttribute : Attribute public const string MakeInternal = "Make internal."; /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// The explanation. /// The explanation 2. - public Api13ToDoAttribute(string what, string what2 = "") + public Api14ToDoAttribute(string what, string what2 = "") { _ = what; _ = what2; diff --git a/Dalamud/Utility/Api15ToDoAttribute.cs b/Dalamud/Utility/Api15ToDoAttribute.cs new file mode 100644 index 000000000..646c260e8 --- /dev/null +++ b/Dalamud/Utility/Api15ToDoAttribute.cs @@ -0,0 +1,25 @@ +namespace Dalamud.Utility; + +/// +/// Utility class for marking something to be changed for API 13, for ease of lookup. +/// Intended to represent not the upcoming API, but the one after it for more major changes. +/// +[AttributeUsage(AttributeTargets.All, Inherited = false)] +internal sealed class Api15ToDoAttribute : Attribute +{ + /// + /// Marks that this should be made internal. + /// + public const string MakeInternal = "Make internal."; + + /// + /// Initializes a new instance of the class. + /// + /// The explanation. + /// The explanation 2. + public Api15ToDoAttribute(string what, string what2 = "") + { + _ = what; + _ = what2; + } +} diff --git a/Dalamud/Utility/Util.cs b/Dalamud/Utility/Util.cs index 19610ef64..f6abc336c 100644 --- a/Dalamud/Utility/Util.cs +++ b/Dalamud/Utility/Util.cs @@ -79,7 +79,7 @@ public static partial class Util /// /// Gets the Dalamud version. /// - [Api13ToDo("Remove. Make both versions here internal. Add an API somewhere.")] + [Api14ToDo("Remove. Make both versions here internal. Add an API somewhere.")] public static string AssemblyVersion { get; } = Assembly.GetAssembly(typeof(ChatHandlers))!.GetName().Version!.ToString();