From 2775d64e47334f17948e25bbff65ece666192f89 Mon Sep 17 00:00:00 2001 From: onyx-and-iris <75868496+onyx-and-iris@users.noreply.github.com> Date: Sat, 8 Jan 2022 20:30:36 +0000 Subject: [PATCH] update meta.ps1 rename $this to $obj to avoid saving over keyword. --- lib/base.ps1 | 3 --- lib/meta.ps1 | 12 ++++++------ lib/vban.ps1 | 6 ++---- 3 files changed, 8 insertions(+), 13 deletions(-) diff --git a/lib/base.ps1 b/lib/base.ps1 index 2ec19d1..e2c5ea9 100644 --- a/lib/base.ps1 +++ b/lib/base.ps1 @@ -26,9 +26,6 @@ Function Setup_DLL { return $false } - - - $Signature = @" [DllImport(@"$dll")] public static extern int VBVMR_Login(); diff --git a/lib/meta.ps1 b/lib/meta.ps1 index ecf2e31..b43a9dc 100644 --- a/lib/meta.ps1 +++ b/lib/meta.ps1 @@ -1,6 +1,6 @@ -Function AddPublicMembers($this) { +Function AddPublicMembers($obj) { [HashTable]$Signatures = @{} - ForEach($param in $this.bool_params) { + ForEach($param in $obj.bool_params) { # Define getter $Signatures["Getter"] = "`$this.Getter(`$this.cmd('{0}'))" -f $param # Define setter @@ -10,7 +10,7 @@ Function AddPublicMembers($this) { Addmember } - ForEach($param in $this.float_params) { + ForEach($param in $obj.float_params) { # Define getter $Signatures["Getter"] = "[math]::Round(`$this.Getter(`$this.cmd('{0}')), 1)" -f $param # Define setter @@ -20,7 +20,7 @@ Function AddPublicMembers($this) { Addmember } - ForEach($param in $this.int_params) { + ForEach($param in $obj.int_params) { # Define getter $Signatures["Getter"] = "[Int]`$this.Getter(`$this.cmd('{0}'))" -f $param # Define setter @@ -30,7 +30,7 @@ Function AddPublicMembers($this) { Addmember } - ForEach($param in $this.string_params) { + ForEach($param in $obj.string_params) { # Define getter $Signatures["Getter"] = "[String]`$this.Getter_String(`$this.cmd('{0}'))" -f $param # Define setter @@ -48,5 +48,5 @@ Function Addmember{ Value = [ScriptBlock]::Create($Signatures["Getter"]) SecondValue = [ScriptBlock]::Create($Signatures["Setter"]) } - $this | Add-Member @AddMemberParams + $obj | Add-Member @AddMemberParams } diff --git a/lib/vban.ps1 b/lib/vban.ps1 index 2257b1b..90004db 100644 --- a/lib/vban.ps1 +++ b/lib/vban.ps1 @@ -171,8 +171,7 @@ class Vban { class VbanInstream : Vban { # Constructor - VbanInstream ([int]$id) : base ($id) - { + VbanInstream ([int]$id) : base ($id){ $this.direction = "in" } } @@ -180,8 +179,7 @@ class VbanInstream : Vban { class VbanOutstream : Vban { # Constructor - VbanOutstream ([int]$id) : base ($id) - { + VbanOutstream ([int]$id) : base ($id){ $this.direction = "out" } }