Le 15 févr. 07 à 16:56 Soir, Dennis Birch a écrit:
On 2/15/07, Eric Richards <[EMAIL PROTECTED]> wrote:
>
> Think of your VirtualVolume file as a file system, and root is the
> highest directory you can access.
>
> I have an application whose file format is a bunch of different
> folders within the root, each of which may contain anywhere from
one
> to several different files. I chose to organize it that way to
keep it
> better organized from my perspective. The files could have all been
> stored within the root (i.e. no subfolders), instead, but I
chose this
> way of doing it. It's totally up to you.
>
> So the way you get something out of a VirtualVolume file is to
get the
> root FolderItem and then dig down from there to wherever you have
> saved your data in the structure you created. Hope that makes
sense.
>
Ahh.. ok.
Well I got a VV file made and stuffed with data.. I think.
Now getting it out seems a bit tricky. I want
to get each file (Name) listed in a listbox.
Dim vv As VirtualVolume
Dim realFile As FolderItem
Dim virtFile As FolderItem
Dim inp As BinaryStream
realFile = GetFolderItem("").Child("VirVol")
vv = realFile.OpenAsVirtualVolume
If vv = Nil then
MsgBox "Unable to open virtual volume"
else
virtFile = vv.Root.child("Data")
inp = virtFile.openAsBinaryFile()
//ListBox1.addRow inp.readPString
end if
exception
quit
Not knowing how you wrote your information to your virtual volume, I
couldn't tell you whether or not the code above should or should not
work. It appears you are accessing one file at the root level of the
virtual volume and reading it. You don't need to use a virtual volume
to do that. What you're doing is the same as reading a normal, single
file.
If you're trying to store and then read back a bunch of different
files, you would want to save them as children of root. Then when
reading them out, you would iterate over the items in root.
He said he wants to list the name of all the files to a listbox (he's
experimenting virtualvolumes, in my opinion).
To do that, you'd use something like that:
dim f As FolderItem
dim g As FolderItem
dim i As Integer
f=MyVirtualVolume.Root
for i=1 to f.Count
g=f.Item(i) 'No aliases or invalid files that does not exist, in a
virtual volume
ListBox1.AddRow g.Name
next
Is that what you are trying to do, Eric?
BTW, I've made a simple application to handle virtualvolumes
(copying, moving, renaming, deleting, creating folders, counting
sizes, importing and exporting). If you want to take a look, let me
know._______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>