-
-
Save NEExploiT/c4c6850df807cf0b3000df35112f2819 to your computer and use it in GitHub Desktop.
SpoilerAL patch updater
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if ($PSVersionTable.PSVersion.Major -lt 5) { | |
Write-Output PowerShell 5.0未満では動きません | |
Write-Output http://aka.ms/wmf5download | |
Write-Output よりPowerShell 5をダウンロードしてください | |
Start-Process http://aka.ms/wmf5download | |
exit | |
} | |
if (Test-Path SpoilerAL -PathType Any) { | |
Write-Output SpoilerALフォルダ/ファイルがあるとうまく動かないので中断します | |
exit | |
} | |
if (Test-Path SpoilerAL.exe -PathType Leaf) { | |
$api_base = "https://dev.azure.com/SpoilerAL/b1994a7a-8882-40d3-bb41-8f34be1b434e/_apis/build/builds/" | |
$builds = Invoke-RestMethod ($api_base+"?definitionId=12") | |
$latest = $builds.value | Where-Object{ $_.result -eq "succeeded" } | Select-Object -First 1 | |
if ($latest) { | |
$commit = $latest.sourceVersion | |
$buildnumber = $latest.buildNumber | |
$branch = $latest.sourceBranch.Split("/")[-1] | |
$archive_name = "./Patch$($buildnumber)-$($branch)[$($commit.SubString(0,7))].zip" | |
if (!(Test-Path -LiteralPath $archive_name)) { | |
$artifact = Invoke-RestMethod ($api_base + $latest.id + "/artifacts") | |
Invoke-WebRequest -Uri $artifact.value.resource.downloadUrl -OutFile $commit | |
Move-Item $commit $archive_name | |
} | |
Expand-Archive -LiteralPath $archive_name -DestinationPath . | |
Move-Item SpoilerAL/winmm.dll . -Force | |
Get-Item winmm.dll | | |
ForEach-Object {Set-ItemProperty $_ -Name LastWriteTime -Value (($_.LastWriteTime)+([TimeZoneInfo]::Local.BaseUtcOffset))} | |
Remove-Item ./SpoilerAL -Recurse | |
Write-Output アップデート成功しました | |
} else { | |
Write-Output 成功したビルドが見つかりません | |
} | |
}else{ | |
Write-Output SpoilerAL.exeがあるフォルダで実行してください | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment