Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
Sonic-The-Hedgehog-LNK1123 opened this issue Jun 27, 2020 · 7 comments
Assignees

Comments

@Sonic-The-Hedgehog-LNK1123
Copy link
Contributor

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 ironfede self-assigned this Jul 15, 2020
@ironfede
Copy link
Owner

@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
Copy link

jtran commented Sep 1, 2021

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?

@farfilli
Copy link

What about being able to retrieve the filename over the root? I haven't found a way to do it.

@jeremy-visionaid
Copy link
Collaborator

@Sonic-The-Hedgehog-LNK1123 @farfilli Better late than never... I've added a Path property to the EntryInfo in the v3.0 proof of concept:

image

Is this sufficient for your purposes?

@farfilli
Copy link

farfilli commented Nov 13, 2024

My problem was accessing the file stream name, which was a non-public property and I have fixed it through reflections
It seems on V3 to be public, but I still can't access it directly.

Should it be shown as non-public as it was previously?
image

@jeremy-visionaid
Copy link
Collaborator

jeremy-visionaid commented Nov 13, 2024

@farfilli v3 is based around abstract streams, so it's not necessarily tied to a file. However, I've added a property to expose the base Stream and you can use pattern matching from there to get the file name if the base stream is a FileStream. e.g.

        string? fileName = (rootStorage.BaseStream is FileStream fileStream) ? fileStream.Name : null;

Otherwise, I think it would be up to the developer to store the filename separately.

@jeremy-visionaid
Copy link
Collaborator

@farfilli I'll close this one as fixed by #194 . Please go ahead and open a new issue though if the above is not sufficient for your case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants