From 9cfc1cd804beede58a26acd1ae2542cc3b226ce0 Mon Sep 17 00:00:00 2001 From: LadyDefile <67084868+LadyDefile@users.noreply.github.com> Date: Mon, 7 Mar 2022 11:42:57 -0600 Subject: [PATCH 1/4] # WindowSystem.cs * Added a function "GetWindows()" that returns windows.ToArray() for collection access with encapsulation --- Dalamud/Interface/Windowing/WindowSystem.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Dalamud/Interface/Windowing/WindowSystem.cs b/Dalamud/Interface/Windowing/WindowSystem.cs index 0cb1a1514..21c94d2d4 100644 --- a/Dalamud/Interface/Windowing/WindowSystem.cs +++ b/Dalamud/Interface/Windowing/WindowSystem.cs @@ -91,6 +91,12 @@ namespace Dalamud.Interface.Windowing /// The object with matching name or null. public Window? GetWindow(string windowName) => this.windows.FirstOrDefault(w => w.WindowName == windowName); + /// + /// Returns an array of all currently registered windows. + /// + /// Returns window collection as a array. + public Window[] GetWindows() => this.windows.ToArray(); + /// /// Draw all registered windows using ImGui. /// From cbf9fbc8e22cb3946c59292bdf7296dfa3f9d7ee Mon Sep 17 00:00:00 2001 From: LadyDefile <67084868+LadyDefile@users.noreply.github.com> Date: Mon, 7 Mar 2022 16:06:13 -0600 Subject: [PATCH 2/4] # WindowSystem.cs * Changed GetWindows() return type from Window[] to IReadOnlyList --- Dalamud/Interface/Windowing/WindowSystem.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Dalamud/Interface/Windowing/WindowSystem.cs b/Dalamud/Interface/Windowing/WindowSystem.cs index 21c94d2d4..6a9f06589 100644 --- a/Dalamud/Interface/Windowing/WindowSystem.cs +++ b/Dalamud/Interface/Windowing/WindowSystem.cs @@ -92,10 +92,10 @@ namespace Dalamud.Interface.Windowing public Window? GetWindow(string windowName) => this.windows.FirstOrDefault(w => w.WindowName == windowName); /// - /// Returns an array of all currently registered windows. + /// Returns a read only list of all currently registered windows. /// /// Returns window collection as a array. - public Window[] GetWindows() => this.windows.ToArray(); + public IReadOnlyList GetWindows() => this.windows; /// /// Draw all registered windows using ImGui. From ee2aff9f0ac63d76acdbfaa662b5160e373e39b7 Mon Sep 17 00:00:00 2001 From: LadyDefile <67084868+LadyDefile@users.noreply.github.com> Date: Mon, 7 Mar 2022 16:09:52 -0600 Subject: [PATCH 3/4] # WindowSystem.cs * Updated function summary for GetWindows() --- Dalamud/Interface/Windowing/WindowSystem.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dalamud/Interface/Windowing/WindowSystem.cs b/Dalamud/Interface/Windowing/WindowSystem.cs index 6a9f06589..f9f894b47 100644 --- a/Dalamud/Interface/Windowing/WindowSystem.cs +++ b/Dalamud/Interface/Windowing/WindowSystem.cs @@ -94,7 +94,7 @@ namespace Dalamud.Interface.Windowing /// /// Returns a read only list of all currently registered windows. /// - /// Returns window collection as a array. + /// Returns a of the registered windows. public IReadOnlyList GetWindows() => this.windows; /// From 1c8dc0a2b5a5bb861e0907d2c5b8b4ebda54199b Mon Sep 17 00:00:00 2001 From: LadyDefile <67084868+LadyDefile@users.noreply.github.com> Date: Mon, 7 Mar 2022 16:16:18 -0600 Subject: [PATCH 4/4] Changes: # Dalamud.Interface.Windowing.WindowSystem * Turned GetWindows() function into Windows property. --- Dalamud/Interface/Windowing/WindowSystem.cs | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/Dalamud/Interface/Windowing/WindowSystem.cs b/Dalamud/Interface/Windowing/WindowSystem.cs index f9f894b47..61575f9db 100644 --- a/Dalamud/Interface/Windowing/WindowSystem.cs +++ b/Dalamud/Interface/Windowing/WindowSystem.cs @@ -16,6 +16,7 @@ namespace Dalamud.Interface.Windowing private static DateTimeOffset lastAnyFocus; private readonly List windows = new(); + public IReadOnlyList Windows => this.windows; private string lastFocusedWindowName = string.Empty; @@ -91,12 +92,6 @@ namespace Dalamud.Interface.Windowing /// The object with matching name or null. public Window? GetWindow(string windowName) => this.windows.FirstOrDefault(w => w.WindowName == windowName); - /// - /// Returns a read only list of all currently registered windows. - /// - /// Returns a of the registered windows. - public IReadOnlyList GetWindows() => this.windows; - /// /// Draw all registered windows using ImGui. ///