Corrected issue where some line numbers were set to 0 #6
This commit is contained in:
@@ -16,7 +16,18 @@ class MonitoredScript
|
|||||||
|
|
||||||
[int] SetScript([string]$Path)
|
[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
|
$this.LinesOfCode = $this.Line.Count
|
||||||
return $this.LinesOfCode
|
return $this.LinesOfCode
|
||||||
}
|
}
|
||||||
@@ -26,7 +37,6 @@ class MonitoredScript
|
|||||||
# Line numbers start at 1 but the array starts at 0
|
# Line numbers start at 1 but the array starts at 0
|
||||||
$lineNumber = $node.Breakpoint.Line - 1
|
$lineNumber = $node.Breakpoint.Line - 1
|
||||||
$record = $this.Line[$lineNumber]
|
$record = $this.Line[$lineNumber]
|
||||||
$record.LineNumber = $lineNumber
|
|
||||||
|
|
||||||
if($this.lastNode)
|
if($this.lastNode)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user