# 此脚本由 https://get.vst76.cn 托管。 # 完整汉化项目:https://github.com/SHAONIAN697/mas-cn $ErrorActionPreference = 'Stop' & { $downloadUrl = 'https://raw.githubusercontent.com/SHAONIAN697/mas-cn/8245ea253ef8b0eea89155e7a158f1c2d96ab9d9/MAS/MAS_AIO_CN_v3.12.cmd' $expectedHash = '540BE750C4ED800F30EA0556958C981C69E2ED0EED0DA4DFB78417A894ED024B' try { [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 } catch {} Write-Progress -Activity '正在下载 MAS v3.12 完整中文版' -Status '请稍候' try { $client = New-Object Net.WebClient $bytes = $client.DownloadData($downloadUrl) } catch { Write-Progress -Activity '正在下载 MAS v3.12 完整中文版' -Completed Write-Host "下载失败:$($_.Exception.Message)" -ForegroundColor Red Write-Host '请检查网络连接或访问 https://github.com/SHAONIAN697/mas-cn' -ForegroundColor Yellow return } Write-Progress -Activity '正在下载 MAS v3.12 完整中文版' -Completed $sha256 = [Security.Cryptography.SHA256]::Create() try { $actualHash = [BitConverter]::ToString($sha256.ComputeHash($bytes)).Replace('-', '') } finally { $sha256.Dispose() } if ($actualHash -ne $expectedHash) { Write-Host '文件完整性校验失败,已停止运行。' -ForegroundColor Red Write-Host "预期哈希:$expectedHash" Write-Host "实际哈希:$actualHash" return } $rand = [Guid]::NewGuid().Guid $isAdmin = [bool]([Security.Principal.WindowsIdentity]::GetCurrent().Groups -match 'S-1-5-32-544') $filePath = if ($isAdmin) { "$env:SystemRoot\Temp\MAS_CN_$rand.cmd" } else { "$env:LOCALAPPDATA\Temp\MAS_CN_$rand.cmd" } try { [IO.File]::WriteAllBytes($filePath, $bytes) $env:ComSpec = "$env:SystemRoot\System32\cmd.exe" Start-Process -FilePath $env:ComSpec -ArgumentList "/c """"$filePath"" -el $args""" -Wait -Verb RunAs } finally { if (Test-Path $filePath) { Remove-Item -LiteralPath $filePath -Force -ErrorAction SilentlyContinue } } } @args