VERSION 1.0 CLASS
BEGIN
  MultiUse = -1  'True
  Persistable = 0  'NotPersistable
  DataBindingBehavior = 0  'vbNone
  DataSourceBehavior  = 0  'vbNone
  MTSTransactionMode  = 0  'NotAnMTSObject
END
Attribute VB_Name = "clsLogins"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False
Public Items As New Collection

Public Sub LoadLogins()
    Set Items = New Collection
    Dim obj As New objLogin, Content As String, Splt() As String, I As Long
    Content = ReadFile(AppData & "Data\Other\Logins.dat")
    Content = HexToString(Content)
    Splt = Split(Content, vbNewLine)
    For I = 0 To UBound(Splt)
        Dim Data() As String
        Data = Split(Splt(I), " ", 3)
        If UBound(Data) = 2 Then
            AddLogin Data(1), Data(2), Val(Data(0)), False, False
        End If
    Next
    SaveLogins
End Sub

Public Sub SaveLogins()
    Dim Content As String, I As Integer
    For I = 1 To Items.Count
        Content = Content & Items(I).Logins & " " & _
                            Items(I).Username & " " & _
                            Items(I).Password & vbNewLine
    Next
    Content = StrToHex(Content)
    SaveFile AppData & "Data\Other\Logins.dat", Content
End Sub

Public Sub AddLogin(Username As String, Password As String, Optional Logins As Double = 1, Optional Increment As Boolean = False, Optional Save As Boolean = False)
    Dim I As Integer
    For I = 1 To Items.Count
        If LCase$(Items(I).Username) = LCase$(Username) And _
            LCase$(Items(I).Password) = LCase$(Password) Then
            Items(I).Logins = Items(I).Logins + 1
            Exit Sub
        End If
    Next
    Dim obj As New objLogin
    obj.Logins = Logins
    If Increment Then obj.Logins = obj.Logins + 1
    obj.Username = Username
    obj.Password = Password
    If Save Then SaveLogins
End Sub
