Added constructor to ScriptLine
This commit is contained in:
@@ -17,22 +17,16 @@ class MonitoredScript
|
|||||||
[int] SetScript([string]$Path)
|
[int] SetScript([string]$Path)
|
||||||
{
|
{
|
||||||
$lineNumber = 0
|
$lineNumber = 0
|
||||||
foreach($command in (Get-Content -Path $Path))
|
foreach($command in ( Get-Content -Path $Path ))
|
||||||
{
|
{
|
||||||
$this.Line.Add(
|
$this.Line.Add( [ScriptLine]::New($command, $path, $lineNumber) )
|
||||||
[ScriptLine]@{
|
|
||||||
Text = $command
|
|
||||||
Path = $path
|
|
||||||
LineNumber = $lineNumber
|
|
||||||
}
|
|
||||||
)
|
|
||||||
$lineNumber++
|
$lineNumber++
|
||||||
}
|
}
|
||||||
$this.LinesOfCode = $this.Line.Count
|
$this.LinesOfCode = $this.Line.Count
|
||||||
return $this.LinesOfCode
|
return $this.LinesOfCode
|
||||||
}
|
}
|
||||||
|
|
||||||
[void] AddExecution([hashtable]$node)
|
[void] AddExecution( [hashtable]$node )
|
||||||
{
|
{
|
||||||
# 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
|
||||||
|
|||||||
@@ -10,13 +10,22 @@ class ScriptLine
|
|||||||
[string] $Path
|
[string] $Path
|
||||||
[string] $Text
|
[string] $Text
|
||||||
[System.Collections.ArrayList]$Executions
|
[System.Collections.ArrayList]$Executions
|
||||||
hidden [hashtable]$LastNode = $null
|
hidden [hashtable]$LastNode = @{}
|
||||||
|
|
||||||
ScriptLine()
|
ScriptLine()
|
||||||
{
|
{
|
||||||
$Executions = New-Object 'System.Collections.ArrayList'
|
$this.Executions = New-Object 'System.Collections.ArrayList'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ScriptLine($Command, $Path, $LineNumber)
|
||||||
|
{
|
||||||
|
$this.Executions = New-Object 'System.Collections.ArrayList'
|
||||||
|
$this.Text = $Command
|
||||||
|
$this.Path = $Path
|
||||||
|
$this.LineNumber = $LineNumber
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
[void]AddExecutionTime([float]$Milliseconds)
|
[void]AddExecutionTime([float]$Milliseconds)
|
||||||
{
|
{
|
||||||
$this.LastNode.Milliseconds = $Milliseconds
|
$this.LastNode.Milliseconds = $Milliseconds
|
||||||
|
|||||||
Reference in New Issue
Block a user