[VB][HELP] Read Subfolder in saves and profiles

Fabiok89 Feb 1, 2012

  1. Fa

    Fabiok89 Newbie
    0/47

    Joined:
    Jan 7, 2010
    Messages:
    6
    Likes Received:
    1
    Trophy Points:
    0
    Console:
    Xbox
    I'm trying to create my PackageManager and I wanted to implement the function to read / write the files contained in the subfolders. For now I can correctly read all files and folders in the root. How do I read the files in subfolders? This is the code I am using:

    Code:
    Dim STFS As New STFSPackage(File, Nothing)
    		For Each Folder As STFS.FolderEntry In STFS.FolderDirectory
    			Dim nodocartelle As New Node()
    			nodocartelle.Tag = Folder
    			nodocartelle.Name = Folder.Name
    			nodocartelle.Text = Folder.Name
    			Node1.Nodes.Add(nodocartelle)
    		Next
    		ListViewEx1.Items.Clear()
    		MsgBox(STFS.FileDirectory.ToString)
    		For Each Entry As STFS.FileEntry In STFS.FileDirectory
    			Dim salvataggio As New ListViewItem()
    			salvataggio.Tag = Entry.GetPath
    			salvataggio.Name = Entry.Name
    			salvataggio.Text = Entry.Name
    			salvataggio.SubItems.Add(Entry.Size.ToString)
    			ListViewEx1.Items.Add(salvataggio)
    		Next
     
  2. c0

    c0madr0ne Newbie
    0/47

    Joined:
    Jul 19, 2009
    Messages:
    896
    Likes Received:
    109
    Trophy Points:
    0
    Console:
    Playstation 3
    well when you create the instance of the folder just read the entries inside it and append that node while doing it.......

    or create a click event so when the user clicks on the node you can at that time pass the entries to the listview
     
  3. ghostcom

    ghostcom Newbie
    0/47

    Joined:
    Jan 13, 2011
    Messages:
    82
    Likes Received:
    1
    Trophy Points:
    0
    Location:
    Office Space - Cube 15
    Console:
    Xbox
    c0ma's reading all entries would work (linear folder traversal), although, you could also look into using recursion depending on the folder structure depth (more nested folders = more chance of a stack overflow), but it could be a useful implementation of recursion.
     

Share This Page

Close