Skip to content

Commit

Permalink
Do not depend on HasSubFolders flag when reading folder structures, a…
Browse files Browse the repository at this point in the history
…s it is not always set
  • Loading branch information
Dijji committed Aug 28, 2018
1 parent f15e102 commit bc9b7fa
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions XstFile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ class XstFile
{
{EpropertyTag.PidTagDisplayName, (f, val) => f.Name = val },
{EpropertyTag.PidTagContentCount, (f, val) => f.ContentCount = val },
{EpropertyTag.PidTagSubfolders, (f, val) => f.HasSubFolders = val },
// Don't bother reading HasSubFolders, because it is not always set
// {EpropertyTag.PidTagSubfolders, (f, val) => f.HasSubFolders = val },
};

// When reading folder contents, the message properties we ask for
Expand Down Expand Up @@ -322,14 +323,11 @@ private Folder ReadFolderStructure(FileStream fs, NID nid)

ltp.ReadProperties<Folder>(fs, nid, pgFolder, f);

if (f.HasSubFolders)
{
foreach (var sf in ltp.ReadTableRowIds(fs, NID.TypedNID(EnidType.HIERARCHY_TABLE, nid))
.Where(id => id.nidType == EnidType.NORMAL_FOLDER)
.Select(id => ReadFolderStructure(fs, id))
.OrderBy(sf => sf.Name))
f.Folders.Add(sf);
}
foreach (var sf in ltp.ReadTableRowIds(fs, NID.TypedNID(EnidType.HIERARCHY_TABLE, nid))
.Where(id => id.nidType == EnidType.NORMAL_FOLDER)
.Select(id => ReadFolderStructure(fs, id))
.OrderBy(sf => sf.Name))
f.Folders.Add(sf);

return f;
}
Expand Down

0 comments on commit bc9b7fa

Please sign in to comment.