From 5ecb50f6a5c39a020f10c9bcc9afc5f88b488835 Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Tue, 19 Jul 2022 18:01:45 +0200 Subject: [PATCH] Remove splitarray --- revanced.ps1 | 21 ++++----------------- 1 file changed, 4 insertions(+), 17 deletions(-) diff --git a/revanced.ps1 b/revanced.ps1 index b32f276..d860e98 100644 --- a/revanced.ps1 +++ b/revanced.ps1 @@ -71,21 +71,6 @@ function renderForm([String[]]$items, [String]$label, [String]$title, [System.Wi 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 { [String]$patches = "none" [String]$integrations = "none" @@ -229,9 +214,11 @@ function main { [String]$selectedDevice = '' 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 { - $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