LLin icon indicating copy to clipboard operation
LLin copied to clipboard

[Feature Request] 游戏内更新

Open Cierra-Runis opened this issue 5 months ago • 1 comments

如题,在游戏内对 LLin 进行更新。

目前个人在用 PowerShell 脚本,在此给其他可能需要该功能的人提供参考:

$ErrorActionPreference = "Stop"

$repo = "MATRIX-feather/LLin"
$assetName = "Hikariii.WindowsDesktop.zip"
$versionFile = ".version"

if (Get-Command gh -ErrorAction SilentlyContinue) {
    Write-Host "📋 gh 命令已安装"
} else {
    Write-Error "💢 gh 命令未找到,请先安装 GitHub CLI"
    exit 1
}

if (Test-Path $versionFile) {
    $currentVersion = (Get-Content $versionFile -Raw).Trim()
} else {
    Write-Host "🤔 未找到 .version 文件,视为未安装"
    $currentVersion = ""
}

try {
    $latestVersion = gh release view -R $repo --json tagName --jq .tagName
} catch {
    Write-Error "💢 无法通过 gh 获取 release 信息:$_"
    exit 1
}

Write-Host "🌞 当前版本: $currentVersion"
Write-Host "🌞 最新版本: $latestVersion"

if ($currentVersion -eq $latestVersion) {
    Write-Host "💖 已是最新版本。"
    exit 0
}

$tempDir =  Join-Path $env:TEMP "llin_update" $latestVersion

Write-Host "📥 下载 $assetName..."
New-Item -ItemType Directory -Force -Path $tempDir | Out-Null
Push-Location $tempDir
gh release download $latestVersion -R $repo -p $assetName --skip-existing
Pop-Location

$zipPath = Join-Path $tempDir $assetName
$rulesetsPath = Join-Path $env:APPDATA "osu" "rulesets"
tar.exe -xf $zipPath -C $rulesetsPath

$latestVersion | Set-Content $versionFile

Write-Host "✅ 更新完成:$latestVersion"

Cierra-Runis avatar Jul 04 '25 11:07 Cierra-Runis

实现游戏内更新可能需要用到外部程序,所以目前暂时还没有计划...

MATRIX-feather avatar Jul 05 '25 04:07 MATRIX-feather