mirror of
https://github.com/danbulant/dribbblish-dynamic-theme
synced 2026-06-19 06:31:09 +00:00
Merge branch 'main' of https://github.com/JulienMaille/dribbblish-dynamic-theme
This commit is contained in:
commit
1b45d68568
1 changed files with 15 additions and 1 deletions
|
|
@ -1,10 +1,19 @@
|
|||
Get-Process -Name Spotify -ErrorAction SilentlyContinue | Stop-Process -Force
|
||||
Get-Process -Name SpotifyWebHelper -ErrorAction SilentlyContinue | Stop-Process -Force
|
||||
|
||||
$sp = "$env:APPDATA\Spotify\Spotify.exe"
|
||||
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]) {
|
||||
|
|
@ -21,4 +30,9 @@ for ($i = 0; $i -lt $bytes.Length; $i++) {
|
|||
}
|
||||
}
|
||||
|
||||
[System.IO.File]::WriteAllBytes($sp, $bytes);
|
||||
[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"
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue