home *** CD-ROM | disk | FTP | other *** search
- Attribute VB_Name = "Module1"
- Type MsDfs
- filename As String
- tracktitle As String
- End Type
- Global Musicfiles(100) As MsDfs
- Global MaxMusicFiles As Integer
- Sub Load()
- MaxMusicFiles = 0
- Open "Music.Dat" For Input As #1
- Do
- Line Input #1, a$
- If a$ = "[ENDOFFILE]" Then Exit Do
- If a$ = "[MUSICDEF]" Then
- musicfilenum = musicfilenum + 1
- Line Input #1, a$
- propvalue$ = GetPropertyValue(a$)
- Musicfiles(musicfilenum).tracktitle = propvalue$
- Line Input #1, a$
- propvalue$ = GetPropertyValue(a$)
- Musicfiles(musicfilenum).filename = propvalue$
- End If
- Loop
- Close #1
- MaxMusicFiles = musicfilenum
- End Sub
- Sub Save()
-
- Open "Music.Dat" For Output As #1
- Print #1, "ION FORMAT VERSION: 1.0"
- For i = 1 To MaxMusicFiles
- Print #1, "[MUSICDEF]"
- Print #1, "Name: " & Musicfiles(i).tracktitle
- Print #1, "FileName: " & Musicfiles(i).filename
- Print #1, "[ENDMUSICDEF]"
- Next i
- Print #1, "[ENDOFFILE]"
- Close #1
- End Sub
- Public Function GetPropertyValue(TextString) As String
- GetPropertyValue = Right$(TextString, Len(TextString) - InStr(1, TextString, " "))
- End Function
- Public Function GetPropertyName(TextString) As String
- If InStr(1, TextString, " ") = 0 Then
- GetPropertyName = TextString
- Else
- GetPropertyName = Left$(TextString, InStr(1, TextString, " ") - 1)
- End If
- End Function
- Sub UpdateList()
- Currindex = Form1.List1.ListIndex
- Form1.List1.Clear
- Form1.List1.AddItem "[NewMusicDef]"
- For i = 1 To MaxMusicFiles
- Form1.List1.AddItem Musicfiles(i).tracktitle
- Next i
- Form1.List1.ListIndex = Currindex
- End Sub
- Sub UpdateProperties()
- mnum = Form1.List1.ListIndex
- Form1.Text1.Text = Musicfiles(mnum).tracktitle
- Form1.Text2.Text = Musicfiles(mnum).filename
- End Sub
-