From 075a524c7d484ae705e8c5b812a0cb269f8f4e5f Mon Sep 17 00:00:00 2001
From: goat <16760685+goaaats@users.noreply.github.com>
Date: Wed, 11 Aug 2021 00:56:16 +0200
Subject: [PATCH] feat: add LogoutEventAgingStep.cs
---
.../AgingSteps/LoginEventAgingStep.cs | 12 ++---
.../AgingSteps/LogoutEventAgingStep.cs | 54 +++++++++++++++++++
2 files changed, 60 insertions(+), 6 deletions(-)
create mode 100644 Dalamud/Interface/Internal/Windows/SelfTest/AgingSteps/LogoutEventAgingStep.cs
diff --git a/Dalamud/Interface/Internal/Windows/SelfTest/AgingSteps/LoginEventAgingStep.cs b/Dalamud/Interface/Internal/Windows/SelfTest/AgingSteps/LoginEventAgingStep.cs
index 8a04febf9..27297083c 100644
--- a/Dalamud/Interface/Internal/Windows/SelfTest/AgingSteps/LoginEventAgingStep.cs
+++ b/Dalamud/Interface/Internal/Windows/SelfTest/AgingSteps/LoginEventAgingStep.cs
@@ -9,7 +9,7 @@ namespace Dalamud.Interface.Internal.Windows.SelfTest.AgingSteps
///
internal class LoginEventAgingStep : IAgingStep
{
- private bool isSubscribed = false;
+ private bool subscribed = false;
private bool hasPassed = false;
///
@@ -20,16 +20,16 @@ namespace Dalamud.Interface.Internal.Windows.SelfTest.AgingSteps
{
ImGui.Text("Log in now...");
- if (!this.isSubscribed)
+ if (!this.subscribed)
{
dalamud.ClientState.OnLogin += this.ClientStateOnOnLogin;
- this.isSubscribed = true;
+ this.subscribed = true;
}
if (this.hasPassed)
{
dalamud.ClientState.OnLogin -= this.ClientStateOnOnLogin;
- this.isSubscribed = false;
+ this.subscribed = false;
return SelfTestStepResult.Pass;
}
@@ -39,10 +39,10 @@ namespace Dalamud.Interface.Internal.Windows.SelfTest.AgingSteps
///
public void CleanUp(Dalamud dalamud)
{
- if (this.isSubscribed)
+ if (this.subscribed)
{
dalamud.ClientState.OnLogin -= this.ClientStateOnOnLogin;
- this.isSubscribed = false;
+ this.subscribed = false;
}
}
diff --git a/Dalamud/Interface/Internal/Windows/SelfTest/AgingSteps/LogoutEventAgingStep.cs b/Dalamud/Interface/Internal/Windows/SelfTest/AgingSteps/LogoutEventAgingStep.cs
new file mode 100644
index 000000000..0356c0dd2
--- /dev/null
+++ b/Dalamud/Interface/Internal/Windows/SelfTest/AgingSteps/LogoutEventAgingStep.cs
@@ -0,0 +1,54 @@
+using System;
+
+using ImGuiNET;
+
+namespace Dalamud.Interface.Internal.Windows.SelfTest.AgingSteps
+{
+ ///
+ /// Test setup for the login events.
+ ///
+ internal class LogoutEventAgingStep : IAgingStep
+ {
+ private bool subscribed = false;
+ private bool hasPassed = false;
+
+ ///
+ public string Name => "Test Log-In";
+
+ ///
+ public SelfTestStepResult RunStep(Dalamud dalamud)
+ {
+ ImGui.Text("Log out now...");
+
+ if (!this.subscribed)
+ {
+ dalamud.ClientState.OnLogout += this.ClientStateOnOnLogout;
+ this.subscribed = true;
+ }
+
+ if (this.hasPassed)
+ {
+ dalamud.ClientState.OnLogout -= this.ClientStateOnOnLogout;
+ this.subscribed = false;
+ return SelfTestStepResult.Pass;
+ }
+
+ return SelfTestStepResult.Waiting;
+ }
+
+ ///
+ public void CleanUp(Dalamud dalamud)
+ {
+ if (this.subscribed)
+ {
+ dalamud.ClientState.OnLogout -= this.ClientStateOnOnLogout;
+ this.subscribed = false;
+ }
+ }
+
+ private void ClientStateOnOnLogout(object sender, EventArgs e)
+ {
+ this.hasPassed = true;
+ }
+ }
+}