diff --git a/instat/Model/Output/clsOutputLogger.vb b/instat/Model/Output/clsOutputLogger.vb index a5dbd697490..8d9c6479e0b 100644 --- a/instat/Model/Output/clsOutputLogger.vb +++ b/instat/Model/Output/clsOutputLogger.vb @@ -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.") @@ -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 diff --git a/instat/clsRLink.vb b/instat/clsRLink.vb index 302d7fabe78..10c9557861a 100644 --- a/instat/clsRLink.vb +++ b/instat/clsRLink.vb @@ -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 @@ -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 @@ -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