VB.NET IMAP BODY ENVELOPE分离到类

时间:2017-09-07 11:26:24

标签: structure imap separator envelope

我想把IMAP BODY ENVELOPE分成自己的班级。

(IMAP命令:UID FETCH 4(BODY ENVELOPE))

我的课程:

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

我的IMAP结果:https://pastebin.com/fv7yajsq

尝试与:

分开
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

将Visual Basic 2015与.NET 2.0和IMAPv4一起使用

我的问题:如何将IMAP结果分离到我的或其他类?

0 个答案:

没有答案