ironfede / openmcdf

Microsoft Compound File .net component - pure C# - netstandard 2.0
Mozilla Public License 2.0
309 stars 76 forks source link

Is there a way to list all storages/streams with full paths? #66

Open Sonic-The-Hedgehog-LNK1123 opened 4 years ago

Sonic-The-Hedgehog-LNK1123 commented 4 years ago

I need to enumerate all the storages and streams recursively, but when using CFStorage.VisitEntries(action, true) I can only get the name property, but then I've no way of knowing to what storage the substorage or stream belongs to!

I want to get from this:

(Root)
|
+---UserForm1
|   |
|   +---o
|   |
|   +---f
|   |
|   +---CompObj
|   |
|   \---VBFrame
|
+---VBA
|   |
|   +---UserForm1
|   |
|   +---dir
|   |
|   +---ThisDocument
|   |
|   \---_VBA_PROJECT
|
+---PROJECT
|
\---PROJECTwm

to this:

UserForm1\o
UserForm1\f
UserForm1\CompObj
UserForm1\VBFrame
VBA\UserForm1
VBA\dir
VBA\ThisDocument
VBA\_VBA_PROJECT
PROJECT
PROJECTwm

This is probably what #63 meant as well, but that is unclear.

ironfede commented 4 years ago

@Sonic-The-Hedgehog-LNK1123 , currently there is no such feature. You should customize VisitEntries method to add a "path" parameter in recursive section of the visitor. Anyway this is an enhancement I will include in a next release. If you find a solution, please feel free to open a pull request for integration. Thank you, Best Regards Federico

jtran commented 3 years ago

Has there been any progress made on this? It's essential for an application I'm working on to know what storage each stream originated from.

I noticed that in the Structured Storage Explorer, it does this by calling VisitEntries(action, false), and then recursing inside the action. See MainForm.AddNodes(). Is that a safe workaround?