Skip to content

Commit

Permalink
minor code change
Browse files Browse the repository at this point in the history
  • Loading branch information
N-thony committed Apr 22, 2024
1 parent 58a18e3 commit e0ed114
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 13 deletions.
7 changes: 5 additions & 2 deletions instat/Model/Output/clsOutputLogger.vb
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ Public Class clsOutputLogger
End Set
End Property

Public Sub AddOutput(strScript As String, strOutput() As String, bAsFile As Boolean, bDisplayOutputInExternalViewer As Boolean)
Public Sub AddOutput(strScript As String, strOutput As String, bAsFile As Boolean, bDisplayOutputInExternalViewer As Boolean)
' Note this always takes the last script added as corresponding script
If String.IsNullOrWhiteSpace(strScript) Then
Throw New Exception("Cannot find script to attach output to.")
Expand All @@ -84,7 +84,10 @@ Public Class clsOutputLogger
' Raise event for output pages
RaiseEvent NewOutputAdded(rScriptElement, False)

For Each output In strOutput
' Split the strOutput into an array of lines, removing empty entries
Dim arrFilesPaths() As String = strOutput.Split({Environment.NewLine}, StringSplitOptions.RemoveEmptyEntries)

For Each output In arrFilesPaths
If Not String.IsNullOrEmpty(output) Then
Dim outputElement As New clsOutputElement
Dim outputType As OutputType
Expand Down
14 changes: 3 additions & 11 deletions instat/clsRLink.vb
Original file line number Diff line number Diff line change
Expand Up @@ -749,11 +749,8 @@ Public Class RLink
bShowWaitDialogOverride:=Nothing)
End If

' Split the strOutput into an array of lines, removing empty entries
Dim arrFilesPaths() As String = strOutput.Split({Environment.NewLine}, StringSplitOptions.RemoveEmptyEntries)

' Add output to logger
clsOutputLogger.AddOutput(clsRStatement.Text, arrFilesPaths, bAsFile:=True,
clsOutputLogger.AddOutput(clsRStatement.Text, strOutput, bAsFile:=True,
bDisplayOutputInExternalViewer:=clsRStatement.TextNoFormatting.StartsWith("view_object_data"))

' Log the script
Expand Down Expand Up @@ -858,11 +855,9 @@ Public Class RLink
Evaluate(strRStatement, bSilent:=False, bSeparateThread:=False, bShowWaitDialogOverride:=Nothing)
End If

' Split the strOutput into an array of lines, removing empty entries
Dim arrFilesPaths() As String = strOutput.Split({Environment.NewLine}, StringSplitOptions.RemoveEmptyEntries)
clsOutputLogger.AddOutput(If(String.IsNullOrEmpty(strRStatementComment), "",
strRStatementComment & Environment.NewLine) & strRStatement,
arrFilesPaths, bAsFile, bDisplayOutputInExternalViewer)
strOutput, bAsFile, bDisplayOutputInExternalViewer)
LogScript(strRStatement, strRStatementComment)

Catch e As Exception
Expand Down Expand Up @@ -1004,11 +999,8 @@ Public Class RLink
End If
End If

' Split the strOutput into an array of lines, removing empty entries
Dim arrFilesPaths() As String = strOutput.Split({Environment.NewLine}, StringSplitOptions.RemoveEmptyEntries)

' If strOutput is empty or does not contain valid HTML files, add strOutput itself as an output
clsOutputLogger.AddOutput(strScriptWithComment, arrFilesPaths, bAsFile, bDisplayOutputInExternalViewer)
clsOutputLogger.AddOutput(strScriptWithComment, strOutput, bAsFile, bDisplayOutputInExternalViewer)


Catch e As Exception
Expand Down

0 comments on commit e0ed114

Please sign in to comment.