# 使用Powershell输入指令 irm https://act.xiaoheicat.com | iex 来使用脚本
$Title = "欢迎使用激活脚本"

$choices = @{
    "1" = @{ name = "激活Windows或Office(MAS)"; url = "https://get.activated.win/" }
    "2" = @{ name = "激活JetBrain全系列"; url = "https://ckey.run/" }
    "3" = @{ name = "安装并破解Spotify"; url = "https://spotx-official.github.io/SpotX/run.ps1" }
    "4" = @{ name = "激活Adobe全系列(GenP)"; url = "https://down.xiaoheicat.com/GenP-v3.6.9.exe" }
    "5" = @{ name = "激活AutoDesk全系列"; url = "https://down.xiaoheicat.com/AutoDesk.exe" }
    "6" = @{ name = "破解WeMod修改器会员"; url = "https://down.xiaoheicat.com/WeMod-V25.6.22.exe" }
}


Write-Host ""
Write-Host $Title -ForegroundColor Cyan
Write-Host ""

foreach ($key in $choices.Keys | Sort-Object) {
    Write-Host "$key. $($choices[$key].name)"
}


Write-Host ""
$choice = Read-Host "请输入选项编号"

if (-not $choices.ContainsKey($choice)) {
    Write-Host "`n无效的选项,请重新运行脚本。" -ForegroundColor Red
    exit
}


$url = $choices[$choice].url
$name = $choices[$choice].name
$ext = [System.IO.Path]::GetExtension($url).ToLower()
Write-Host "`n正在执行 $name ...`n" -ForegroundColor Yellow

try {
    switch ($true) {
        { $ext -eq "" -or $ext -eq ".ps1" } {
            Write-Host "脚本初始化..." -ForegroundColor Cyan
            irm $url | iex
        }


        default {
            $tempFile = Join-Path $env:TEMP ([System.IO.Path]::GetFileName($url))
            if (-not $tempFile -or $tempFile -eq "") {
                $tempFile = Join-Path $env:TEMP ("download_" + (Get-Random) + ".tmp")
            }

            Write-Host "正在下载激活程序到: $tempFile" -ForegroundColor Cyan
            Invoke-WebRequest -Uri $url -OutFile $tempFile -UseBasicParsing

            Write-Host "正在打开..." -ForegroundColor Green
            Start-Process $tempFile
        }
    }
}
catch {
    Write-Host "`n执行失败: $($_.Exception.Message)" -ForegroundColor Red
}