This project is read-only.

Trying to use AddDirectory()...

Oct 23, 2012 at 9:45 PM
Edited Oct 23, 2012 at 9:45 PM

AddDirectory *appears* to work (I can open the ISO with 7zip and see my content), but when I try to recursively search the ISO with CDReader(), my method goes into an infinite loop because it never detects the leaf node of the directory structure. Some code snippets to illustrate:

1. Create and Populate Directory.


// C:\Chicago\Sales\Backups
var isoDirectoryStructure = _isoDirectoryLayout.Substring(_isoDirectoryLayout.IndexOf(':')+2);  
builder.AddFile(isoDirectoryStructure + "\\" + f.Name, new byte[0]));

2. Find files in the Backups folder
private static void GetLeafDir(CDReader cd, string fileName, ref string leafNode)
        // foreach generates the following in an infinite loop
        // Chicago
        // Chicago\Sales
        // Chicago\Sales\Backups
        // Chicago\Sales\Backups
        // etc...
        foreach (var d in cd.GetDirectories(fileName))
              GetLeafDir(cd, d, ref leafNode);

        if (cd.GetDirectories(fileName).Length.Equals(0))
                    leafNode = fileName;
    catch { }


I presume I am initializing AddDirectory\AddFiles incorrectly - what am i missing?




Oct 23, 2012 at 11:49 PM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.