f43bf27dd9
- i parametri dei componenti sono stati riscritti, il separatore tra NOmeDDF e Messaggio è "/", modifica della lettura dei parametri in ReadParam in Compo.
54 lines
2.0 KiB
VB.net
54 lines
2.0 KiB
VB.net
Imports System.Text.RegularExpressions
|
|
|
|
Module RegexFunction
|
|
' restituisce vero se trova il capitoletto [Graphic parameters]
|
|
Friend Function IsGraphicParametersTitle(sLine As String) As Boolean
|
|
If Regex.Match(sLine, "\s*--\s*(\[Graphic parameters\])\s*$").Groups(1).Value = "[Graphic parameters]" Then
|
|
Return True
|
|
End If
|
|
Return False
|
|
End Function
|
|
|
|
' restituisce quello che segue l'uguale assegnata una parola chiave tra i due trattini e 'uguale
|
|
Friend Function ParamLine(sLine As String, sKey As String) As String
|
|
Return Regex.Match(sLine, "\s*--\s*(" & sKey & ")\s*=\s*(.*)\s*$").Groups(2).Value
|
|
End Function
|
|
|
|
' verifico che il messaggio da stampare a video non abbia la forma "Msg1000"
|
|
Friend Function EgtMsgNotFound(sMsg As String) As Boolean
|
|
If Regex.Match(sMsg, "\s*(Msg)\s*(.*)\s*$").Groups(1).Value = "Msg" Then
|
|
Return True
|
|
Else
|
|
Return False
|
|
End If
|
|
End Function
|
|
|
|
' restituisca la stringa di commento
|
|
Friend Function SearchComments(sLine As String) As String
|
|
Return Regex.Match(sLine, "\s*#\s*(.*?\b)\s*$").Groups(1).Value
|
|
End Function
|
|
|
|
' restituisce la stringa che precede i commenti
|
|
Friend Function SearchStringBeforeComments(sLine As String) As String
|
|
Return Regex.Match(sLine, "\s*(.*?)\s*#.*$").Groups(1).Value
|
|
End Function
|
|
|
|
' restituisce quello che segue l'uguale assegnata la parola chiave Err
|
|
Friend Function ErrDraw(sLine As String) As Integer
|
|
Dim sErrMsg As String = Regex.Match(sLine, "\s*(Err)\s*=\s*(.*?\b)\s*$").Groups(2).Value
|
|
' se il valore è numerico allora lo restituisco
|
|
If IsNumeric(sErrMsg) Then
|
|
Return CInt(sErrMsg)
|
|
Else
|
|
' altrimenti restituisco il valore zero (non errore)
|
|
Return 0
|
|
End If
|
|
|
|
End Function
|
|
|
|
Friend Function ParamExpression(sLine As String) As String
|
|
Return Regex.Match(sLine, " \s*\(*\s*(.*?\b)\s*\).*$").Groups(1).Value
|
|
End Function
|
|
|
|
End Module
|