2021-04-28 17:38:36 +01:00
|
|
|
class MacroButton {
|
2022-10-27 21:20:03 +01:00
|
|
|
[int32]$index
|
|
|
|
|
2021-04-28 17:38:36 +01:00
|
|
|
# Constructor
|
2022-10-27 21:20:03 +01:00
|
|
|
MacroButton ([int]$index) {
|
|
|
|
$this.index = $index
|
|
|
|
}
|
|
|
|
|
|
|
|
[string] ToString() {
|
|
|
|
return $this.GetType().Name + $this.index
|
2021-04-28 17:38:36 +01:00
|
|
|
}
|
|
|
|
|
2022-10-27 21:20:03 +01:00
|
|
|
[int] Getter ($mode) {
|
|
|
|
return MB_Get -Id $this.index -Mode $mode
|
2021-04-28 17:38:36 +01:00
|
|
|
}
|
|
|
|
|
2022-10-27 21:20:03 +01:00
|
|
|
[void] Setter ($set, $mode) {
|
|
|
|
MB_Set -Id $this.index -SET $set -Mode $mode
|
2022-01-19 21:52:59 +00:00
|
|
|
}
|
|
|
|
|
2021-04-28 17:38:36 +01:00
|
|
|
hidden $_state = $($this | Add-Member ScriptProperty 'state' `
|
|
|
|
{
|
2022-12-16 17:27:58 +00:00
|
|
|
[bool]$this.Getter(1)
|
2022-10-27 21:20:03 +01:00
|
|
|
} `
|
2021-04-28 17:38:36 +01:00
|
|
|
{
|
2022-10-27 21:20:03 +01:00
|
|
|
param($arg)
|
2021-04-28 17:38:36 +01:00
|
|
|
$this._state = $this.Setter($arg, 1)
|
|
|
|
}
|
|
|
|
)
|
|
|
|
|
|
|
|
hidden $_stateonly = $($this | Add-Member ScriptProperty 'stateonly' `
|
|
|
|
{
|
2022-12-16 17:27:58 +00:00
|
|
|
[bool]$this.Getter(2)
|
2022-10-27 21:20:03 +01:00
|
|
|
} `
|
2021-04-28 17:38:36 +01:00
|
|
|
{
|
2022-10-27 21:20:03 +01:00
|
|
|
param($arg)
|
2021-04-28 17:38:36 +01:00
|
|
|
$this._stateonly = $this.Setter($arg, 2)
|
|
|
|
}
|
|
|
|
)
|
|
|
|
|
|
|
|
hidden $_trigger = $($this | Add-Member ScriptProperty 'trigger' `
|
|
|
|
{
|
2022-12-16 17:27:58 +00:00
|
|
|
[bool]$this.Getter(3)
|
2022-10-27 21:20:03 +01:00
|
|
|
} `
|
2021-04-28 17:38:36 +01:00
|
|
|
{
|
2022-10-27 21:20:03 +01:00
|
|
|
param($arg)
|
2021-04-28 17:38:36 +01:00
|
|
|
$this._trigger = $this.Setter($arg, 3)
|
|
|
|
}
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
2022-10-27 21:20:03 +01:00
|
|
|
function Make_Buttons {
|
2021-04-28 17:38:36 +01:00
|
|
|
[System.Collections.ArrayList]$button = @()
|
2022-03-09 17:41:47 +00:00
|
|
|
0..79 | ForEach-Object {
|
2021-04-28 17:38:36 +01:00
|
|
|
[void]$button.Add([MacroButton]::new($_))
|
|
|
|
}
|
|
|
|
$button
|
|
|
|
}
|