Imports System.IO PublicClass vCardReaderClass vCardReader Define#Region "Define" Public vCards As vCard() #End Region Subs#Region "Subs" Sub New()SubNew(ByVal vCardFileStream As FileStream) DecodeVCardFromFileStream(vCardFileStream) End Sub PrivateFunction Split()FunctionSplit(ByVal Content AsString) As CardProperty Dim CardProperty As CardProperty Dim PropertyAndParametreString AsString= Content.Split(":")(0) Dim ValueString AsString= Content.Split(":")(1) Dim Temp AsString() = PropertyAndParametreString.Split(";") CardProperty.Name = Temp(0) If Temp.Length >1Then ReDim CardProperty.Parametres(Temp.GetUpperBound(0) -1) Temp.Copy(Temp, 1, CardProperty.Parametres, 0, Temp.Length -1) Else CardProperty.Parametres =Nothing EndIf CardProperty.Values = ValueString.Split(";") Return CardProperty End Function PublicSub DecodeVCardFromFileStream()Sub DecodeVCardFromFileStream(ByVal vCardFileStream As FileStream) Dim Reader AsNew StreamReader(vCardFileStream) ReDim vCards(0) Dim CurrentVcard AsInteger Do 'Search for vCard ReDim vCards(CurrentVcard).Properties(-1) IfInStr(Reader.ReadLine, "BEGIN:VCARD") Then 'Start Processing vCard object Dim Content AsString Dim cardProperty As CardProperty Do Content = Reader.ReadLine If Content ="END:VCARD"ThenExitDo 'The "=" in then end of a stream indicates message is not complete. Read next line and contact them. Do If Content.LastIndexOf("=") = Content.Length -1Then Content = Content.Substring(0, Content.Length -2) + Reader.ReadLine Else : ExitDo EndIf Loop 'Split properties , parametres and values. cardProperty =Split(Content) Dim PropertyNumber AsInteger= vCards(CurrentVcard).Properties.Length ReDimPreserve vCards(CurrentVcard).Properties(PropertyNumber) vCards(CurrentVcard).Properties(PropertyNumber) = cardProperty Loop EndIf If Reader.Peek() <0Then Return EndIf CurrentVcard +=1 ReDimPreserve vCards(CurrentVcard) Loop End Sub #End Region Structures#Region "Structures" PublicStructure vCardStructure vCard Public Properties As CardProperty() End Structure PublicStructure CardPropertyStructure CardProperty Public Name AsString Public Parametres() AsString Public Values() AsString End Structure #End Region End Class