Files
CreamInstaller/Hashing/GetHashes.ps1
T
Soul Shard c8a65f35bf Update to latest util versions, restore SmokeAPI
Utilities have been updated to the latest versions. The ability to use SmokeAPI instead of CreamAPI has been restored, and a checkbox has been added to switch between them.
2025-10-01 06:07:54 +07:00

44 lines
1.8 KiB
PowerShell

$Array32 = [System.Text.StringBuilder]::new().AppendLine('[')
$Array64 = [System.Text.StringBuilder]::new().AppendLine('[')
function Write-Hash([System.IO.FileInfo] $File, [string] $Version) {
$Hash = (Get-FileHash $File -Algorithm MD5).Hash
$Value = "`t`"$Hash`", // CreamAPI $Version"
$Value = "`t`"$Hash`", // SmokeAPI $Version"
if ($File.Name.Contains('64')) {
$Array64.AppendLine($Value) | Out-Null
} else {
$Array32.AppendLine($Value) | Out-Null
}
}
Get-ChildItem | ForEach-Object {
if ($_.GetType().Name -eq 'DirectoryInfo') {
$VersionIndex = $_.Name.IndexOf('v')
if ($VersionIndex -eq -1) { Return }
$Release = $_.Name.Substring($VersionIndex).Replace('_', ' ')
Get-ChildItem $_ | ForEach-Object {
if ($_.GetType().Name -eq 'DirectoryInfo') {
$Build = $_.Name -eq 'log_build' ? 'Log build' : 'Non-log build'
Get-ChildItem $_ | ForEach-Object {
if ($_.GetType().Name -eq 'DirectoryInfo') {
Get-ChildItem $_ | ForEach-Object {
if ($_.Extension -eq '.dll') {
Write-Hash $_ "$Release $Build"
}
}
} elseif ($_.Extension -eq '.dll') {
Write-Hash $_ "$Release $Build"
}
}
}
elseif ($_.Extension -eq '.dll') {
Write-Hash $_ "$Release"
}
}
}
}
$Array32.Append(']') | Out-Null
$Array64.Append(']') | Out-Null
Write-Host "32-bit: $($Array32.ToString())"
Write-Host "64-bit: $($Array64.ToString())"
Write-Host 'Press enter to exit . . . ' -NoNewline
$Host.UI.ReadLine() | Out-Null