VB.NET IMAP BODY ENVELOPE separating to class

94 views Asked by At

I would like separating the IMAP BODY ENVELOPE to own class.

(IMAP command: UID FETCH 4 (BODY ENVELOPE))

My class:

Class ENVELOPE
    Class PL
        Dim Name As String
        Dim Value As String
    End Class
    Dim Type As String
    Dim SubType As String
    Dim PList() As PL 'Parameter list
    Dim ID As String
    Dim FileName As String 'Description
    Dim Encoding As String
    Dim Length As Integer
End Class

My IMAP result: https://pastebin.com/fv7yajsq

Try separating with:

Sub Separator(ByVal str As String)
    Dim level As Integer = 0
    Dim InAtt As String = ""
    Dim lastl As Integer = 0
    Dim skiplevel As Boolean = False
    Dim levelss() As String = {0, 0, 0, 0, 0, 0}
    For Each c As Char In str

        If Not lastl = level Then
            Debug.WriteLine(String.Join(",", levelss) & " - " & InAtt)
            InAtt = ""
            If lastl < level Then levelss(lastl) += 1
            lastl = level
        End If

        If c = "("c And skiplevel = False Then
            level += 1
        ElseIf c = ")"c And skiplevel = False Then
            levelss(level) = 0
            level -= 1
        ElseIf c = """" Then
            skiplevel = Not skiplevel
            InAtt &= c
        Else
            InAtt &= c
        End If
    Next
End Sub

Use Visual Basic 2015 with .NET 2.0 and IMAPv4

My question: How can separate IMAP result to my, or other class?

0

There are 0 answers