TellmePdmsPluging/inspect.ps1

24 lines
1.3 KiB
PowerShell

[System.Reflection.Assembly]::LoadFrom('C:/Users/sladr/source/repos/TellmePdmsPluging/bin/Debug/Aveva.ApplicationFramework.Presentation.dll') | Out-Null
[System.Reflection.Assembly]::LoadFrom('C:/Users/sladr/source/repos/TellmePdmsPluging/bin/Debug/Aveva.ApplicationFramework.dll') | Out-Null
$assemblies = [System.AppDomain]::CurrentDomain.GetAssemblies()
$allTypes = $assemblies | ForEach-Object { try { $_.GetTypes() } catch { @() } }
# 找所有 Command 子类
$cmdType = $allTypes | Where-Object { $_.Name -eq 'Command' -and $_.Namespace -like '*Aveva*' } | Select-Object -First 1
$subTypes = $allTypes | Where-Object { $_.BaseType -eq $cmdType -and $_.Name -like '*Macro*' }
$output = @()
$output += "=== Command subclasses with Macro in name ==="
foreach ($t in $subTypes) {
$output += $t.FullName
$output += " Constructors: " + ($t.GetConstructors([System.Reflection.BindingFlags]::Public -bor [System.Reflection.BindingFlags]::NonPublic -bor [System.Reflection.BindingFlags]::Instance) | ForEach-Object { $_.ToString() })
}
# 也找所有 Command 子类
$allSubs = $allTypes | Where-Object { $_.BaseType -eq $cmdType }
$output += "=== All direct Command subclasses ==="
$output += ($allSubs | ForEach-Object { $_.FullName })
$output | Out-File 'C:/Users/sladr/source/repos/TellmePdmsPluging/inspect_result.txt' -Encoding UTF8