VERSION 5.00 Object = "{6B7E6392-850A-101B-AFC0-4210102A8DA7}#1.3#0"; "COMCTL32.OCX" Begin VB.Form AdvancedDialog Caption = "RiOFXP Advanced Functions" ClientHeight = 4365 ClientLeft = 60 ClientTop = 345 ClientWidth = 6885 ControlBox = 0 'False LinkTopic = "Form1" ScaleHeight = 4365 ScaleWidth = 6885 StartUpPosition = 3 'Windows Default Begin VB.Frame UploadQueue Caption = "Upload Queue" Height = 4095 Left = 120 TabIndex = 0 Top = 120 Width = 6615 Begin VB.CommandButton ClearButton Caption = "Clear" Height = 375 Left = 240 TabIndex = 10 ToolTipText = "Clear the Queue" Top = 3480 Width = 855 End Begin ComctlLib.ListView ListView1 Height = 3015 Left = 240 TabIndex = 8 ToolTipText = "Drag and Drop files and folders here" Top = 360 Width = 3855 _ExtentX = 6800 _ExtentY = 5318 View = 3 MultiSelect = -1 'True LabelWrap = -1 'True HideSelection = -1 'True OLEDropMode = 1 _Version = 327682 Icons = "ImageList1" SmallIcons = "ImageList1" ForeColor = -2147483640 BackColor = -2147483643 BorderStyle = 1 Appearance = 1 OLEDropMode = 1 NumItems = 2 BeginProperty ColumnHeader(1) {0713E8C7-850A-101B-AFC0-4210102A8DA7} Key = "" Object.Tag = "" Text = "Type / Name" Object.Width = 4410 EndProperty BeginProperty ColumnHeader(2) {0713E8C7-850A-101B-AFC0-4210102A8DA7} SubItemIndex = 1 Key = "" Object.Tag = "" Text = "Size" Object.Width = 1164 EndProperty End Begin VB.CommandButton RemoveButton Caption = "Remove" Height = 375 Left = 1200 TabIndex = 7 ToolTipText = "Remove selected entries from queue" Top = 3480 Width = 855 End Begin VB.CommandButton CancelButton Caption = "Cancel" Height = 375 Left = 4320 TabIndex = 5 Top = 3000 Width = 2055 End Begin VB.CommandButton UploadButton Caption = "Upload Queue" Default = -1 'True Height = 375 Left = 4320 TabIndex = 4 ToolTipText = "Upload the queue entries to the Rio" Top = 3480 Width = 2055 End Begin VB.CommandButton RandomButton Caption = "Fill Queue" Height = 375 Left = 4440 TabIndex = 3 ToolTipText = "Click to fill the queue with random MP3's starting at the selected path" Top = 2280 Width = 1815 End Begin VB.DriveListBox Drive1 Height = 315 Left = 4440 TabIndex = 2 ToolTipText = "Select the path where the randomizer will look for MP3 files (recursive)" Top = 600 Width = 1815 End Begin VB.DirListBox Dir1 Height = 1215 Left = 4440 TabIndex = 1 ToolTipText = "Select the path where the randomizer will look for MP3 files (recursive)" Top = 960 Width = 1815 End Begin VB.Frame Randomizer Caption = "Randomizer" Height = 2415 Left = 4320 TabIndex = 11 Top = 360 Width = 2055 End Begin VB.Label RioFree Caption = "????? KBytes free on Rio" Height = 255 Left = 2160 TabIndex = 9 Top = 3720 Width = 1935 End Begin ComctlLib.ImageList ImageList1 Left = 120 Top = 240 _ExtentX = 1005 _ExtentY = 1005 BackColor = -2147483643 ImageWidth = 16 ImageHeight = 16 MaskColor = 12632256 _Version = 327682 BeginProperty Images {0713E8C2-850A-101B-AFC0-4210102A8DA7} NumListImages = 2 BeginProperty ListImage1 {0713E8C3-850A-101B-AFC0-4210102A8DA7} Picture = "AdvancedDialog.frx":0000 Key = "dfl" Object.Tag = "dfl" EndProperty BeginProperty ListImage2 {0713E8C3-850A-101B-AFC0-4210102A8DA7} Picture = "AdvancedDialog.frx":031A Key = "folder" Object.Tag = "folder" EndProperty EndProperty End Begin VB.Label QueueFill Caption = "????? KBytes in Queue" Height = 255 Left = 2160 TabIndex = 6 Top = 3480 Width = 1935 End End End Attribute VB_Name = "AdvancedDialog" Attribute VB_GlobalNameSpace = False Attribute VB_Creatable = False Attribute VB_PredeclaredId = True Attribute VB_Exposed = False Private Declare Function SetWindowPos Lib "user32" (ByVal hWnd As Long, _ ByVal hWndInsertAfter As Long, ByVal x As Long, ByVal y As Long, _ ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long Private Declare Function OleCreatePictureIndirect Lib "oleaut32.dll" _ (pDicDesc As IconType, riid As CLSIdType, ByVal fown As Long, _ lpUnk As Object) As Long Private Declare Function SHGetFileInfo Lib "shell32.dll" Alias _ "SHGetFileInfoA" (ByVal pszPath As String, ByVal _ dwFileAttributes As Long, psfi As ShellFileInfoType, ByVal _ cbFileInfo As Long, ByVal uFlags As Long) As Long Private Type IconType cbSize As Long picType As PictureTypeConstants hIcon As Long End Type Private Type CLSIdType id(16) As Byte End Type Private Type ShellFileInfoType hIcon As Long iIcon As Long dwAttributes As Long szDisplayName As String * 260 szTypeName As String * 80 End Type Const Large = &H110 Const Small = &H111 Private Sub OnTop() If (RioFXP.AlwaysOnTop.Value) Then Call SetWindowPos(Me.hWnd, -1, 0, 0, 0, 0, 3) End If End Sub Private Function LoadIcon(Size&, extension) As IPictureDisp ' gets an Icon from windows for a given 3-char suffix Dim Result&, File$, Slash$ Dim Unkown As IUnknown Dim Icon As IconType Dim CLSID As CLSIdType Dim ShellInfo As ShellFileInfoType Call SHGetFileInfo("." + extension, &H80, ShellInfo, Len(ShellInfo), Size) Icon.cbSize = Len(Icon) Icon.picType = vbPicTypeIcon Icon.hIcon = ShellInfo.hIcon CLSID.id(8) = &HC0 CLSID.id(15) = &H46 Result = OleCreatePictureIndirect(Icon, CLSID, 1, Unkown) Set LoadIcon = Unkown End Function Private Sub CancelButton_Click() AdvancedDialog.Hide Unload AdvancedDialog End Sub Private Sub ClearButton_Click() ListView1.ListItems.Clear QueueFill.Tag = 0 queuesize (0) End Sub Private Sub Drive1_Change() On Error GoTo nochange Dir1.path = Drive1.Drive nochange: End Sub Private Sub Form_Load() ListView1.Tag = "0" QueueFill.Tag = 0 queuesize (0) OnTop Set Rio500 = CreateObject("Rio500Remix.Rio500") Rio500.Open avail = Rio500.AvailableMemory(RioFXP.Tag) RioFree.Caption = CStr(Round(avail / 1024, 0)) + " KBytes free on Rio" Rio500.Close Drive1.Drive = GetSetting("RiOFXP", "Settings", "RandomDrive", "C:") Dir1.path = GetSetting("RiOFXP", "Settings", "RandomPath", "C:\") End Sub Private Sub Form_Unload(Cancel As Integer) SaveSetting "RiOFXP", "Settings", "RandomPath", Dir1.path SaveSetting "RiOFXP", "Settings", "RandomDrive", Drive1.Drive End Sub Private Sub ListView1_ColumnClick(ByVal ColumnHeader As ComctlLib.ColumnHeader) ListView1.Sorted = True If (ListView1.SortOrder = lvwAscending) Then ListView1.SortOrder = lvwDescending Else ListView1.SortOrder = lvwAscending End If End Sub Private Sub ListView1_OLEDragDrop(Data As ComctlLib.DataObject, Effect As Long, Button As Integer, Shift As Integer, x As Single, y As Single) ListView1.Sorted = False j = 1 Set fs = CreateObject("Scripting.FileSystemObject") On Error GoTo nomorefiles While (Len(Data.Files(j)) > 3) i = InStrRev(Data.Files(j), "\") fname = Right(Data.Files(j), Len(Data.Files(j)) - i) Result = GetAttr(Data.Files(j)) And vbDirectory If Result Then GoTo diradd End If Set imgs = ImageList1.ListImages For Each img In imgs If (img.Key = (LCase(Right(fname, 3)))) Then GoTo drawit Next On Error GoTo dflicon ImageList1.ListImages.Add , LCase(Right(fname, 3)), LoadIcon(Small, LCase(Right(fname, 3))) On Error GoTo nomorefiles GoTo drawit dflicon: Set Entry = ListView1.ListItems.Add(, Data.Files(j), fname, "dfl", "dfl") GoTo sizecalc drawit: Set Entry = ListView1.ListItems.Add(, Data.Files(j), fname, LCase(Right(fname, 3)), LCase(Right(fname, 3))) GoTo sizecalc diradd: Set Entry = ListView1.ListItems.Add(, Data.Files(j), fname, "folder", "folder") sizecalc: Result = GetAttr(Data.Files(j)) And vbDirectory If Result Then filez = Dir(Data.Files(j) + "\*.*", vbNormal) ' count space of all files in the directory total = 0 Do While filez <> "" Set wixx = fs.GetFile(Data.Files(j) + "\" + filez) total = total + wixx.Size filez = Dir Loop mysize = CStr(Round(total / 1024, 0) + 1) Entry.SubItems(1) = mysize + " KB" queuesize (Round(total / 1024, 0)) Entry.Tag = Round(total / 1024, 0) Else Set myfile = fs.GetFile(Data.Files(j)) mysize = CStr(Round(myfile.Size / 1024, 0) + 1) Entry.SubItems(1) = mysize + " KB" queuesize (Round(myfile.Size / 1024, 0)) Entry.Tag = Round(myfile.Size / 1024, 0) End If j = j + 1 Wend ListView1.Sorted = True nomorefiles: End Sub Private Sub queuesize(amount As Long) QueueFill.Tag = QueueFill.Tag + amount QueueFill.Caption = CStr(QueueFill.Tag) + " KBytes in Queue" End Sub Private Sub RandomButton_Click() Randomize Set fs = CreateObject("Scripting.FileSystemObject") ' recursively get all files in the path rfxpglobal.RandomCounter = 0 ' clear the global array For i = 0 To 4999 rfxpglobal.RandomFiles(i) = "" Next getmp3files (Dir1.path) If (rfxpglobal.RandomCounter = 0) Then GoTo raus ' get free space Set Rio500 = CreateObject("Rio500Remix.Rio500") Rio500.Open avail = Rio500.AvailableMemory(RioFXP.Tag) avail = Round(avail / 1024, 0) Rio500.Close avail = avail - QueueFill.Tag ' random loop While (1) zufall = Rnd() zufall = zufall * (rfxpglobal.RandomCounter - 1) zufall = Round(zufall, 0) Set x = fs.GetFile(rfxpglobal.RandomFiles(zufall)) fsize = Round(x.Size / 1024, 0) If (avail - fsize > 0) Then On Error GoTo alreadythere Set Entry = ListView1.ListItems.Add(, rfxpglobal.RandomFiles(zufall), Right(rfxpglobal.RandomFiles(zufall), Len(rfxpglobal.RandomFiles(zufall)) - InStrRev(rfxpglobal.RandomFiles(zufall), "\")), "dfl", "dfl") Entry.SubItems(1) = CStr(fsize) + " KB" Entry.Tag = fsize queuesize (fsize) alreadythere: avail = avail - fsize Else GoTo raus End If Wend raus: End Sub Private Sub RemoveButton_Click() For i = ListView1.ListItems.Count To 1 Step -1 If (ListView1.ListItems.Item(i).Selected = True) Then queuesize (CLng(ListView1.ListItems.Item(i).Tag * -1)) ListView1.ListItems.Remove (i) End If Next End Sub Private Sub UploadButton_Click() ' Fill Global Array For i = 1 To ListView1.ListItems.Count rfxpglobal.DroppedFiles(i) = ListView1.ListItems.Item(i).Key Next AdvancedDialog.Hide RioFXP.UploadFiles Unload AdvancedDialog End Sub Public Sub getmp3files(path) Dim dirfiles(1024) As String myfile = Dir(path + "\*.*", vbDirectory) j = 0 Do While myfile <> "" dirfiles(j) = myfile myfile = Dir j = j + 1 If (j > 1022) Then GoTo maxfiles End If Loop maxfiles: j = 0 Do While dirfiles(j) <> "" If (LCase(Right(dirfiles(j), 3)) = "mp3") Then rfxpglobal.RandomFiles(rfxpglobal.RandomCounter) = path + "\" + dirfiles(j) rfxpglobal.RandomCounter = rfxpglobal.RandomCounter + 1 End If If Not (Left(dirfiles(j), 1) = ".") Then On Error GoTo nextone Result = GetAttr(path + "\" + dirfiles(j)) And vbDirectory If Result Then getmp3files (path + "\" + dirfiles(j)) End If nextone: End If j = j + 1 Loop End Sub