Update gestione return errori

This commit is contained in:
Samuele Locatelli
2023-05-12 10:36:52 +02:00
parent 8e1f21f417
commit 07e9a0237d
+9 -22
View File
@@ -105,31 +105,18 @@ Public Class Form1
End While
Dim procResults As New List(Of CalcResultDTO)
Dim currRes As New CalcResultDTO
'' verifico esistenza file svg e lo carico
'Dim sSvgPath As String = Path.ChangeExtension(sDdfPath, "svg")
'' leggo contenuto
'Dim sSvgContent As String = GetFileContent(sSvgPath)
'bOk = File.Exists(sSvgPath)
'Dim sSvgContent As String = ""
'If bOk Then
' Try
' sSvgContent = File.ReadAllText(sSvgPath)
' Catch ex As Exception
' bOk = False
' sSvgContent = ""
' End Try
'End If
Dim fContent As String = ""
' verifico esistenza file svg e lo carico
bOk = GetFileContent(Path.ChangeExtension(sDdfPath, "svg"), fContent)
' invio risposta
currRes.Validated = Proc.ExitCode = 0 AndAlso bOk
currRes.DoorIdVers = Item.Key
' se NON fosse validato --> messo il messaggio...
If (currRes.Validated) Then
currRes.SvgGen = GetFileContent(Path.ChangeExtension(sDdfPath, "svg"))
currRes.SvgGen = fContent
Else
currRes.ErrorMsg = GetFileContent(Path.ChangeExtension(sDdfPath, "txt"))
bOk = GetFileContent(Path.ChangeExtension(sDdfPath, "txt"), fContent)
currRes.ErrorMsg = fContent
End If
procResults.Add(currRes)
@@ -145,8 +132,8 @@ Public Class Form1
End Sub
Private Function GetFileContent(filePath As String) As String
Dim fileContent As String = ""
Private Function GetFileContent(ByVal filePath As String, ByRef fileContent As String) As Boolean
Dim bOk As Boolean = File.Exists(filePath)
If bOk Then
Try
@@ -156,7 +143,7 @@ Public Class Form1
fileContent = ""
End Try
End If
Return fileContent
Return bOk
End Function