Compare commits
3 commits
6e0b5d97bd
...
96c6ba3d3c
Author | SHA1 | Date | |
---|---|---|---|
96c6ba3d3c | |||
7f8d160661 | |||
5ecb50f6a5 |
1 changed files with 20 additions and 20 deletions
40
revanced.ps1
40
revanced.ps1
|
@ -8,7 +8,15 @@ Add-type -AssemblyName System.Drawing
|
||||||
|
|
||||||
$ProgressPreference = 'SilentlyContinue'
|
$ProgressPreference = 'SilentlyContinue'
|
||||||
$ErrorActionPreference = 'Stop'
|
$ErrorActionPreference = 'Stop'
|
||||||
|
|
||||||
function execJava {
|
function execJava {
|
||||||
|
<#
|
||||||
|
.Description
|
||||||
|
execJava was created to additionally allow providing an array of strings to java arguments
|
||||||
|
if the first argument is a string array, it will launch with arguments in that array
|
||||||
|
otherwise it will launch with all provided arguments
|
||||||
|
#>
|
||||||
|
$SavedErrorActionPreference = $ErrorActionPreference
|
||||||
$ErrorActionPreference = 'Continue'
|
$ErrorActionPreference = 'Continue'
|
||||||
if ($args[0].getType().Name -ne "String") {
|
if ($args[0].getType().Name -ne "String") {
|
||||||
& $Java $args[0] 2>&1 | ForEach-Object{ "$_" }
|
& $Java $args[0] 2>&1 | ForEach-Object{ "$_" }
|
||||||
|
@ -16,7 +24,7 @@ function execJava {
|
||||||
else {
|
else {
|
||||||
& $Java $args 2>&1 | ForEach-Object{ "$_" }
|
& $Java $args 2>&1 | ForEach-Object{ "$_" }
|
||||||
}
|
}
|
||||||
$ErrorActionPreference = 'Stop'
|
$ErrorActionPreference = $SavedErrorActionPreference
|
||||||
}
|
}
|
||||||
|
|
||||||
function renderForm([String[]]$items, [String]$label, [String]$title, [System.Windows.Forms.SelectionMode]$mode, [System.Collections.ArrayList]$selected) {
|
function renderForm([String[]]$items, [String]$label, [String]$title, [System.Windows.Forms.SelectionMode]$mode, [System.Collections.ArrayList]$selected) {
|
||||||
|
@ -71,21 +79,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"
|
||||||
|
@ -136,6 +129,8 @@ function main {
|
||||||
|
|
||||||
New-Item -type Directory -Path ".\app" -ErrorAction SilentlyContinue | Out-Null
|
New-Item -type Directory -Path ".\app" -ErrorAction SilentlyContinue | Out-Null
|
||||||
|
|
||||||
|
# TODO: use where-object to search for filename
|
||||||
|
|
||||||
if ($install[0]) {
|
if ($install[0]) {
|
||||||
Write-Output "Downloading Patches ($($config.patches) -> $($patchesRelease.tag_name))"
|
Write-Output "Downloading Patches ($($config.patches) -> $($patchesRelease.tag_name))"
|
||||||
Write-Output "changelog: https://github.com/revanced/revanced-patches/compare/$($config.patches)...$($patchesRelease.tag_name)"
|
Write-Output "changelog: https://github.com/revanced/revanced-patches/compare/$($config.patches)...$($patchesRelease.tag_name)"
|
||||||
|
@ -174,9 +169,10 @@ function main {
|
||||||
elseif ($apks.getType().Name -eq 'String') {$selectedApk = $apks}
|
elseif ($apks.getType().Name -eq 'String') {$selectedApk = $apks}
|
||||||
else {
|
else {
|
||||||
$selectedApk = (renderForm -items $apks -label "Select apk file to patch" -title "Installer for ReVanced - apk selector" -mode One)
|
$selectedApk = (renderForm -items $apks -label "Select apk file to patch" -title "Installer for ReVanced - apk selector" -mode One)
|
||||||
if (-not $selectedApk) {throw "No apk selected!"}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (-not $selectedApk) {throw "No apk selected!"}
|
||||||
|
|
||||||
# Get available integrations
|
# Get available integrations
|
||||||
|
|
||||||
$integrationsList = New-Object System.Collections.ArrayList
|
$integrationsList = New-Object System.Collections.ArrayList
|
||||||
|
@ -229,10 +225,14 @@ 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) {
|
||||||
else {
|
$selectedDevice = ($devices | ForEach-Object {$_.split()[0]})[0]
|
||||||
$selectedDevice = (renderForm -items (splitArray -array $devices) -label "Select deployment target" -title "Installer for ReVanced - target" -mode One)
|
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
$selectedDevice = (renderForm -items ($devices | ForEach-Object {$_.split()[0]}) -label "Select deployment target" -title "Installer for ReVanced - target" -mode One)
|
||||||
|
}
|
||||||
|
|
||||||
|
if (-not $selectedDevice) {throw "No device selected"}
|
||||||
|
|
||||||
# install to device
|
# install to device
|
||||||
|
|
||||||
|
|
Reference in a new issue