From a25a1584d80bc3f08d8188cfcf051ae8476aef47 Mon Sep 17 00:00:00 2001 From: Ntalumeso Date: Thu, 9 Jan 2025 16:44:19 +0300 Subject: [PATCH] Fortmatting script from preview window --- instat/dlgScript.vb | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/instat/dlgScript.vb b/instat/dlgScript.vb index 7ca7d373b6e..200629b1865 100644 --- a/instat/dlgScript.vb +++ b/instat/dlgScript.vb @@ -675,12 +675,29 @@ Public Class dlgScript End Sub Private Sub PreviewScript(strNewScript As String) - txtScript.Text = strNewScript & Environment.NewLine + Dim strScript As String = strNewScript & Environment.NewLine + txtScript.Text = GetFormattedScript(strScript) txtScript.SelectionStart = txtScript.Text.Length txtScript.ScrollToCaret() txtScript.Refresh() End Sub + Private Function GetFormattedScript(strScript As String) As String + Dim strReconstructedstrScript As String = "" + Dim arrCommentParts As String() + If strScript.Length > 0 Then + arrCommentParts = strScript.Split(Environment.NewLine.ToCharArray(), StringSplitOptions.RemoveEmptyEntries) + For Each strPart As String In arrCommentParts + If strReconstructedstrScript = "" Then + strReconstructedstrScript = "" & strPart + Else + strReconstructedstrScript = strReconstructedstrScript & Environment.NewLine & strPart + End If + Next + End If + Return strReconstructedstrScript + End Function + Private Sub ucrInputChooseFile_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrInputChooseFile.ControlContentsChanged, ucrChkOpenRFile.ControlContentsChanged UpdateScript() ucrInputChooseFile.Visible = ucrChkOpenRFile.Checked