From 83d7972a98e3b35a5dc78cf4d5f47dd0a631538f Mon Sep 17 00:00:00 2001 From: amd64fox Date: Mon, 16 May 2022 17:05:08 +0300 Subject: [PATCH] Update - Backup and restore for Spotify.exe - Removing legacy code --- Install.ps1 | 4 +++- Install_Rus.ps1 | 4 +++- Uninstall.bat | 20 +++++--------------- 3 files changed, 11 insertions(+), 17 deletions(-) diff --git a/Install.ps1 b/Install.ps1 index 1de4d87..4e6b687 100644 --- a/Install.ps1 +++ b/Install.ps1 @@ -641,10 +641,12 @@ $update_test_exe = Test-Path -Path $spotifyExecutable if ($block_update) { if ($update_test_exe) { - $exe = "$env:APPDATA\Spotify\spotify.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) if ($old -match "(?<=wg:\/\/desktop-update\/.)2(\/update)") { + copy-Item $exe $exe_bak $new = $old -replace "(?<=wg:\/\/desktop-update\/.)2(\/update)", '7/update' [IO.File]::WriteAllText($exe, $new, $ANSI) } diff --git a/Install_Rus.ps1 b/Install_Rus.ps1 index 96d18e8..99ebe41 100644 --- a/Install_Rus.ps1 +++ b/Install_Rus.ps1 @@ -798,10 +798,12 @@ $update_test_exe = Test-Path -Path $spotifyExecutable if ($block_update) { if ($update_test_exe) { - $exe = "$env:APPDATA\Spotify\spotify.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) if ($old -match "(?<=wg:\/\/desktop-update\/.)2(\/update)") { + copy-Item $exe $exe_bak $new = $old -replace "(?<=wg:\/\/desktop-update\/.)2(\/update)", '7/update' [IO.File]::WriteAllText($exe, $new, $ANSI) } diff --git a/Uninstall.bat b/Uninstall.bat index 93b3851..d286c29 100644 --- a/Uninstall.bat +++ b/Uninstall.bat @@ -11,6 +11,11 @@ if exist "%Appdata%\Spotify\chrome_elf_bak.dll" ( move "%Appdata%\Spotify\chrome_elf_bak.dll" "%Appdata%\Spotify\chrome_elf.dll" > NUL 2>&1 ) +if exist "%Appdata%\Spotify\Spotify.bak" ( + del /s /q "%Appdata%\Spotify.exe" > NUL 2>&1 + move "%Appdata%\Spotify\Spotify.bak" "%Appdata%\Spotify\Spotify.exe" > NUL 2>&1 +) + if exist "%Appdata%\Spotify\config.ini" ( del /s /q "%Appdata%\Spotify\config.ini" > NUL 2>&1 @@ -33,21 +38,6 @@ if exist "%Appdata%\Spotify\blockthespot_log.txt" ( del /s /q "%Appdata%\Spotify\blockthespot_log.txt" > NUL 2>&1 ) - -if exist "%localappdata%\Spotify\Update" ( - del /A:sr %localappdata%\Spotify\Update > NUL 2>&1 -) - - -if exist "%Appdata%\Spotify\SpotifyMigrator.bak" ( - rename %Appdata%\Spotify\SpotifyMigrator.bak SpotifyMigrator.exe > NUL 2>&1 -) -if exist "%Appdata%\Spotify\SpotifyMigrator.exe" ( -if exist "%Appdata%\Spotify\SpotifyMigrator.bak" ( - del /f /s /q %Appdata%\Spotify\SpotifyMigrator.bak > NUL 2>&1 -) -) - if exist "%Appdata%\Spotify\cache" ( rd /s /q %Appdata%\Spotify\cache > NUL 2>&1