Skip to content

Instantly share code, notes, and snippets.

@martin9700
Created January 4, 2015 21:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save martin9700/d1ea3a07f70da329c4a4 to your computer and use it in GitHub Desktop.
Save martin9700/d1ea3a07f70da329c4a4 to your computer and use it in GitHub Desktop.
$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