Corrected issue where some line numbers were set to 0 #6

This commit is contained in:
KevinMarquette
2017-02-06 21:12:38 -08:00
parent 417b0ce4ad
commit 068d1e129d

View File

@@ -16,7 +16,18 @@ class MonitoredScript
[int] SetScript([string]$Path)
{
Get-Content -Path $Path | %{ $this.Line.Add( [ScriptLine]@{text=$_;path=$path})}
$lineNumber = 0
foreach($command in (Get-Content -Path $Path))
{
$this.Line.Add(
[ScriptLine]@{
Text = $command
Path = $path
LineNumber = $lineNumber
}
)
$lineNumber++
}
$this.LinesOfCode = $this.Line.Count
return $this.LinesOfCode
}
@@ -26,7 +37,6 @@ class MonitoredScript
# Line numbers start at 1 but the array starts at 0
$lineNumber = $node.Breakpoint.Line - 1
$record = $this.Line[$lineNumber]
$record.LineNumber = $lineNumber
if($this.lastNode)
{