Created
January 4, 2015 21:21
-
-
Save martin9700/d1ea3a07f70da329c4a4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$Raw = Get-Content $File | |
$Functions = New-Object -TypeName System.Collections.ArrayList | |
$Function = New-Object -TypeName System.Collections.ArrayList | |
ForEach ($Line in $Raw) | |
{ | |
If ($Line -like "Function*" -and (-not $Begin)) | |
{ | |
$Begin = $true | |
} | |
If ($Begin) | |
{ | |
$Count = $Count + ($Line.Split("{").Count - 1) | |
$Count = $Count - ($Line.Split("}").Count - 1) | |
$Function.Add($Line) | Out-Null | |
If ($Count -eq 0) | |
{ | |
$Functions.Add($Function -join "`n") | Out-Null | |
$Function = New-Object -TypeName System.Collections.ArrayList | |
$Begin = $false | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment