Attribute VB_Name = "modQuotes"
Option Explicit

Public Quotes As New Collection

Public Sub AddQuote(Quote As String, Optional Save As Boolean = True)
On Error Resume Next
    Quotes.Add Quote, Quote
    If Save Then SaveQuotes
End Sub

Public Sub LoadQuotes()
    Set Quotes = New Collection
    Dim S() As String, RF As String, I As Integer
    RF = ReadFile(AppData & "Data\Other\Quotes.txt")
    S = Split(RF, vbNewLine)
    For I = 0 To UBound(S)
        AddQuote S(I), False
    Next
End Sub

Public Function RandomQuote() As String
    If Quotes.Count = 0 Then Exit Function
    Dim I As Integer
    Randomize Timer
    I = Int(Rnd * Quotes.Count) + 1
    RandomQuote = Quotes(I)
End Function

Public Sub SaveQuotes()
    Dim FC As String, I As Integer
    For I = 1 To Quotes.Count
        FC = FC & Quotes(I) & vbNewLine
    Next
    SaveFile AppData & "Data\Other\Quotes.txt", FC
End Sub

