From 2bfa6e55dbb8054c0a6baadcf4bf353a2ca81d69 Mon Sep 17 00:00:00 2001 From: Julien Maille Date: Mon, 13 Dec 2021 16:57:12 +0100 Subject: [PATCH] IMP: patch-dark-mode.ps1 --- patch-dark-mode.ps1 | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/patch-dark-mode.ps1 b/patch-dark-mode.ps1 index 66c3a4b..65d3c0b 100644 --- a/patch-dark-mode.ps1 +++ b/patch-dark-mode.ps1 @@ -7,7 +7,13 @@ Copy-Item $sp ($sp + ".backup") $bytes = [System.IO.File]::ReadAllBytes($sp); $toRemove = [System.Text.Encoding]::UTF8.GetBytes("force-dark-mode"); +$sw = [System.Diagnostics.Stopwatch]::StartNew() for ($i = 0; $i -lt $bytes.Length; $i++) { + if ($sw.Elapsed.TotalMilliseconds -ge 1000) { + Write-Progress -Activity "Eanbling dark mode in Spotify.exe" -status "Patching binary file $i" -percentComplete ($i / $bytes.Length*100); + $sw.Reset(); + $sw.Start(); + } $found = $true for ($j = 0; $j -lt $toRemove.Length; $j++) { if ($bytes[$i + $j] -ne $toRemove[$j]) { @@ -25,3 +31,8 @@ for ($i = 0; $i -lt $bytes.Length; $i++) { } [System.IO.File]::WriteAllBytes($sp, $bytes); +if ( $found ) { + Write-Host "The patch is complete." -ForegroundColor "Green" +} else { + Write-Host "Failed to patch the file." -ForegroundColor "Red" +}