@
-Away
[highlight="VB.NET"]#Region "Declaration"
Dim Accs As List(Of AccInfo)
Structure AccInfo
Dim Login As String
Dim Password As String
Dim Details As List(Of String)
End Structure
#End Region
#Region "Functions"
Private Sub Savelist(ByVal Where2Save As String, ByVal Accounts As List(Of AccInfo), Optional ByVal Delimiter As Char = "|"c)
Dim strb As New System.Text.StringBuilder
Dim details As String = String.Empty
For i = 0 To Accounts.Count - 1
Dim acc As AccInfo = Accounts(i)
With acc
For det = 0 To .Details.Count - 1
details &= String.Concat(.Details(det), ";")
details = details.Substring(0, -1)
Next
strb.AppendLine(String.Concat(.Login, Delimiter, .Password, Delimiter, details))
End With
Next
Using sWrite As New IO.StreamWriter(Where2Save)
sWrite.Write(strb.ToString)
End Using
End Sub
Private Function RetreiveList(ByVal Path2Read As String, Optional ByVal Delimiter As String = "|"c) As List(Of AccInfo)
Dim Content As String = IO.File.ReadAllText(Path2Read)
Dim Accounts As New List(Of AccInfo)
For Each lines As String In Content.Split(vbCrLf.ToCharArray)
Dim splitted() As String = lines.Split(Delimiter)
For i = 0 To splitted.Count - 1
Dim acc As New AccInfo
Dim splitdetails() As String = splitted(2).Split(";")
Dim details As New List(Of String)
For det = 0 To splitdetails.Count - 1
details.Add(splitdetails(det))
Next
With acc
.Login = splitted(0)
.Password = splitted(1)
.Details = details
End With
Accounts.Add(acc)
Next
Next
Return Accounts
End Function
#End Region[/highlight]
Quickly wrote this up for you.
I changed the structure a bit.
Btw, I have not tested this at ALL.
Add me on msn if you have further questions...take a look at my profile if you don't have me yet...