From 0c8c4bfdbfb08fbdc0e1134e0638bb1e505d1b87 Mon Sep 17 00:00:00 2001 From: KazWolfe Date: Sun, 16 Jun 2024 04:01:17 -0700 Subject: [PATCH] chore: Remove the [InterfaceVersion] attribute (#1844) --- Dalamud.sln.DotSettings | 7 +- Dalamud/Console/ConsoleManagerPluginScoped.cs | 1 - Dalamud/Data/DataManager.cs | 1 - .../Game/Addon/Events/AddonEventManager.cs | 2 - .../Game/Addon/Lifecycle/AddonLifecycle.cs | 2 - .../ClientState/Aetherytes/AetheryteList.cs | 1 - Dalamud/Game/ClientState/Buddy/BuddyList.cs | 1 - Dalamud/Game/ClientState/ClientState.cs | 2 - .../Game/ClientState/Conditions/Condition.cs | 2 - Dalamud/Game/ClientState/Fates/FateTable.cs | 1 - .../Game/ClientState/GamePad/GamepadState.cs | 1 - .../Game/ClientState/JobGauge/JobGauges.cs | 1 - Dalamud/Game/ClientState/Keys/KeyState.cs | 1 - .../Game/ClientState/Objects/ObjectTable.cs | 1 - .../Game/ClientState/Objects/TargetManager.cs | 1 - Dalamud/Game/ClientState/Party/PartyList.cs | 1 - Dalamud/Game/Command/CommandManager.cs | 2 - Dalamud/Game/Config/GameConfig.cs | 2 - Dalamud/Game/DutyState/DutyState.cs | 2 - Dalamud/Game/Framework.cs | 2 - Dalamud/Game/GameLifecycle.cs | 1 - Dalamud/Game/Gui/ChatGui.cs | 2 - Dalamud/Game/Gui/ContextMenu/ContextMenu.cs | 2 - Dalamud/Game/Gui/Dtr/DtrBar.cs | 3 +- Dalamud/Game/Gui/FlyText/FlyTextGui.cs | 2 - Dalamud/Game/Gui/GameGui.cs | 2 - .../Game/Gui/PartyFinder/PartyFinderGui.cs | 2 - Dalamud/Game/Gui/Toast/ToastGui.cs | 2 - Dalamud/Game/Inventory/GameInventory.cs | 2 - Dalamud/Game/Network/GameNetwork.cs | 2 - Dalamud/Game/TargetSigScanner.cs | 1 - .../GameInteropProviderPluginScoped.cs | 1 - .../Internal/NotificationManager.cs | 2 - .../Internal/TextureManagerPluginScoped.cs | 1 - .../TitleScreenMenu/TitleScreenMenu.cs | 2 - .../IoC/Internal/InterfaceVersionAttribute.cs | 22 ------ Dalamud/IoC/Internal/ObjectInstance.cs | 6 -- Dalamud/IoC/Internal/ServiceContainer.cs | 67 +++---------------- Dalamud/IoC/RequiredVersionAttribute.cs | 22 ------ Dalamud/Logging/ScopedPluginLogService.cs | 1 - build/build.csproj.DotSettings | 5 +- 41 files changed, 20 insertions(+), 164 deletions(-) delete mode 100644 Dalamud/IoC/Internal/InterfaceVersionAttribute.cs delete mode 100644 Dalamud/IoC/RequiredVersionAttribute.cs diff --git a/Dalamud.sln.DotSettings b/Dalamud.sln.DotSettings index 188e70c2b..b0f66b736 100644 --- a/Dalamud.sln.DotSettings +++ b/Dalamud.sln.DotSettings @@ -37,6 +37,10 @@ <Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /> <Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /> <Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /> + <Policy><Descriptor Staticness="Any" AccessRightKinds="Private" Description="Constant fields (private)"><ElementKinds><Kind Name="CONSTANT_FIELD" /></ElementKinds></Descriptor><Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /></Policy> + <Policy><Descriptor Staticness="Instance" AccessRightKinds="Private" Description="Instance fields (private)"><ElementKinds><Kind Name="FIELD" /><Kind Name="READONLY_FIELD" /></ElementKinds></Descriptor><Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /></Policy> + <Policy><Descriptor Staticness="Any" AccessRightKinds="Protected, ProtectedInternal, Internal, Public, PrivateProtected" Description="Constant fields (not private)"><ElementKinds><Kind Name="CONSTANT_FIELD" /></ElementKinds></Descriptor><Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /></Policy> + <Policy><Descriptor Staticness="Static" AccessRightKinds="Private" Description="Static fields (private)"><ElementKinds><Kind Name="FIELD" /></ElementKinds></Descriptor><Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /></Policy> True True True @@ -46,6 +50,7 @@ True True True + True True True True @@ -63,4 +68,4 @@ True True True - True \ No newline at end of file + True diff --git a/Dalamud/Console/ConsoleManagerPluginScoped.cs b/Dalamud/Console/ConsoleManagerPluginScoped.cs index fed614cfc..bc60c2dab 100644 --- a/Dalamud/Console/ConsoleManagerPluginScoped.cs +++ b/Dalamud/Console/ConsoleManagerPluginScoped.cs @@ -15,7 +15,6 @@ namespace Dalamud.Console; /// Plugin-scoped version of the console service. /// [PluginInterface] -[InterfaceVersion("1.0")] [ServiceManager.ScopedService] #pragma warning disable SA1015 [ResolveVia] diff --git a/Dalamud/Data/DataManager.cs b/Dalamud/Data/DataManager.cs index 2398cdb16..0a344945e 100644 --- a/Dalamud/Data/DataManager.cs +++ b/Dalamud/Data/DataManager.cs @@ -18,7 +18,6 @@ namespace Dalamud.Data; /// This class provides data for Dalamud-internal features, but can also be used by plugins if needed. /// [PluginInterface] -[InterfaceVersion("1.0")] [ServiceManager.EarlyLoadedService] #pragma warning disable SA1015 [ResolveVia] diff --git a/Dalamud/Game/Addon/Events/AddonEventManager.cs b/Dalamud/Game/Addon/Events/AddonEventManager.cs index dda05a6bc..dce2a7e73 100644 --- a/Dalamud/Game/Addon/Events/AddonEventManager.cs +++ b/Dalamud/Game/Addon/Events/AddonEventManager.cs @@ -17,7 +17,6 @@ namespace Dalamud.Game.Addon.Events; /// /// Service provider for addon event management. /// -[InterfaceVersion("1.0")] [ServiceManager.EarlyLoadedService] internal unsafe class AddonEventManager : IInternalDisposableService { @@ -199,7 +198,6 @@ internal unsafe class AddonEventManager : IInternalDisposableService /// Plugin-scoped version of a AddonEventManager service. /// [PluginInterface] -[InterfaceVersion("1.0")] [ServiceManager.ScopedService] #pragma warning disable SA1015 [ResolveVia] diff --git a/Dalamud/Game/Addon/Lifecycle/AddonLifecycle.cs b/Dalamud/Game/Addon/Lifecycle/AddonLifecycle.cs index 7270fb437..be334f441 100644 --- a/Dalamud/Game/Addon/Lifecycle/AddonLifecycle.cs +++ b/Dalamud/Game/Addon/Lifecycle/AddonLifecycle.cs @@ -18,7 +18,6 @@ namespace Dalamud.Game.Addon.Lifecycle; /// /// This class provides events for in-game addon lifecycles. /// -[InterfaceVersion("1.0")] [ServiceManager.EarlyLoadedService] internal unsafe class AddonLifecycle : IInternalDisposableService { @@ -386,7 +385,6 @@ internal unsafe class AddonLifecycle : IInternalDisposableService /// Plugin-scoped version of a AddonLifecycle service. /// [PluginInterface] -[InterfaceVersion("1.0")] [ServiceManager.ScopedService] #pragma warning disable SA1015 [ResolveVia] diff --git a/Dalamud/Game/ClientState/Aetherytes/AetheryteList.cs b/Dalamud/Game/ClientState/Aetherytes/AetheryteList.cs index 4793bcea5..eee4d0f19 100644 --- a/Dalamud/Game/ClientState/Aetherytes/AetheryteList.cs +++ b/Dalamud/Game/ClientState/Aetherytes/AetheryteList.cs @@ -14,7 +14,6 @@ namespace Dalamud.Game.ClientState.Aetherytes; /// This collection represents the list of available Aetherytes in the Teleport window. /// [PluginInterface] -[InterfaceVersion("1.0")] [ServiceManager.EarlyLoadedService] #pragma warning disable SA1015 [ResolveVia] diff --git a/Dalamud/Game/ClientState/Buddy/BuddyList.cs b/Dalamud/Game/ClientState/Buddy/BuddyList.cs index 9719b0cb3..004e23b2a 100644 --- a/Dalamud/Game/ClientState/Buddy/BuddyList.cs +++ b/Dalamud/Game/ClientState/Buddy/BuddyList.cs @@ -16,7 +16,6 @@ namespace Dalamud.Game.ClientState.Buddy; /// It does not include the local player. /// [PluginInterface] -[InterfaceVersion("1.0")] [ServiceManager.EarlyLoadedService] #pragma warning disable SA1015 [ResolveVia] diff --git a/Dalamud/Game/ClientState/ClientState.cs b/Dalamud/Game/ClientState/ClientState.cs index 2e8d128c3..a4cc2272f 100644 --- a/Dalamud/Game/ClientState/ClientState.cs +++ b/Dalamud/Game/ClientState/ClientState.cs @@ -23,7 +23,6 @@ namespace Dalamud.Game.ClientState; /// /// This class represents the state of the game client at the time of access. /// -[InterfaceVersion("1.0")] [ServiceManager.EarlyLoadedService] internal sealed class ClientState : IInternalDisposableService, IClientState { @@ -203,7 +202,6 @@ internal sealed class ClientState : IInternalDisposableService, IClientState /// Plugin-scoped version of a GameConfig service. /// [PluginInterface] -[InterfaceVersion("1.0")] [ServiceManager.ScopedService] #pragma warning disable SA1015 [ResolveVia] diff --git a/Dalamud/Game/ClientState/Conditions/Condition.cs b/Dalamud/Game/ClientState/Conditions/Condition.cs index d281d7aec..dbc2d9356 100644 --- a/Dalamud/Game/ClientState/Conditions/Condition.cs +++ b/Dalamud/Game/ClientState/Conditions/Condition.cs @@ -9,7 +9,6 @@ namespace Dalamud.Game.ClientState.Conditions; /// /// Provides access to conditions (generally player state). You can check whether a player is in combat, mounted, etc. /// -[InterfaceVersion("1.0")] [ServiceManager.EarlyLoadedService] internal sealed class Condition : IInternalDisposableService, ICondition { @@ -138,7 +137,6 @@ internal sealed class Condition : IInternalDisposableService, ICondition /// Plugin-scoped version of a Condition service. /// [PluginInterface] -[InterfaceVersion("1.0")] [ServiceManager.ScopedService] #pragma warning disable SA1015 [ResolveVia] diff --git a/Dalamud/Game/ClientState/Fates/FateTable.cs b/Dalamud/Game/ClientState/Fates/FateTable.cs index 0f8693d4d..76ae5302c 100644 --- a/Dalamud/Game/ClientState/Fates/FateTable.cs +++ b/Dalamud/Game/ClientState/Fates/FateTable.cs @@ -13,7 +13,6 @@ namespace Dalamud.Game.ClientState.Fates; /// This collection represents the currently available Fate events. /// [PluginInterface] -[InterfaceVersion("1.0")] [ServiceManager.EarlyLoadedService] #pragma warning disable SA1015 [ResolveVia] diff --git a/Dalamud/Game/ClientState/GamePad/GamepadState.cs b/Dalamud/Game/ClientState/GamePad/GamepadState.cs index 2e339b42f..79698d2cc 100644 --- a/Dalamud/Game/ClientState/GamePad/GamepadState.cs +++ b/Dalamud/Game/ClientState/GamePad/GamepadState.cs @@ -16,7 +16,6 @@ namespace Dalamud.Game.ClientState.GamePad; /// Will block game's gamepad input if is set. /// [PluginInterface] -[InterfaceVersion("1.0")] [ServiceManager.EarlyLoadedService] #pragma warning disable SA1015 [ResolveVia] diff --git a/Dalamud/Game/ClientState/JobGauge/JobGauges.cs b/Dalamud/Game/ClientState/JobGauge/JobGauges.cs index 8a0a84436..4afdd8130 100644 --- a/Dalamud/Game/ClientState/JobGauge/JobGauges.cs +++ b/Dalamud/Game/ClientState/JobGauge/JobGauges.cs @@ -14,7 +14,6 @@ namespace Dalamud.Game.ClientState.JobGauge; /// This class converts in-memory Job gauge data to structs. /// [PluginInterface] -[InterfaceVersion("1.0")] [ServiceManager.EarlyLoadedService] #pragma warning disable SA1015 [ResolveVia] diff --git a/Dalamud/Game/ClientState/Keys/KeyState.cs b/Dalamud/Game/ClientState/Keys/KeyState.cs index 73a3da376..7e4292598 100644 --- a/Dalamud/Game/ClientState/Keys/KeyState.cs +++ b/Dalamud/Game/ClientState/Keys/KeyState.cs @@ -23,7 +23,6 @@ namespace Dalamud.Game.ClientState.Keys; /// index & 3 = short key press (ephemeral). /// [PluginInterface] -[InterfaceVersion("1.0")] [ServiceManager.EarlyLoadedService] #pragma warning disable SA1015 [ResolveVia] diff --git a/Dalamud/Game/ClientState/Objects/ObjectTable.cs b/Dalamud/Game/ClientState/Objects/ObjectTable.cs index 30bfc5d6f..34ebc9de2 100644 --- a/Dalamud/Game/ClientState/Objects/ObjectTable.cs +++ b/Dalamud/Game/ClientState/Objects/ObjectTable.cs @@ -23,7 +23,6 @@ namespace Dalamud.Game.ClientState.Objects; /// This collection represents the currently spawned FFXIV game objects. /// [PluginInterface] -[InterfaceVersion("1.0")] [ServiceManager.EarlyLoadedService] #pragma warning disable SA1015 [ResolveVia] diff --git a/Dalamud/Game/ClientState/Objects/TargetManager.cs b/Dalamud/Game/ClientState/Objects/TargetManager.cs index 92aaabd75..2b892694e 100644 --- a/Dalamud/Game/ClientState/Objects/TargetManager.cs +++ b/Dalamud/Game/ClientState/Objects/TargetManager.cs @@ -10,7 +10,6 @@ namespace Dalamud.Game.ClientState.Objects; /// Get and set various kinds of targets for the player. /// [PluginInterface] -[InterfaceVersion("1.0")] [ServiceManager.EarlyLoadedService] #pragma warning disable SA1015 [ResolveVia] diff --git a/Dalamud/Game/ClientState/Party/PartyList.cs b/Dalamud/Game/ClientState/Party/PartyList.cs index 835a84865..d731667f0 100644 --- a/Dalamud/Game/ClientState/Party/PartyList.cs +++ b/Dalamud/Game/ClientState/Party/PartyList.cs @@ -15,7 +15,6 @@ namespace Dalamud.Game.ClientState.Party; /// This collection represents the actors present in your party or alliance. /// [PluginInterface] -[InterfaceVersion("1.0")] [ServiceManager.EarlyLoadedService] #pragma warning disable SA1015 [ResolveVia] diff --git a/Dalamud/Game/Command/CommandManager.cs b/Dalamud/Game/Command/CommandManager.cs index 10d27a527..72eae673f 100644 --- a/Dalamud/Game/Command/CommandManager.cs +++ b/Dalamud/Game/Command/CommandManager.cs @@ -18,7 +18,6 @@ namespace Dalamud.Game.Command; /// /// This class manages registered in-game slash commands. /// -[InterfaceVersion("1.0")] [ServiceManager.EarlyLoadedService] internal sealed class CommandManager : IInternalDisposableService, ICommandManager { @@ -176,7 +175,6 @@ internal sealed class CommandManager : IInternalDisposableService, ICommandManag /// Plugin-scoped version of a AddonLifecycle service. /// [PluginInterface] -[InterfaceVersion("1.0")] [ServiceManager.ScopedService] #pragma warning disable SA1015 [ResolveVia] diff --git a/Dalamud/Game/Config/GameConfig.cs b/Dalamud/Game/Config/GameConfig.cs index b45a1ee7b..1aeb42488 100644 --- a/Dalamud/Game/Config/GameConfig.cs +++ b/Dalamud/Game/Config/GameConfig.cs @@ -13,7 +13,6 @@ namespace Dalamud.Game.Config; /// /// This class represents the game's configuration. /// -[InterfaceVersion("1.0")] [ServiceManager.EarlyLoadedService] internal sealed class GameConfig : IInternalDisposableService, IGameConfig { @@ -243,7 +242,6 @@ internal sealed class GameConfig : IInternalDisposableService, IGameConfig /// Plugin-scoped version of a GameConfig service. /// [PluginInterface] -[InterfaceVersion("1.0")] [ServiceManager.ScopedService] #pragma warning disable SA1015 [ResolveVia] diff --git a/Dalamud/Game/DutyState/DutyState.cs b/Dalamud/Game/DutyState/DutyState.cs index 8dca5649e..3a3afbab0 100644 --- a/Dalamud/Game/DutyState/DutyState.cs +++ b/Dalamud/Game/DutyState/DutyState.cs @@ -11,7 +11,6 @@ namespace Dalamud.Game.DutyState; /// /// This class represents the state of the currently occupied duty. /// -[InterfaceVersion("1.0")] [ServiceManager.EarlyLoadedService] internal unsafe class DutyState : IInternalDisposableService, IDutyState { @@ -163,7 +162,6 @@ internal unsafe class DutyState : IInternalDisposableService, IDutyState /// Plugin scoped version of DutyState. /// [PluginInterface] -[InterfaceVersion("1.0")] [ServiceManager.ScopedService] #pragma warning disable SA1015 [ResolveVia] diff --git a/Dalamud/Game/Framework.cs b/Dalamud/Game/Framework.cs index 93c1c47ea..4f9c8d6c6 100644 --- a/Dalamud/Game/Framework.cs +++ b/Dalamud/Game/Framework.cs @@ -21,7 +21,6 @@ namespace Dalamud.Game; /// /// This class represents the Framework of the native game client and grants access to various subsystems. /// -[InterfaceVersion("1.0")] [ServiceManager.EarlyLoadedService] internal sealed class Framework : IInternalDisposableService, IFramework { @@ -513,7 +512,6 @@ internal sealed class Framework : IInternalDisposableService, IFramework /// Plugin-scoped version of a Framework service. /// [PluginInterface] -[InterfaceVersion("1.0")] [ServiceManager.ScopedService] #pragma warning disable SA1015 [ResolveVia] diff --git a/Dalamud/Game/GameLifecycle.cs b/Dalamud/Game/GameLifecycle.cs index eabb0f53b..0370e0a91 100644 --- a/Dalamud/Game/GameLifecycle.cs +++ b/Dalamud/Game/GameLifecycle.cs @@ -10,7 +10,6 @@ namespace Dalamud.Game; /// Class offering cancellation tokens for common gameplay events. /// [PluginInterface] -[InterfaceVersion("1.0")] [ServiceManager.EarlyLoadedService] #pragma warning disable SA1015 [ResolveVia] diff --git a/Dalamud/Game/Gui/ChatGui.cs b/Dalamud/Game/Gui/ChatGui.cs index abb8bb5c2..6779f32a8 100644 --- a/Dalamud/Game/Gui/ChatGui.cs +++ b/Dalamud/Game/Gui/ChatGui.cs @@ -22,7 +22,6 @@ namespace Dalamud.Game.Gui; /// /// This class handles interacting with the native chat UI. /// -[InterfaceVersion("1.0")] [ServiceManager.EarlyLoadedService] internal sealed unsafe class ChatGui : IInternalDisposableService, IChatGui { @@ -419,7 +418,6 @@ internal sealed unsafe class ChatGui : IInternalDisposableService, IChatGui /// Plugin scoped version of ChatGui. /// [PluginInterface] -[InterfaceVersion("1.0")] [ServiceManager.ScopedService] #pragma warning disable SA1015 [ResolveVia] diff --git a/Dalamud/Game/Gui/ContextMenu/ContextMenu.cs b/Dalamud/Game/Gui/ContextMenu/ContextMenu.cs index bc97d62f7..316c5c6b6 100644 --- a/Dalamud/Game/Gui/ContextMenu/ContextMenu.cs +++ b/Dalamud/Game/Gui/ContextMenu/ContextMenu.cs @@ -25,7 +25,6 @@ namespace Dalamud.Game.Gui.ContextMenu; /// /// This class handles interacting with the game's (right-click) context menu. /// -[InterfaceVersion("1.0")] [ServiceManager.EarlyLoadedService] internal sealed unsafe class ContextMenu : IInternalDisposableService, IContextMenu { @@ -497,7 +496,6 @@ original: /// Plugin-scoped version of a service. /// [PluginInterface] -[InterfaceVersion("1.0")] [ServiceManager.ScopedService] #pragma warning disable SA1015 [ResolveVia] diff --git a/Dalamud/Game/Gui/Dtr/DtrBar.cs b/Dalamud/Game/Gui/Dtr/DtrBar.cs index 894025bc1..1de6effab 100644 --- a/Dalamud/Game/Gui/Dtr/DtrBar.cs +++ b/Dalamud/Game/Gui/Dtr/DtrBar.cs @@ -21,7 +21,6 @@ namespace Dalamud.Game.Gui.Dtr; /// /// Class used to interface with the server info bar. /// -[InterfaceVersion("1.0")] [ServiceManager.EarlyLoadedService] internal sealed unsafe class DtrBar : IInternalDisposableService, IDtrBar { @@ -492,7 +491,7 @@ internal sealed unsafe class DtrBar : IInternalDisposableService, IDtrBar /// Plugin-scoped version of a AddonEventManager service. /// [PluginInterface] -[InterfaceVersion("1.0")] + [ServiceManager.ScopedService] #pragma warning disable SA1015 [ResolveVia] diff --git a/Dalamud/Game/Gui/FlyText/FlyTextGui.cs b/Dalamud/Game/Gui/FlyText/FlyTextGui.cs index 6a9fd007f..623bc51b3 100644 --- a/Dalamud/Game/Gui/FlyText/FlyTextGui.cs +++ b/Dalamud/Game/Gui/FlyText/FlyTextGui.cs @@ -15,7 +15,6 @@ namespace Dalamud.Game.Gui.FlyText; /// /// This class facilitates interacting with and creating native in-game "fly text". /// -[InterfaceVersion("1.0")] [ServiceManager.EarlyLoadedService] internal sealed class FlyTextGui : IInternalDisposableService, IFlyTextGui { @@ -273,7 +272,6 @@ internal sealed class FlyTextGui : IInternalDisposableService, IFlyTextGui /// Plugin scoped version of FlyTextGui. /// [PluginInterface] -[InterfaceVersion("1.0")] [ServiceManager.ScopedService] #pragma warning disable SA1015 [ResolveVia] diff --git a/Dalamud/Game/Gui/GameGui.cs b/Dalamud/Game/Gui/GameGui.cs index 88c8433a2..750ebcc46 100644 --- a/Dalamud/Game/Gui/GameGui.cs +++ b/Dalamud/Game/Gui/GameGui.cs @@ -26,7 +26,6 @@ namespace Dalamud.Game.Gui; /// /// A class handling many aspects of the in-game UI. /// -[InterfaceVersion("1.0")] [ServiceManager.EarlyLoadedService] internal sealed unsafe class GameGui : IInternalDisposableService, IGameGui { @@ -516,7 +515,6 @@ internal sealed unsafe class GameGui : IInternalDisposableService, IGameGui /// Plugin-scoped version of a AddonLifecycle service. /// [PluginInterface] -[InterfaceVersion("1.0")] [ServiceManager.ScopedService] #pragma warning disable SA1015 [ResolveVia] diff --git a/Dalamud/Game/Gui/PartyFinder/PartyFinderGui.cs b/Dalamud/Game/Gui/PartyFinder/PartyFinderGui.cs index fb89e5497..21520409e 100644 --- a/Dalamud/Game/Gui/PartyFinder/PartyFinderGui.cs +++ b/Dalamud/Game/Gui/PartyFinder/PartyFinderGui.cs @@ -14,7 +14,6 @@ namespace Dalamud.Game.Gui.PartyFinder; /// /// This class handles interacting with the native PartyFinder window. /// -[InterfaceVersion("1.0")] [ServiceManager.EarlyLoadedService] internal sealed class PartyFinderGui : IInternalDisposableService, IPartyFinderGui { @@ -127,7 +126,6 @@ internal sealed class PartyFinderGui : IInternalDisposableService, IPartyFinderG /// A scoped variant of the PartyFinderGui service. /// [PluginInterface] -[InterfaceVersion("1.0")] [ServiceManager.ScopedService] #pragma warning disable SA1015 [ResolveVia] diff --git a/Dalamud/Game/Gui/Toast/ToastGui.cs b/Dalamud/Game/Gui/Toast/ToastGui.cs index 057b929ad..0895d1b6b 100644 --- a/Dalamud/Game/Gui/Toast/ToastGui.cs +++ b/Dalamud/Game/Gui/Toast/ToastGui.cs @@ -12,7 +12,6 @@ namespace Dalamud.Game.Gui.Toast; /// /// This class facilitates interacting with and creating native toast windows. /// -[InterfaceVersion("1.0")] [ServiceManager.EarlyLoadedService] internal sealed partial class ToastGui : IInternalDisposableService, IToastGui { @@ -378,7 +377,6 @@ internal sealed partial class ToastGui /// Plugin scoped version of ToastGui. /// [PluginInterface] -[InterfaceVersion("1.0")] [ServiceManager.ScopedService] #pragma warning disable SA1015 [ResolveVia] diff --git a/Dalamud/Game/Inventory/GameInventory.cs b/Dalamud/Game/Inventory/GameInventory.cs index 985104450..0ddf0dcaf 100644 --- a/Dalamud/Game/Inventory/GameInventory.cs +++ b/Dalamud/Game/Inventory/GameInventory.cs @@ -17,7 +17,6 @@ namespace Dalamud.Game.Inventory; /// /// This class provides events for the players in-game inventory. /// -[InterfaceVersion("1.0")] [ServiceManager.EarlyLoadedService] internal class GameInventory : IInternalDisposableService { @@ -346,7 +345,6 @@ internal class GameInventory : IInternalDisposableService /// Plugin-scoped version of a GameInventory service. /// [PluginInterface] -[InterfaceVersion("1.0")] [ServiceManager.ScopedService] #pragma warning disable SA1015 [ResolveVia] diff --git a/Dalamud/Game/Network/GameNetwork.cs b/Dalamud/Game/Network/GameNetwork.cs index 1a96d8514..ad08f3684 100644 --- a/Dalamud/Game/Network/GameNetwork.cs +++ b/Dalamud/Game/Network/GameNetwork.cs @@ -13,7 +13,6 @@ namespace Dalamud.Game.Network; /// /// This class handles interacting with game network events. /// -[InterfaceVersion("1.0")] [ServiceManager.EarlyLoadedService] internal sealed class GameNetwork : IInternalDisposableService, IGameNetwork { @@ -140,7 +139,6 @@ internal sealed class GameNetwork : IInternalDisposableService, IGameNetwork /// Plugin-scoped version of a AddonLifecycle service. /// [PluginInterface] -[InterfaceVersion("1.0")] [ServiceManager.ScopedService] #pragma warning disable SA1015 [ResolveVia] diff --git a/Dalamud/Game/TargetSigScanner.cs b/Dalamud/Game/TargetSigScanner.cs index e169ea904..5c93fb4d4 100644 --- a/Dalamud/Game/TargetSigScanner.cs +++ b/Dalamud/Game/TargetSigScanner.cs @@ -10,7 +10,6 @@ namespace Dalamud.Game; /// A SigScanner facilitates searching for memory signatures in a given ProcessModule. /// [PluginInterface] -[InterfaceVersion("1.0")] [ServiceManager.ProvidedService] #pragma warning disable SA1015 [ResolveVia] diff --git a/Dalamud/Hooking/Internal/GameInteropProviderPluginScoped.cs b/Dalamud/Hooking/Internal/GameInteropProviderPluginScoped.cs index eb096a771..f7c4db00a 100644 --- a/Dalamud/Hooking/Internal/GameInteropProviderPluginScoped.cs +++ b/Dalamud/Hooking/Internal/GameInteropProviderPluginScoped.cs @@ -16,7 +16,6 @@ namespace Dalamud.Hooking.Internal; /// Plugin-scoped version of service used to create hooks. /// [PluginInterface] -[InterfaceVersion("1.0")] [ServiceManager.ScopedService] #pragma warning disable SA1015 [ResolveVia] diff --git a/Dalamud/Interface/ImGuiNotification/Internal/NotificationManager.cs b/Dalamud/Interface/ImGuiNotification/Internal/NotificationManager.cs index 06e3c5832..4157d1356 100644 --- a/Dalamud/Interface/ImGuiNotification/Internal/NotificationManager.cs +++ b/Dalamud/Interface/ImGuiNotification/Internal/NotificationManager.cs @@ -16,7 +16,6 @@ using ImGuiNET; namespace Dalamud.Interface.ImGuiNotification.Internal; /// Class handling notifications/toasts in ImGui. -[InterfaceVersion("1.0")] [ServiceManager.EarlyLoadedService] internal class NotificationManager : INotificationManager, IInternalDisposableService { @@ -123,7 +122,6 @@ internal class NotificationManager : INotificationManager, IInternalDisposableSe /// Plugin-scoped version of a service. [PluginInterface] -[InterfaceVersion("1.0")] [ServiceManager.ScopedService] #pragma warning disable SA1015 [ResolveVia] diff --git a/Dalamud/Interface/Textures/Internal/TextureManagerPluginScoped.cs b/Dalamud/Interface/Textures/Internal/TextureManagerPluginScoped.cs index 9e7544fa2..cab7cad19 100644 --- a/Dalamud/Interface/Textures/Internal/TextureManagerPluginScoped.cs +++ b/Dalamud/Interface/Textures/Internal/TextureManagerPluginScoped.cs @@ -21,7 +21,6 @@ namespace Dalamud.Interface.Textures.Internal; /// Plugin-scoped version of . [PluginInterface] -[InterfaceVersion("1.0")] [ServiceManager.ScopedService] #pragma warning disable SA1015 [ResolveVia] diff --git a/Dalamud/Interface/TitleScreenMenu/TitleScreenMenu.cs b/Dalamud/Interface/TitleScreenMenu/TitleScreenMenu.cs index 69dd7c2f5..1775ed9c3 100644 --- a/Dalamud/Interface/TitleScreenMenu/TitleScreenMenu.cs +++ b/Dalamud/Interface/TitleScreenMenu/TitleScreenMenu.cs @@ -14,7 +14,6 @@ namespace Dalamud.Interface; /// /// Class responsible for managing elements in the title screen menu. /// -[InterfaceVersion("1.0")] [ServiceManager.EarlyLoadedService] internal class TitleScreenMenu : IServiceType, ITitleScreenMenu { @@ -188,7 +187,6 @@ internal class TitleScreenMenu : IServiceType, ITitleScreenMenu /// Plugin-scoped version of a TitleScreenMenu service. /// [PluginInterface] -[InterfaceVersion("1.0")] [ServiceManager.ScopedService] #pragma warning disable SA1015 [ResolveVia] diff --git a/Dalamud/IoC/Internal/InterfaceVersionAttribute.cs b/Dalamud/IoC/Internal/InterfaceVersionAttribute.cs deleted file mode 100644 index 64870e724..000000000 --- a/Dalamud/IoC/Internal/InterfaceVersionAttribute.cs +++ /dev/null @@ -1,22 +0,0 @@ -namespace Dalamud.IoC.Internal; - -/// -/// This attribute represents the current version of a module that is loaded in the Service Locator. -/// -[AttributeUsage(AttributeTargets.Class | AttributeTargets.Interface)] -internal class InterfaceVersionAttribute : Attribute -{ - /// - /// Initializes a new instance of the class. - /// - /// The current version. - public InterfaceVersionAttribute(string version) - { - this.Version = new(version); - } - - /// - /// Gets the service version. - /// - public Version Version { get; } -} diff --git a/Dalamud/IoC/Internal/ObjectInstance.cs b/Dalamud/IoC/Internal/ObjectInstance.cs index f636c2243..3fd626a05 100644 --- a/Dalamud/IoC/Internal/ObjectInstance.cs +++ b/Dalamud/IoC/Internal/ObjectInstance.cs @@ -16,14 +16,8 @@ internal class ObjectInstance public ObjectInstance(Task instanceTask, Type type) { this.InstanceTask = instanceTask; - this.Version = type.GetCustomAttribute(); } - /// - /// Gets the current version of the instance, if it exists. - /// - public InterfaceVersionAttribute? Version { get; } - /// /// Gets a reference to the underlying instance. /// diff --git a/Dalamud/IoC/Internal/ServiceContainer.cs b/Dalamud/IoC/Internal/ServiceContainer.cs index 73b1c2667..493ac5942 100644 --- a/Dalamud/IoC/Internal/ServiceContainer.cs +++ b/Dalamud/IoC/Internal/ServiceContainer.cs @@ -95,31 +95,18 @@ internal class ServiceContainer : IServiceProvider, IServiceType } // validate dependency versions (if they exist) - var parameters = ctor.GetParameters().Select(p => - { - var parameterType = p.ParameterType; - var requiredVersion = p.GetCustomAttribute(typeof(RequiredVersionAttribute)) as RequiredVersionAttribute; - return (parameterType, requiredVersion); - }).ToList(); - - var versionCheck = parameters.All(p => CheckInterfaceVersion(p.requiredVersion, p.parameterType)); - - if (!versionCheck) - { - Log.Error("Failed to create {TypeName}, a RequestedVersion could not be satisfied", objectType.FullName!); - return null; - } + var parameterTypes = ctor.GetParameters().Select(p => p.ParameterType).ToList(); var resolvedParams = await Task.WhenAll( - parameters - .Select(async p => + parameterTypes + .Select(async type => { - var service = await this.GetService(p.parameterType, scopeImpl, scopedObjects); + var service = await this.GetService(type, scopeImpl, scopedObjects); if (service == null) { - Log.Error("Requested ctor service type {TypeName} was not available (null)", p.parameterType.FullName!); + Log.Error("Requested ctor service type {TypeName} was not available (null)", type.FullName!); } return service; @@ -160,31 +147,18 @@ internal class ServiceContainer : IServiceProvider, IServiceType var objectType = instance.GetType(); var props = objectType.GetProperties(BindingFlags.Static | BindingFlags.Instance | BindingFlags.Public | - BindingFlags.NonPublic).Where(x => x.GetCustomAttributes(typeof(PluginServiceAttribute)).Any()).Select( - propertyInfo => - { - var requiredVersion = propertyInfo.GetCustomAttribute(typeof(RequiredVersionAttribute)) as RequiredVersionAttribute; - return (propertyInfo, requiredVersion); - }).ToArray(); - - var versionCheck = props.All(x => CheckInterfaceVersion(x.requiredVersion, x.propertyInfo.PropertyType)); - - if (!versionCheck) - { - Log.Error("Failed to create {TypeName}, a RequestedVersion could not be satisfied", objectType.FullName!); - return false; - } + BindingFlags.NonPublic).Where(x => x.GetCustomAttributes(typeof(PluginServiceAttribute)).Any()).ToArray(); foreach (var prop in props) { - var service = await this.GetService(prop.propertyInfo.PropertyType, scopeImpl, publicScopes); + var service = await this.GetService(prop.PropertyType, scopeImpl, publicScopes); if (service == null) { - Log.Error("Requested service type {TypeName} was not available (null)", prop.propertyInfo.PropertyType.FullName!); + Log.Error("Requested service type {TypeName} was not available (null)", prop.PropertyType.FullName!); return false; } - prop.propertyInfo.SetValue(instance, service); + prop.SetValue(instance, service); } return true; @@ -199,29 +173,6 @@ internal class ServiceContainer : IServiceProvider, IServiceType /// object? IServiceProvider.GetService(Type serviceType) => this.GetSingletonService(serviceType); - private static bool CheckInterfaceVersion(RequiredVersionAttribute? requiredVersion, Type parameterType) - { - // if there's no required version, ignore it - if (requiredVersion == null) - return true; - - // if there's no requested version, ignore it - var declVersion = parameterType.GetCustomAttribute(); - if (declVersion == null) - return true; - - if (declVersion.Version == requiredVersion.Version) - return true; - - Log.Error( - "Requested version {ReqVersion} does not match the implemented version {ImplVersion} for param type {ParamType}", - requiredVersion.Version, - declVersion.Version, - parameterType.FullName!); - - return false; - } - private async Task GetService(Type serviceType, ServiceScopeImpl? scope, object[] scopedObjects) { if (this.interfaceToTypeMap.TryGetValue(serviceType, out var implementingType)) diff --git a/Dalamud/IoC/RequiredVersionAttribute.cs b/Dalamud/IoC/RequiredVersionAttribute.cs deleted file mode 100644 index b1b573b2a..000000000 --- a/Dalamud/IoC/RequiredVersionAttribute.cs +++ /dev/null @@ -1,22 +0,0 @@ -namespace Dalamud.IoC; - -/// -/// This attribute indicates the version of a service module that is required for the plugin to load. -/// -[AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Property)] -public class RequiredVersionAttribute : Attribute -{ - /// - /// Initializes a new instance of the class. - /// - /// The required version. - public RequiredVersionAttribute(string version) - { - this.Version = new(version); - } - - /// - /// Gets the required version. - /// - public Version Version { get; } -} diff --git a/Dalamud/Logging/ScopedPluginLogService.cs b/Dalamud/Logging/ScopedPluginLogService.cs index b7930fb58..54f231e0d 100644 --- a/Dalamud/Logging/ScopedPluginLogService.cs +++ b/Dalamud/Logging/ScopedPluginLogService.cs @@ -13,7 +13,6 @@ namespace Dalamud.Logging; /// Implementation of . /// [PluginInterface] -[InterfaceVersion("1.0")] [ServiceManager.ScopedService] #pragma warning disable SA1015 [ResolveVia] diff --git a/build/build.csproj.DotSettings b/build/build.csproj.DotSettings index 7bc28484c..337271da9 100644 --- a/build/build.csproj.DotSettings +++ b/build/build.csproj.DotSettings @@ -16,6 +16,8 @@ False <Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /> <Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /> + <Policy><Descriptor Staticness="Instance" AccessRightKinds="Private" Description="Instance fields (private)"><ElementKinds><Kind Name="FIELD" /><Kind Name="READONLY_FIELD" /></ElementKinds></Descriptor><Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /></Policy> + <Policy><Descriptor Staticness="Static" AccessRightKinds="Private" Description="Static fields (private)"><ElementKinds><Kind Name="FIELD" /></ElementKinds></Descriptor><Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /></Policy> True True True @@ -24,4 +26,5 @@ True True True - True + True + True