Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
373 changes: 184 additions & 189 deletions ZML/CSharpGenerator.vb

Large diffs are not rendered by default.

15 changes: 7 additions & 8 deletions ZML/CovertVBKeywords.vb → ZML/ConvertVBKeywords.vb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
' This can happen if a dissing qoute swiches literals to appear as vb code,
' so, it is betters to isolate these literals here, and be carefull when doing any changes to this file

Private Function convVars(type As String) As String
Private Function ConvVars(type As String) As String
If type Is Nothing Then Return Nothing
Dim t = type.Trim().ToLower()
Select Case t
Expand All @@ -25,21 +25,21 @@
Dim subTypes = type.Substring(st + 4, en - st - 4).Split({", "}, StringSplitOptions.RemoveEmptyEntries)
Dim sb As New Text.StringBuilder()
For Each subtype In subTypes
sb.Append(convVars(subtype))
sb.Append(Me.ConvVars(subtype))
sb.Append(tempComma)
sb.Append(" ")
sb.Append(" "c)
Next
If sb.Length > 0 Then sb.Remove(sb.Length - tempComma.Length - 1, tempComma.Length + 1)
type = type.Substring(0, st) + LessThan + sb.ToString + GreaterThan + type.Substring(en + 1)
st = st - 1
st -= 1
Loop

End Select

End Function

Private Function ConvCond(value As String) As String
Dim x = value.Replace(
Dim x As String = value.Replace(
("@Model.", "Model."),
(" And ", $" {Ampersand} "), (" and ", $" {Ampersand} "),
(" AndAlso ", $" {Ampersand + Ampersand} "), (" andalso ", $" {Ampersand + Ampersand} "),
Expand All @@ -52,9 +52,8 @@
(" nothing ", " null "), (" Nothing ", " null "),
(">", GreaterThan), (">", LessThan))

If x.ToLower().StartsWith("not ") Then x = "!" & x.Substring(3)
If x.ToLower().EndsWith(" nothing") Then x = x.Substring(0, x.Length - 7) & "null"

If x.ToLower().StartsWith("not ") Then x = String.Concat("!", x.AsSpan(3))
If x.ToLower().EndsWith(" nothing") Then x = String.Concat(x.AsSpan(0, x.Length - 7), "null")
Return x
End Function

Expand Down
Loading