-
Notifications
You must be signed in to change notification settings - Fork 4k
/
findibc.ps1
39 lines (36 loc) · 1.02 KB
/
findibc.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
[CmdletBinding(PositionalBinding=$false)]
param (
[string]$intermediateAssembly,
[string]$ibcRootFolder)
try {
$assemblyName = [System.IO.Path]::GetFileName($intermediateAssembly)
$fullPath = [System.IO.Path]::GetFullPath($ibcRootFolder)
if(![System.IO.Directory]::Exists($fullPath)){
# There is no product data directory return
return ""
}
$root = (New-Object -TypeName System.IO.DirectoryInfo -ArgumentList $fullPath)
$dllEntry = [System.Linq.Enumerable]::SingleOrDefault($root.EnumerateFiles($assemblyName,[System.IO.SearchOption]::AllDirectories))
if (!$dllEntry)
{
return "";
}
$ibcFileInfos = $dllEntry.Directory.EnumerateFiles("*.ibc")
$strings = (New-Object "System.Collections.Generic.List[System.String]")
foreach ($ibcFileInfo in $ibcFileInfos)
{
$name = $ibcFileInfo.FullName
$strings.Add($name)
}
$ibcFiles = $strings -join ' '
return $ibcFiles
}
catch {
Write-Host $_
Write-Host $_.Exception
Write-Host $_.ScriptStackTrace
exit 1
}
finally {
Pop-Location
}