- up 1.1.90.859
 - improved algorithm for restoring files when refusing to re-block updates
This commit is contained in:
amd64fox
2022-07-21 20:13:39 +03:00
parent 51695f87d1
commit a32f1a89fe
2 changed files with 35 additions and 18 deletions
+18 -1
View File
@@ -325,6 +325,7 @@ catch {
$spotifyDirectory = "$env:APPDATA\Spotify"
$spotifyDirectory2 = "$env:LOCALAPPDATA\Spotify"
$spotifyExecutable = "$spotifyDirectory\Spotify.exe"
$exe_bak = "$spotifyDirectory\Spotify.bak"
$chrome_elf = "$spotifyDirectory\chrome_elf.dll"
$chrome_elf_bak = "$spotifyDirectory\chrome_elf_bak.dll"
$cache_folder = "$env:APPDATA\Spotify\cache"
@@ -361,6 +362,11 @@ function Check_verison_clients($param2) {
$check_offline = (Get-Item $spotifyExecutable).VersionInfo.FileVersion
return $check_offline
}
# Check version Spotify.bak
if ($param2 -eq "Spotify.bak") {
$check_offline_bak = (Get-Item $exe_bak).VersionInfo.FileVersion
return $check_offline_bak
}
}
function unlockFolder {
@@ -814,6 +820,16 @@ if (!($block_update_on) -and !($block_update_off)) {
}
if ($ch -eq 'y') { $block_update = $true }
if ($ch -eq 'n') {
$ErrorActionPreference = 'SilentlyContinue'
$exe_onl_fn = Check_verison_clients -param2 "offline"
$exe_bak_fn = Check_verison_clients -param2 'Spotify.bak'
if ((Test-Path -LiteralPath $exe_bak) -and $exe_onl_fn -eq $exe_bak_fn) {
Remove-Item $spotifyExecutable -Recurse -Force
Rename-Item $exe_bak $spotifyExecutable
}
}
$ch = $null
if ($cache_on) {
@@ -1460,7 +1476,6 @@ if ($block_update) {
if ($update_test_exe) {
$exe = "$env:APPDATA\Spotify\Spotify.exe"
$exe_bak = "$env:APPDATA\Spotify\Spotify.bak"
$ANSI = [Text.Encoding]::GetEncoding(1251)
$old = [IO.File]::ReadAllText($exe, $ANSI)
@@ -1468,6 +1483,8 @@ if ($block_update) {
Write-Host ($lang).UpdateBlocked`n
}
elseif ($old -match "(?<=wg:\/\/desktop-update\/.)2(\/update)") {
Remove-Item $exe_bak -Recurse -Force
Start-Sleep -Milliseconds 150
copy-Item $exe $exe_bak
$new = $old -replace "(?<=wg:\/\/desktop-update\/.)2(\/update)", '7/update'
[IO.File]::WriteAllText($exe, $new, $ANSI)