From 150301c2710d36768edaa309923f9ecac14c1872 Mon Sep 17 00:00:00 2001 From: onyx-and-iris Date: Sun, 18 Dec 2022 16:48:28 +0000 Subject: [PATCH] add Login() to Remote class. method chain it in factory functions. --- lib/Voicemeeter.psm1 | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/lib/Voicemeeter.psm1 b/lib/Voicemeeter.psm1 index a669d79..bc8009f 100644 --- a/lib/Voicemeeter.psm1 +++ b/lib/Voicemeeter.psm1 @@ -11,13 +11,17 @@ class Remote { } $this.kind = GetKind($kindId) $this.profiles = Get_Profiles($this.kind.name) - Login -KIND $this.kind.name } [string] ToString() { return "Voicemeeter " + $this.kind.name.substring(0, 1).toupper() + $this.kind.name.substring(1) } + [Remote] Login() { + Login -kindId $this.kind.name + return $this + } + [void] Logout() { Logout } @@ -112,15 +116,15 @@ class RemotePotato : Remote { } Function Get-RemoteBasic { - [RemoteBasic]::new() + [RemoteBasic]::new().Login() } Function Get-RemoteBanana { - [RemoteBanana]::new() + [RemoteBanana]::new().Login() } Function Get-RemotePotato { - [RemotePotato]::new() + [RemotePotato]::new().Login() } Function Connect-Voicemeeter {