Remove splitarray

This commit is contained in:
Wroclaw 2022-07-19 18:01:45 +02:00
parent 6e0b5d97bd
commit 5ecb50f6a5

View file

@ -71,21 +71,6 @@ function renderForm([String[]]$items, [String]$label, [String]$title, [System.Wi
return $false return $false
} }
function splitArray([String[]]$array, $splitter = $null, [int]$row = 0) {
$returnVal = New-Object System.Collections.ArrayList
if ($null -eq $splitter) {
foreach ($i in $array) {
$returnVal.Add(@($i.Split()[$row])) | Out-Null
}
}
else {
foreach ($i in $array) {
$returnVal.Add(@($i.Split($splitter)[$row])) | Out-Null
}
}
return $returnVal
}
class config { class config {
[String]$patches = "none" [String]$patches = "none"
[String]$integrations = "none" [String]$integrations = "none"
@ -229,9 +214,11 @@ function main {
[String]$selectedDevice = '' [String]$selectedDevice = ''
if ($devices.Length -eq 0) {throw "No devices found"} if ($devices.Length -eq 0) {throw "No devices found"}
elseif ($devices.Length -eq 1) {$selectedDevice = (splitArray -array $devices)[0]} elseif ($devices.Length -eq 1) {
$selectedDevice = ($devices | ForEach-Object {$_.split()[0]})[0]
}
else { else {
$selectedDevice = (renderForm -items (splitArray -array $devices) -label "Select deployment target" -title "Installer for ReVanced - target" -mode One) $selectedDevice = (renderForm -items ($devices | ForEach-Object {$_.split()[0]}) -label "Select deployment target" -title "Installer for ReVanced - target" -mode One)
} }
# install to device # install to device