tools: open real offline frmP2PChat window
This commit is contained in:
49
scripts/test-open-offline-real-frmP2PChat-contract.ps1
Normal file
49
scripts/test-open-offline-real-frmP2PChat-contract.ps1
Normal file
@@ -0,0 +1,49 @@
|
||||
param(
|
||||
[string]$ScriptPath = "scripts/open-offline-real-frmP2PChat.ps1"
|
||||
)
|
||||
|
||||
$ErrorActionPreference = "Stop"
|
||||
$repo = Resolve-Path -LiteralPath (Join-Path $PSScriptRoot "..")
|
||||
$target = if ([System.IO.Path]::IsPathRooted($ScriptPath)) {
|
||||
$ScriptPath
|
||||
}
|
||||
else {
|
||||
Join-Path $repo $ScriptPath
|
||||
}
|
||||
|
||||
if (-not (Test-Path -LiteralPath $target)) {
|
||||
throw "script not found: $target"
|
||||
}
|
||||
|
||||
$text = Get-Content -LiteralPath $target -Raw
|
||||
$requiredPatterns = @(
|
||||
@{ Name = "x86 PowerShell guard"; Pattern = "Environment]::Is64BitProcess" },
|
||||
@{ Name = "AssemblyResolve dependency loader"; Pattern = "AssemblyResolve" },
|
||||
@{ Name = "fake runtime mode parameter"; Pattern = "RuntimeMode" },
|
||||
@{ Name = "self chat variant"; Pattern = "SelfChat" },
|
||||
@{ Name = "skip roster variant"; Pattern = "SkipRosterManager" },
|
||||
@{ Name = "CLR IL offset extraction"; Pattern = "GetILOffset" },
|
||||
@{ Name = "IL offset JSON field"; Pattern = "il_offset_hex" },
|
||||
@{ Name = "Config.BaseConfig fake runtime"; Pattern = "<BaseConfig>k__BackingField" },
|
||||
@{ Name = "remote control config key"; Pattern = "Remote_Control_Visible" },
|
||||
@{ Name = "fake frmMain activation target"; Pattern = "<frmMain>k__BackingField" },
|
||||
@{ Name = "UserInfo cache warmup"; Pattern = "UserInfoCache" },
|
||||
@{ Name = "result artifact output"; Pattern = "real-frmP2PChat-result" }
|
||||
)
|
||||
|
||||
$missing = @()
|
||||
foreach ($item in $requiredPatterns) {
|
||||
if ($text -notmatch $item.Pattern) {
|
||||
$missing += $item.Name
|
||||
}
|
||||
}
|
||||
|
||||
if ($missing.Count -gt 0) {
|
||||
throw "contract missing: $($missing -join ', ')"
|
||||
}
|
||||
|
||||
[pscustomobject]@{
|
||||
ok = $true
|
||||
script = $target
|
||||
checked = $requiredPatterns.Count
|
||||
} | ConvertTo-Json -Compress
|
||||
Reference in New Issue
Block a user