Xojo Conferences
XDCMay2019MiamiUSA

[MBS] Question regarding FileLIstMBS improvements (MBS Xojo Plugin Mailinglist archive)

Back to the thread list
Previous thread: [MBS] FolderItem.IsWriteable (RB4.5.3 / MBS 3.2)
Next thread: [MBS] 6.1pr1


Re: [MBS] MIDI Destinations and External Devices   -   Ron Benditt
  [MBS] Question regarding FileLIstMBS improvements   -   Dennis Birch
   Re: [MBS] Question regarding FileLIstMBS improvements   -   Christian Schmitz
    Re: [MBS] Question regarding FileLIstMBS improvements   -   Dennis Birch
     Re: [MBS] Question regarding FileLIstMBS improvements   -   Christian Schmitz

[MBS] Question regarding FileLIstMBS improvements
Date: 01.02.06 15:43 (Wed, 1 Feb 2006 06:43:55 -0800)
From: Dennis Birch
Christian,

Thanks for the new additions to the FileListMBS class. Unfortunately
I'm stumped on one issue. Hopefully it's just because I haven't had
my morning coffee yet, but I'm writing this just in case that doesn't
help.

My current method for searching a folder or volume looks like this:

Protected Sub RecursiveSearch(folder As FolderItem, name As String)
dim i, c as integer
dim f as FileListMBS

f = new FileListMBS(folder)

c = f.Count - 1
for i = 0 to c
if instr(f.Name(i), name) > 0 and NameMatch(f.Item(i)) and
DateMatch(f, i) Then
Owner.AddItem f.Item(i)
FileFound = True
end if

if f.Directory(i) and not IsBundle(f.Item(i)) Then
RecursiveSearch f.Item(i), name
end
next
End Sub

NameMatch and DateMatch are functions that match user criteria stored
as class properties.

Here is my revised RecursiveSearch method to take advantage of the
new constructor and isBundle method:

Protected Sub RecursiveSearch(f As FileListMBS, name As String)
dim i, c as integer
dim folder as FileListMBS

c = f.Count - 1
for i = 0 to c
if instr(f.Name(i), name) > 0 and NameMatch(f.Item(i)) and
DateMatch(f, i) Then
Owner.AddItem f.Item(i)
FileFound = True
end if

if f.Directory(i) and not f.IsBundle(i) Then
folder = new FileListMBS(f.Item(i)) // isn't this costing
the same as getting a folderitem in the original version?
RecursiveSearch folder, name
end
next
End Sub

As you can see from the comment in the revised method, I'm not clear
that I'm doing my search any more efficiently with this new
constructor. Can you straighten me out?

-- Dennis
_______________________________________________
Mbsplugins_monkeybreadsoftware.info mailing list
<email address removed>
http://ml01.ispgateway.de/mailman/listinfo/mbsplugins_monkeybreadsoftware.info

Re: [MBS] Question regarding FileLIstMBS improvements
Date: 01.02.06 18:16 (Wed, 1 Feb 2006 18:16:44 +0100)
From: Christian Schmitz
Dennis Birch <<email address removed>> wrote:

> folder = new FileListMBS(f.Item(i))
> // isn't this costing
> the same as getting a folderitem in the original version?

As you do it, it is at the same cost.

Optimized code is like this:

folder=new FileListMBS(f,i)

You pass the old FileListMBS and the index. ok?

mfg
Christian

Re: [MBS] Question regarding FileLIstMBS improvements
Date: 01.02.06 23:30 (Wed, 1 Feb 2006 14:30:27 -0800)
From: Dennis Birch
At 6:16 PM +0100 2/1/06, Christian Schmitz wrote:
>Dennis Birch <<email address removed>> wrote:
>
>> folder = new FileListMBS(f.Item(i))
>> // isn't this costing
>> the same as getting a folderitem in the original version?
>
>As you do it, it is at the same cost.
>
>Optimized code is like this:
>
>folder=new FileListMBS(f,i)
>
>You pass the old FileListMBS and the index. ok?

Yes, that works quite nicely. I didn't see any documentation in the
download, so I didn't realize there was a way to access a reference
to the folder in that way.
_______________________________________________
Mbsplugins_monkeybreadsoftware.info mailing list
<email address removed>
http://ml01.ispgateway.de/mailman/listinfo/mbsplugins_monkeybreadsoftware.info

Re: [MBS] Question regarding FileLIstMBS improvements
Date: 02.02.06 00:18 (Thu, 2 Feb 2006 00:18:29 +0100)
From: Christian Schmitz
Dennis Birch <<email address removed>> wrote:

> Yes, that works quite nicely. I didn't see any documentation in the
> download, so I didn't realize there was a way to access a reference
> to the folder in that way.

Correct. Documentation will come with the next website update.

Mfg
Christian