Files
DSP_Mods/LiveStreamAssist/tools/ReflectionReaderCheck/Copy-GameFacades.ps1
T
soarqin e95c832e03 fix(livestreamassist): migrate WebSocket API to Kestrel
Replace Fleck with pinned in-process Kestrel packages and explicit runtime packaging. Fix connection lifetimes, deadlines, admission accounting, and reflection validation.

Add production transport regressions and update the migration guidance with remaining Unity/LAN acceptance gates.
2026-09-17 20:53:05 +08:00

45 lines
1.8 KiB
PowerShell

param(
[Parameter(Mandatory)]
[string] $TargetDir
)
Set-StrictMode -Version Latest
$ErrorActionPreference = 'Stop'
$TargetDir = $TargetDir.Trim().Trim('"').TrimEnd('\', '/')
$steamPath = $null
foreach ($regPath in @(
'HKCU:\Software\Valve\Steam',
'HKLM:\Software\Valve\Steam',
'HKLM:\Software\Wow6432Node\Valve\Steam'
)) {
try {
$val = (Get-ItemProperty -LiteralPath $regPath -Name SteamPath -ErrorAction Stop).SteamPath
if ($val -and (Test-Path $val)) { $steamPath = $val; break }
} catch { }
}
if (-not $steamPath) { throw 'Steam installation not found; cannot copy game facades for ReflectionReaderCheck.' }
$vdfPath = Join-Path $steamPath 'steamapps\libraryfolders.vdf'
$vdfContent = Get-Content $vdfPath -Raw -Encoding UTF8
$blockPattern = '"(?:\d+)"\s*\{([^{}]*(?:\{[^{}]*\}[^{}]*)*)\}'
$managed = $null
foreach ($block in [regex]::Matches($vdfContent, $blockPattern, 'Singleline')) {
$text = $block.Groups[1].Value
if ($text -notmatch '"1366540"\s+"[^"]+"') { continue }
$pathMatch = [regex]::Match($text, '"path"\s+"([^"]+)"')
if (-not $pathMatch.Success) { continue }
$libPath = $pathMatch.Groups[1].Value -replace '\\\\', '\' -replace '/', '\'
$candidate = Join-Path $libPath 'steamapps\common\Dyson Sphere Program\DSPGAME_Data\Managed'
if (Test-Path $candidate) { $managed = $candidate; break }
}
if (-not $managed) { throw 'DSP Managed directory not found; cannot copy game facades for ReflectionReaderCheck.' }
foreach ($name in @('netstandard.dll', 'UnityEngine.dll', 'UnityEngine.CoreModule.dll', 'UnityEngine.SharedInternalsModule.dll')) {
$src = Join-Path $managed $name
if (-not (Test-Path $src)) { throw "Missing $src" }
Copy-Item -LiteralPath $src -Destination (Join-Path $TargetDir $name) -Force
}