Public Class frmMain Dim latestDate As String = "Friday, May 5th 2007" Dim ftpURL As String = "ftp.powweb.com" Dim ftpUname As String = "asfadmin" Dim ftpPwd As String = "g1ngerbread_guillotine" Function libraryContains(ByVal path As String) Dim index As Integer = -1 Dim i As Integer = 0 While i < sLibrary.Rows.Count If sLibrary.Rows.Item(i).Cells.Item(4).Value = path Then index = i Exit While End If i += 1 End While Return index End Function Private Sub addFile(ByVal path As String) Dim folderPath As String = IO.Path.GetDirectoryName(path) Dim folderName As String = folderPath.Remove(0, folderPath.LastIndexOf("\") + 1) Dim songPath As String Dim songName As String Dim songCat As String = "Last Added" If path.EndsWith(".mp3") Then songPath = path If libraryContains(songPath) = -1 Then Dim lIndex As Integer = songPath.LastIndexOf("\") + 1 songName = songPath.Substring(lIndex, songPath.Length - lIndex - 4) songName.Replace("#", "_") sLibrary.Rows.Add(True, songName, folderName, songCat, songPath, folderPath, "") End If End If End Sub Private Sub addFolder(ByVal path As String) Dim folderPath As String = path Dim folderName As String = folderPath.Remove(0, folderPath.LastIndexOf("\") + 1) Dim songPath As String Dim songName As String Dim songCat As String = "Last Added" For Each file As String In IO.Directory.GetFiles(path) If file.EndsWith(".mp3") Then songPath = file If libraryContains(songPath) = -1 Then Dim lIndex As Integer = songPath.LastIndexOf("\") + 1 songName = songPath.Substring(lIndex, songPath.Length - lIndex - 4) songName.Replace("#", "_") sLibrary.Rows.Add(True, songName, folderName, songCat, songPath, folderPath, "") End If End If Next For Each dir As String In IO.Directory.GetDirectories(path) folderPath = dir folderName = folderPath.Remove(0, folderPath.LastIndexOf("\") + 1) For Each file As String In IO.Directory.GetFiles(dir) If file.EndsWith(".mp3") Then songPath = file If libraryContains(songPath) = -1 Then Dim lIndex As Integer = songPath.LastIndexOf("\") + 1 songName = songPath.Substring(lIndex, songPath.Length - lIndex - 4) songName.Replace("#", "_") sLibrary.Rows.Add(True, songName, folderName, songCat, songPath, folderPath, "") End If End If Next Next End Sub Private Sub createPage() If IO.File.Exists(System.Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData).ToString & "\ASF_Updater\cur.htm") = False Then IO.Directory.CreateDirectory(System.Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData).ToString & "\ASF_Updater") Dim web As New Net.WebClient web.DownloadFile("http://aspaceforth.decidel.net/", System.Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData).ToString & "\ASF_Updater\cur.htm") End If Dim reader As New System.IO.StreamReader(System.Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData).ToString & "\ASF_Updater\cur.htm") Dim writer As New System.IO.StreamWriter(System.Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData).ToString & "\ASF_Updater\index.htm") Dim i As Integer = 0 'preliminary While reader.Peek <> -1 writer.WriteLine(reader.ReadLine()) End While reader.Close() If sCatLibrary.Item(2, 0).Value = True Then i = 0 writer.WriteLine("
The Latest
") While i < sCatLibrary.Rows.Count - 1 If sCatLibrary.Rows.Item(i).Cells.Item(0).Value = "The Latest" Then writer.WriteLine("" & sCatLibrary.Rows.Item(i).Cells.Item(1).Value & "
") End If i += 1 End While writer.WriteLine("" & sLibrary.Rows.Item(i).Cells.Item(1).Value & "
") writer.WriteLine("-Recorded " & IO.File.GetCreationTime(sLibrary.Rows.Item(i).Cells.Item(4).Value) & "-
Last Added
") i = 0 While i < sCatLibrary.Rows.Count - 1 If sCatLibrary.Rows.Item(i).Cells.Item(0).Value = "Last Added" Then writer.WriteLine("" & sCatLibrary.Rows.Item(i).Cells.Item(1).Value & "
") End If i += 1 End While writer.WriteLine("" & sLibrary.Rows.Item(i).Cells.Item(1).Value & "
") End If i += 1 End While writer.WriteLine("") End If 'All the rest i = 0 While i < sCatLibrary.Rows.Count - 1 If sCatLibrary.Rows.Item(i).Cells.Item(0).Value <> "The Latest" And sCatLibrary.Rows.Item(i).Cells.Item(0).Value <> "Last Added" And sCatLibrary.Rows.Item(i).Cells.Item(2).Value = True Then writer.WriteLine("" & sCatLibrary.Rows.Item(i).Cells.Item(0).Value & "
") writer.WriteLine("" & sCatLibrary.Rows.Item(i).Cells.Item(1).Value & "
") writer.WriteLine("" & sLibrary.Rows.Item(j).Cells.Item(1).Value & "
") End If j += 1 End While End If i += 1 End While writer.WriteLine("") 'footer writer.WriteLine("Get All ASF Audio") writer.WriteLine("
- © Jarfunk McMarkenstein Gush 20XX -
") writer.WriteLine("") writer.WriteLine("