var parts = item.Name.Split('/');
- //Dont't add files
- if (!item.IsDirectory)
+ if (item.IsDirectory)
{
+ AddParentNodes(lookups, rootNodes, parts, item);
+
+ //Store each item using its current path
+ var newNode = new DirectoryRecord {DisplayName = parts.Last(), ObjectInfo = item};
+ AddNode(rootNodes, lookups, newNode);
+ }
+ else
+ {
+ //Dont't add files
//But check to ensure that we DO have it's parent on record
- //It it exist
+ //If it exist
if (lookups.TryGetValue(parentPath, out parent))
{
//Just continue
//Since this is not a directory, we won't add the item itself
AddParentNodes(lookups, rootNodes, parts, item);
}
- else
- {
- AddParentNodes(lookups, rootNodes, parts, item);
-
- //Store each item using its current path
- var newNode = new DirectoryRecord {DisplayName = parts.Last(), ObjectInfo = item};
- AddNode(rootNodes, lookups, newNode);
- }
-
}
return rootNodes;
}